Class: Fastlane::Actions::BuildkiteAnnotateAction
- Inherits:
-
Action
- Object
- Action
- Fastlane::Actions::BuildkiteAnnotateAction
- Defined in:
- lib/fastlane/plugin/wpmreleasetoolkit/actions/common/buildkite_annotate_action.rb
Documentation collapse
- .authors ⇒ Object
- .available_options ⇒ Object
- .description ⇒ Object
- .details ⇒ Object
- .is_supported?(platform) ⇒ Boolean
Class Method Summary collapse
Class Method Details
.authors ⇒ Object
78 79 80 |
# File 'lib/fastlane/plugin/wpmreleasetoolkit/actions/common/buildkite_annotate_action.rb', line 78 def self. ['Automattic'] end |
.available_options ⇒ Object
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/fastlane/plugin/wpmreleasetoolkit/actions/common/buildkite_annotate_action.rb', line 45 def self. [ FastlaneCore::ConfigItem.new( key: :context, env_name: 'BUILDKITE_ANNOTATION_CONTEXT', description: 'The context of the annotation used to differentiate this annotation from others', type: String, optional: true ), FastlaneCore::ConfigItem.new( key: :style, env_name: 'BUILDKITE_ANNOTATION_STYLE', description: 'The style of the annotation (`success`, `info`, `warning` or `error`)', type: String, optional: true, verify_block: proc do |value| valid_values = %w[success info warning error] next if value.nil? || valid_values.include?(value) UI.user_error!("Invalid value `#{value}` for parameter `style`. Valid values are: #{valid_values.join(', ')}") end ), FastlaneCore::ConfigItem.new( key: :message, description: 'The message to use in the new annotation. Supports GFM-Flavored Markdown. ' \ + 'If message is nil, any existing annotation with the provided context will be deleted', type: String, optional: true, default_value: nil # nil message = delete existing annotation if any ), ] end |
.description ⇒ Object
30 31 32 |
# File 'lib/fastlane/plugin/wpmreleasetoolkit/actions/common/buildkite_annotate_action.rb', line 30 def self.description 'Add or remove annotations to the current Buildkite build' end |
.details ⇒ Object
34 35 36 37 38 39 40 41 42 43 |
# File 'lib/fastlane/plugin/wpmreleasetoolkit/actions/common/buildkite_annotate_action.rb', line 34 def self.details " Add or remove annotations to the current Buildkite build.\n\n Has to be run on a CI job (where a `buildkite-agent` is running), e.g. typically by a lane\n that is triggered as part of a Buildkite CI step.\n\n See https://buildkite.com/docs/agent/v3/cli-annotate\n DETAILS\nend\n" |
.is_supported?(platform) ⇒ Boolean
82 83 84 |
# File 'lib/fastlane/plugin/wpmreleasetoolkit/actions/common/buildkite_annotate_action.rb', line 82 def self.is_supported?(platform) true end |
.run(params) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/fastlane/plugin/wpmreleasetoolkit/actions/common/buildkite_annotate_action.rb', line 6 def self.run(params) = params[:message] context = params[:context] style = params[:style] if .nil? # Delete an annotation, but swallow the error if the annotation didn't exist — to avoid having # this action failing or printing a red log for no good reason — hence the `|| true` ctx_param = "--context #{context.shellescape}" unless context.nil? sh("buildkite-agent annotation remove #{ctx_param} || true") else # Add new annotation using `buildkite-agent` extra_params = { context: context, style: style }.compact.flat_map { |k, v| ["--#{k}", v] } sh('buildkite-agent', 'annotate', *extra_params, params[:message]) end end |