Class: Fastlane::Actions::GetPrsBetweenTagsAction
- Inherits:
-
Action
- Object
- Action
- Fastlane::Actions::GetPrsBetweenTagsAction
- Defined in:
- lib/fastlane/plugin/wpmreleasetoolkit/actions/common/get_prs_between_tags.rb
Class Method Summary collapse
- .authors ⇒ Object
- .available_options ⇒ Object
- .description ⇒ Object
- .details ⇒ Object
- .is_supported?(platform) ⇒ Boolean
- .return_value ⇒ Object
- .run(params) ⇒ Object
Class Method Details
.authors ⇒ Object
47 48 49 |
# File 'lib/fastlane/plugin/wpmreleasetoolkit/actions/common/get_prs_between_tags.rb', line 47 def self. ['Automattic'] end |
.available_options ⇒ Object
73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 |
# File 'lib/fastlane/plugin/wpmreleasetoolkit/actions/common/get_prs_between_tags.rb', line 73 def self. [ FastlaneCore::ConfigItem.new(key: :repository, env_names: %w[GIT_REPO_SLUG BUILDKITE_REPO], description: 'The repository name, including the organization (e.g. `wordpress-mobile/wordpress-ios`)', optional: false, default_value_dynamic: true, type: String), FastlaneCore::ConfigItem.new(key: :tag_name, description: 'The name of the tag for the release we are about to create. This can be an existing tag or a new one', optional: false, type: String), FastlaneCore::ConfigItem.new(key: :target_commitish, description: 'Specifies the commitish value that will be the target for the release\'s tag. ' \ 'Required if the supplied `tag_name` does not reference an existing tag. Ignored if the tag_name already exists. ' \ 'Defaults to the commit sha of the current HEAD', optional: true, default_value: `git rev-parse HEAD`.chomp, default_value_dynamic: true, type: String), FastlaneCore::ConfigItem.new(key: :previous_tag, description: 'The name of the previous tag to use as the starting point for the release notes. ' \ 'If not provided explicitly, GitHub will use the last tag as the starting point', optional: true, type: String), FastlaneCore::ConfigItem.new(key: :configuration_file_path, description: 'Path to a file in the repository containing configuration settings used for generating the release notes. ' \ 'If unspecified, the configuration file located in the repository at `.github/release.yml` or `.github/release.yaml` will be used. ' \ 'If that is not present, the default configuration will be used. ' \ 'See https://docs.github.com/en/repositories/releasing-projects-on-github/automatically-generated-release-notes#configuration-options', optional: true, type: String), Fastlane::Helper::GithubHelper.github_token_config_item, ] end |
.description ⇒ Object
43 44 45 |
# File 'lib/fastlane/plugin/wpmreleasetoolkit/actions/common/get_prs_between_tags.rb', line 43 def self.description 'Gets a markdown text containing the list of PRs that have been merged between two git tags' end |
.details ⇒ Object
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
# File 'lib/fastlane/plugin/wpmreleasetoolkit/actions/common/get_prs_between_tags.rb', line 55 def self.details <<~DETAILS Uses the GitHub API to get a generated changelog consisting of the list of PRs that have been merged between two git tags. The list of PRs can optionally be categorized using a config file (typically living at `.github/release.yml`) This is typically useful to generate a CHANGELOG-style list of PRs for a given build since a last build. For example: - List PRs between current beta that we just built (e.g. 12.3-rc-4) and the previous beta of the same version: git_prs_between_tags(tag_name: '12.3-rc-4', previous_tag: '12.3-rc-3') - List all PRs that landed since the last stable/final release: git_prs_between_tags(tag_name: '12.3-rc-4', previous_tag: '12.2') Tip: You can use the `find_previous_tag` action to help you find the previous_tag matching an expected pattern (like `12.3-rc-*`) See https://docs.github.com/en/rest/releases/releases?apiVersion=2022-11-28#generate-release-notes-content-for-a-release DETAILS end |
.is_supported?(platform) ⇒ Boolean
109 110 111 |
# File 'lib/fastlane/plugin/wpmreleasetoolkit/actions/common/get_prs_between_tags.rb', line 109 def self.is_supported?(platform) true end |
.return_value ⇒ Object
51 52 53 |
# File 'lib/fastlane/plugin/wpmreleasetoolkit/actions/common/get_prs_between_tags.rb', line 51 def self.return_value 'The markdown-formatted string listing the PRs between the provided tags' end |
.run(params) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/fastlane/plugin/wpmreleasetoolkit/actions/common/get_prs_between_tags.rb', line 9 def self.run(params) repository = params[:repository] tag_name = params[:tag_name] target_commitish = params[:target_commitish] previous_tag = params[:previous_tag] config_file_path = params[:configuration_file_path] gh_token = params[:github_token] # Get commit list github_helper = Fastlane::Helper::GithubHelper.new(github_token: gh_token) changelog = begin github_helper.generate_release_notes( repository: repository, tag_name: tag_name, previous_tag: previous_tag, target_commitish: target_commitish, config_file_path: config_file_path ) rescue StandardError => e error_msg = "❌ Error computing the list of PRs since #{previous_tag || 'last release'}: `#{e.}`" UI.important(error_msg) error_msg # Use error message as GitHub Release body to help us be aware of what went wrong. end previous_release_link = if previous_tag.nil? 'last release' else link = github_helper.get_release_url(repository: repository, tag_name: previous_tag) "[#{previous_tag}](#{link})" end changelog .gsub("## What's Changed", "## New PRs since #{previous_release_link}\n") end |