Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bump_version_update_changelog_create_pr_action and create_next_snapshot_version_action: added next_release label #17

Merged
merged 1 commit into from
Aug 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
NachoSoto marked this conversation as resolved.
Show resolved Hide resolved
)
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
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
let(:current_version) { '1.12.0' }
let(:next_version) { '1.13.0-SNAPSHOT' }
let(:new_branch_name) { 'bump/1.13.0-SNAPSHOT' }
let(:labels) { ['next_release'] }

it 'calls all the appropriate methods with appropriate parameters' do
expect(Fastlane::Helper::RevenuecatInternalHelper).to receive(:validate_local_config_status_for_bump)
Expand All @@ -24,7 +25,7 @@
.with('Preparing for next version')
.once
expect(Fastlane::Helper::RevenuecatInternalHelper).to receive(:create_pr_to_main)
.with('Prepare next version: 1.13.0-SNAPSHOT', nil, repo_name, new_branch_name, github_pr_token)
.with('Prepare next version: 1.13.0-SNAPSHOT', nil, repo_name, new_branch_name, github_pr_token, labels)
.once
Fastlane::Actions::CreateNextSnapshotVersionAction.run(
current_version: current_version,
Expand Down
5 changes: 3 additions & 2 deletions spec/helper/revenuecat_internal_helper_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -360,9 +360,10 @@ def setup_stubs
body: 'fake-changelog',
repo: 'RevenueCat/fake-repo-name',
head: 'fake-branch',
api_url: 'https://api.github.com'
api_url: 'https://api.github.com',
labels: ['label_1', 'label_2']
).once
Fastlane::Helper::RevenuecatInternalHelper.create_pr_to_main('fake-title', 'fake-changelog', 'fake-repo-name', 'fake-branch', 'fake-github-pr-token')
Fastlane::Helper::RevenuecatInternalHelper.create_pr_to_main('fake-title', 'fake-changelog', 'fake-repo-name', 'fake-branch', 'fake-github-pr-token', ['label_1', 'label_2'])
end
end

Expand Down