Class: Fastlane::Actions::CommentOnPrAction
- Inherits:
-
Action
- Object
- Action
- Fastlane::Actions::CommentOnPrAction
- Defined in:
- lib/fastlane/plugin/wpmreleasetoolkit/actions/common/comment_on_pr.rb
Class Method Summary collapse
- .authors ⇒ Object
- .available_options ⇒ Object
- .description ⇒ Object
- .details ⇒ Object
- .is_supported?(platform) ⇒ Boolean
- .output ⇒ Object
- .return_value ⇒ Object
- .run(params) ⇒ Object
Class Method Details
.authors ⇒ Object
30 31 32 |
# File 'lib/fastlane/plugin/wpmreleasetoolkit/actions/common/comment_on_pr.rb', line 30 def self. ['Automattic'] end |
.available_options ⇒ Object
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/fastlane/plugin/wpmreleasetoolkit/actions/common/comment_on_pr.rb', line 43 def self. [ Fastlane::Helper::GithubHelper.github_token_config_item, FastlaneCore::ConfigItem.new( key: :reuse_identifier, description: 'If provided, the reuse identifier can identify an existing comment to overwrite', type: String, default_value: nil ), FastlaneCore::ConfigItem.new( key: :project, description: 'The project slug (ex: `wordpress-mobile/wordpress-ios`)', type: String ), FastlaneCore::ConfigItem.new( key: :pr_number, description: 'The PR number', type: Integer ), FastlaneCore::ConfigItem.new( key: :body, description: 'The content of the comment', type: String ), ] end |
.description ⇒ Object
26 27 28 |
# File 'lib/fastlane/plugin/wpmreleasetoolkit/actions/common/comment_on_pr.rb', line 26 def self.description 'Post a comment on a given PR number (optionally updating an existing one)' end |
.details ⇒ Object
34 35 36 37 38 39 40 41 |
# File 'lib/fastlane/plugin/wpmreleasetoolkit/actions/common/comment_on_pr.rb', line 34 def self.details <<~DETAILS If used just once, this method makes it nice and easy to post a quick comment to a GitHub PR. Subsequent runs will allow you to update an existing comment as many times as you need to (e.g. across multiple CI runs), by using a `:reuse_identifier` to identify the comment to update. DETAILS end |
.is_supported?(platform) ⇒ Boolean
80 81 82 |
# File 'lib/fastlane/plugin/wpmreleasetoolkit/actions/common/comment_on_pr.rb', line 80 def self.is_supported?(platform) true end |
.output ⇒ Object
70 71 72 73 74 |
# File 'lib/fastlane/plugin/wpmreleasetoolkit/actions/common/comment_on_pr.rb', line 70 def self.output [ ['PR_COMMENT_REUSE_IDENTIFIER', 'The `reuse_identifier` for the most recently posted comment'], ] end |
.return_value ⇒ Object
76 77 78 |
# File 'lib/fastlane/plugin/wpmreleasetoolkit/actions/common/comment_on_pr.rb', line 76 def self.return_value 'The `reuse_identifier` for the posted comment (useful for updating it later, if needed)' end |
.run(params) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/fastlane/plugin/wpmreleasetoolkit/actions/common/comment_on_pr.rb', line 10 def self.run(params) require_relative '../../helper/github_helper' github_helper = Fastlane::Helper::GithubHelper.new(github_token: params[:github_token]) reuse_identifier = github_helper.comment_on_pr( project_slug: params[:project], pr_number: params[:pr_number], body: params[:body], reuse_identifier: params[:reuse_identifier] ) Actions.lane_context[SharedValues::PR_COMMENT_REUSE_IDENTIFIER] = reuse_identifier reuse_identifier end |