Skip to content

Instantly share code, notes, and snippets.

@fedejordan
Created August 23, 2021 06:30
Show Gist options
  • Save fedejordan/c548df85b4272aac2c2883d3f9862c24 to your computer and use it in GitHub Desktop.
Save fedejordan/c548df85b4272aac2c2883d3f9862c24 to your computer and use it in GitHub Desktop.
Blog14 - Empty custom action
module Fastlane
module Actions
module SharedValues
PUBLISH_CODE_COVERAGE_CUSTOM_VALUE = :PUBLISH_CODE_COVERAGE_CUSTOM_VALUE
end
class PublishCodeCoverageAction < Action
def self.run(params)
# fastlane will take care of reading in the parameter and fetching the environment variable:
UI.message "Parameter API Token: #{params[:api_token]}"
# sh "shellcommand ./path"
# Actions.lane_context[SharedValues::PUBLISH_CODE_COVERAGE_CUSTOM_VALUE] = "my_val"
end
#####################################################
# @!group Documentation
#####################################################
def self.description
"A short description with <= 80 characters of what this action does"
end
def self.details
# Optional:
# this is your chance to provide a more detailed description of this action
"You can use this action to do cool things..."
end
def self.available_options
# Define all options your action supports.
# Below a few examples
[
FastlaneCore::ConfigItem.new(key: :api_token,
env_name: "FL_PUBLISH_CODE_COVERAGE_API_TOKEN", # The name of the environment variable
description: "API Token for PublishCodeCoverageAction", # a short description of this parameter
verify_block: proc do |value|
UI.user_error!("No API token for PublishCodeCoverageAction given, pass using `api_token: 'token'`") unless (value and not value.empty?)
# UI.user_error!("Couldn't find file at path '#{value}'") unless File.exist?(value)
end),
FastlaneCore::ConfigItem.new(key: :development,
env_name: "FL_PUBLISH_CODE_COVERAGE_DEVELOPMENT",
description: "Create a development certificate instead of a distribution one",
is_string: false, # true: verifies the input is a string, false: every kind of value
default_value: false) # the default value if the user didn't provide one
]
end
def self.output
# Define the shared values you are going to provide
# Example
[
['PUBLISH_CODE_COVERAGE_CUSTOM_VALUE', 'A description of what this value contains']
]
end
def self.return_value
# If your method provides a return value, you can describe here what it does
end
def self.authors
# So no one will ever forget your contribution to fastlane :) You are awesome btw!
["Your GitHub/Twitter Name"]
end
def self.is_supported?(platform)
# you can do things like
#
# true
#
# platform == :ios
#
# [:ios, :mac].include?(platform)
#
platform == :ios
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment