Skip to content

Commit

Permalink
bump_version_update_changelog_create_pr_action and `create_next_sna…
Browse files Browse the repository at this point in the history
…pshot_version_action`: added `next_release` label

This will prevent Danger from failing these PRs due to missing a change label.
  • Loading branch information
NachoSoto committed Aug 12, 2022
1 parent b470362 commit 3572b32
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ def self.run(params)
Helper::RevenuecatInternalHelper.commmit_changes_and_push_current_branch("Version bump for #{new_version_number}")

pr_title = "Release/#{new_version_number}"
Helper::RevenuecatInternalHelper.create_pr_to_main(pr_title, changelog, repo_name, new_branch_name, github_pr_token)
label = 'next_release'
Helper::RevenuecatInternalHelper.create_pr_to_main(pr_title, changelog, repo_name, new_branch_name, github_pr_token, [label])
end

def self.description
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ def self.run(params)

next_version_snapshot = Helper::RevenuecatInternalHelper.calculate_next_snapshot_version(previous_version_number)
new_branch_name = "bump/#{next_version_snapshot}"
label = 'next_release'

Helper::RevenuecatInternalHelper.validate_local_config_status_for_bump(nil, new_branch_name, github_pr_token)

Expand All @@ -26,7 +27,7 @@ def self.run(params)

Helper::RevenuecatInternalHelper.commmit_changes_and_push_current_branch('Preparing for next version')

Helper::RevenuecatInternalHelper.create_pr_to_main("Prepare next version: #{next_version_snapshot}", nil, repo_name, new_branch_name, github_pr_token)
Helper::RevenuecatInternalHelper.create_pr_to_main("Prepare next version: #{next_version_snapshot}", nil, repo_name, new_branch_name, github_pr_token, [label])
end

def self.description
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def self.auto_generate_changelog(repo_name, github_token, rate_limit_sleep)
body = JSON.parse(resp[:body])
commits = body["commits"].reverse

supported_types = ["breaking", "build", "ci", "docs", "feat", "fix", "perf", "refactor", "style", "test"].to_set
supported_types = ["breaking", "build", "ci", "docs", "feat", "fix", "perf", "refactor", "style", "test", "next_release"].to_set
changelog_sections = { breaking_changes: [], fixes: [], new_features: [], other: [] }

commits.map do |commit|
Expand Down Expand Up @@ -133,15 +133,16 @@ def self.commmit_changes_and_push_current_branch(commit_message)
Actions::PushToGitRemoteAction.run(remote: 'origin')
end

def self.create_pr_to_main(title, body, repo_name, head_branch, github_pr_token)
def self.create_pr_to_main(title, body, repo_name, head_branch, github_pr_token, labels = [])
Actions::CreatePullRequestAction.run(
api_token: github_pr_token,
title: title,
base: 'main',
body: body,
repo: "RevenueCat/#{repo_name}",
head: head_branch,
api_url: 'https://api.github.com'
api_url: 'https://api.github.com',
labels: labels
)
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
let(:current_version) { '1.12.0' }
let(:new_version) { '1.13.0' }
let(:new_branch_name) { 'release/1.13.0' }
let(:labels) { ['next_release'] }

it 'calls all the appropriate methods with appropriate parameters' do
allow(FastlaneCore::UI).to receive(:input).with('New version number: ').and_return(new_version)
Expand Down Expand Up @@ -39,7 +40,7 @@
.with("Version bump for #{new_version}")
.once
expect(Fastlane::Helper::RevenuecatInternalHelper).to receive(:create_pr_to_main)
.with("Release/1.13.0", edited_changelog, mock_repo_name, new_branch_name, mock_github_pr_token)
.with("Release/1.13.0", edited_changelog, mock_repo_name, new_branch_name, mock_github_pr_token, labels)
.once

Fastlane::Actions::BumpVersionUpdateChangelogCreatePrAction.run(
Expand Down
3 changes: 2 additions & 1 deletion spec/actions/create_next_snapshot_version_action_spec.rb