Skip to content

Commit

Permalink
Add support for labels with pr: prefix (#69)
Browse files Browse the repository at this point in the history
* add pr prefix

* change back to include
  • Loading branch information
vegaro authored Sep 5, 2024
1 parent 85e1c83 commit 5140dbc
Show file tree
Hide file tree
Showing 23 changed files with 45 additions and 45 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ def self.is_supported?(platform)
Helper::RevenuecatInternalHelper.commit_changes_and_push_current_branch("Version bump for #{new_version_number}")

pr_title = "Updates purchases-hybrid-common to #{new_version_number}"
labels = ['phc_dependencies']
labels = ['pr:phc_dependencies']
body = pr_title
base_branch = "main"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def self.run(params)
Helper::RevenuecatInternalHelper.commit_changes_and_push_current_branch("Version bump for #{new_version_number}")

pr_title = "Release/#{new_version_number}"
label = 'next_release'
label = 'pr:next_release'
body = changelog

if automatic_release
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,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'
label = 'pr:next_release'

Helper::RevenuecatInternalHelper.validate_local_config_status_for_bump(new_branch_name, github_pr_token)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ module Fastlane

module Helper
class GitHubHelper
SUPPORTED_PR_LABELS = %w[breaking build ci docs feat fix perf revenuecatui refactor style test next_release dependencies phc_dependencies minor].to_set
SUPPORTED_PR_LABELS = (%w[breaking build ci docs feat fix perf revenuecatui refactor style test next_release dependencies phc_dependencies minor].map { |label| "pr:#{label}" }).to_set

def self.get_pr_resp_items_for_sha(sha, github_token, rate_limit_sleep, repo_name, base_branch)
if rate_limit_sleep > 0
Expand Down
24 changes: 12 additions & 12 deletions lib/fastlane/plugin/revenuecat_internal/helper/versioning_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ module Fastlane
}

BUMP_PER_LABEL = {
major: %w[breaking].to_set,
minor: %w[feat minor].to_set,
patch: %w[docs fix perf dependencies phc_dependencies revenuecatui].to_set,
skip: %w[build ci refactor style test next_release].to_set
major: %w[pr:breaking].to_set,
minor: %w[pr:feat pr:minor].to_set,
patch: %w[pr:docs pr:fix pr:perf pr:dependencies pr:phc_dependencies pr:revenuecatui].to_set,
skip: %w[pr:build pr:ci pr:refactor pr:style pr:test pr:next_release].to_set
}

module Helper
Expand Down Expand Up @@ -66,12 +66,12 @@ def self.auto_generate_changelog(repo_name, github_token, rate_limit_sleep, incl
message = "#{item['title']} (##{item['number']})"
username = item["user"]["login"]
types_of_change = get_type_of_change_from_pr_info(item)
next if types_of_change.include?("next_release")
next if types_of_change.include?("pr:next_release")

section = get_section_depending_on_types_of_change(types_of_change)

line = "* #{message} via #{name} (@#{username})"
if types_of_change.include?("phc_dependencies")
if types_of_change.include?("pr:phc_dependencies")
# Append links to native releases
line += native_releases_links(github_token, hybrid_common_version, versions_file_path)
end
Expand Down Expand Up @@ -264,17 +264,17 @@ def self.append_phc_version_if_necessary(append_phc_version_if_next_version_is_n

# rubocop:disable Metrics/PerceivedComplexity
private_class_method def self.get_section_depending_on_types_of_change(change_types)
if change_types.include?("breaking")
if change_types.include?("pr:breaking")
:breaking_changes
elsif change_types.include?("revenuecatui")
elsif change_types.include?("pr:revenuecatui")
:paywalls
elsif change_types.include?("feat")
elsif change_types.include?("pr:feat")
:new_features
elsif change_types.include?("fix")
elsif change_types.include?("pr:fix")
:fixes
elsif change_types.include?("perf")
elsif change_types.include?("pr:perf")
:performance
elsif change_types.include?("dependencies") || change_types.include?("phc_dependencies")
elsif change_types.any? { |type| type == "pr:dependencies" || type == "pr:phc_dependencies" }
:dependency_updates
else
:other
Expand Down
4 changes: 2 additions & 2 deletions spec/actions/bump_phc_version_action_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
let(:base_branch) { 'main' }
let(:new_version) { '1.13.0' }
let(:new_branch_name) { 'bump-phc/1.13.0' }
let(:labels) { ['phc_dependencies'] }
let(:labels) { ['pr:phc_dependencies'] }

it 'fails if version is invalid' do
allow(FastlaneCore::UI).to receive(:interactive?).and_return(true)
Expand Down Expand Up @@ -193,7 +193,7 @@
.once
message = "Updates purchases-hybrid-common to 1.12.1"
expect(Fastlane::Helper::RevenuecatInternalHelper).to receive(:create_pr)
.with(message, message, mock_repo_name, base_branch, new_branch_name, mock_github_pr_token, ['phc_dependencies'])
.with(message, message, mock_repo_name, base_branch, new_branch_name, mock_github_pr_token, ['pr:phc_dependencies'])
.once

Fastlane::Actions::BumpPhcVersionAction.run(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
let(:base_branch) { 'main' }
let(:new_version) { '1.13.0' }
let(:new_branch_name) { 'release/1.13.0' }
let(:labels) { ['next_release'] }
let(:labels) { ['pr:next_release'] }
let(:hybrid_common_version) { '4.5.3' }
let(:versions_file_path) { '../VERSIONS.md' }

Expand Down
2 changes: 1 addition & 1 deletion spec/actions/create_next_snapshot_version_action_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
let(:base_branch) { 'main' }
let(:next_version) { '1.13.0-SNAPSHOT' }
let(:new_branch_name) { 'bump/1.13.0-SNAPSHOT' }
let(:labels) { ['next_release'] }
let(:labels) { ['pr: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 Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"id": 4352868120,
"node_id": "LB_kwDOBnB8hc8AABACA3N_HQ",
"url": "https://api.github.com/repos/RevenueCat/purchases-ios/labels/fix",
"name": "fix",
"name": "pr:fix",
"color": "8E3E6B",
"default": false,
"description": ""
Expand All @@ -47,7 +47,7 @@
"id": 4352868120,
"node_id": "LA_kwDOBnB8hc8AAAACA3N_HD",
"url": "https://api.github.com/repos/RevenueCat/purchases-ios/labels/breaking",
"name": "breaking",
"name": "pr:breaking",
"color": "8B3E6C",
"default": false,
"description": ""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"id": 4352868120,
"node_id": "LB_kwDOBnB8hc8AABACA3N_HQ",
"url": "https://api.github.com/repos/RevenueCat/purchases-ios/labels/fix",
"name": "fix",
"name": "pr:fix",
"color": "8E3E6B",
"default": false,
"description": ""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@
{
"id": 2141594729,
"node_id": "MDU6TGFiZWwyMTQxNTk0NzI5",
"url": "https://api.github.com/repos/RevenueCat/purchases-hybrid-common/labels/next_release",
"name": "next_release",
"url": "https://api.github.com/repos/RevenueCat/purchases-hybrid-common/labels/pr:next_release",
"name": "pr:next_release",
"color": "e11d21",
"default": false,
"description": null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"id": 4352868120,
"node_id": "LB_kwDOBnB8hc8AABACA3N_HQ",
"url": "https://api.github.com/repos/RevenueCat/purchases-ios/labels/RevenueCatUI",
"name": "RevenueCatUI",
"name": "pr:RevenueCatUI",
"color": "8E3E6B",
"default": false,
"description": ""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@
{
"id": 3165687060,
"node_id": "MDU6TGFiZWwzMTY1Njg3MDYw",
"url": "https://api.github.com/repos/RevenueCat/purchases-flutter/labels/phc_dependencies",
"name": "phc_dependencies",
"url": "https://api.github.com/repos/RevenueCat/purchases-flutter/labels/pr:phc_dependencies",
"name": "pr:phc_dependencies",
"color": "0366d6",
"default": false,
"description": "Pull requests that update a dependency file"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@
{
"id": 2141594741,
"node_id": "MDU6TGFiZWwyMTQxNTk0NzQx",
"url": "https://api.github.com/repos/RevenueCat/purchases-flutter/labels/next_release",
"name": "next_release",
"url": "https://api.github.com/repos/RevenueCat/purchases-flutter/labels/pr:next_release",
"name": "pr:next_release",
"color": "e11d21",
"default": false,
"description": null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"id": 4396681492,
"node_id": "LA_kwDOBnB8hc8AAAABBhAJFA",
"url": "https://api.github.com/repos/RevenueCat/purchases-ios/labels/refactor",
"name": "refactor",
"name": "pr:refactor",
"color": "e99695",
"default": false,
"description": "A code change that neither fixes a bug nor adds a feature"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@
{
"id": 2141594741,
"node_id": "MDU6TGFiZWwyMTQxNTk0NzQx",
"url": "https://api.github.com/repos/RevenueCat/purchases-flutter/labels/next_release",
"name": "next_release",
"url": "https://api.github.com/repos/RevenueCat/purchases-flutter/labels/pr:next_release",
"name": "pr:next_release",
"color": "e11d21",
"default": false,
"description": null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"id": 4352868120,
"node_id": "LB_kwDOBnB8hc8AABACA3N_HQ",
"url": "https://api.github.com/repos/RevenueCat/purchases-ios/labels/fix",
"name": "fix",
"name": "pr:fix",
"color": "8E3E6B",
"default": false,
"description": ""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"id": 4396672443,
"node_id": "LA_kwDOBnB8hc8AAAABBg_luw",
"url": "https://api.github.com/repos/RevenueCat/purchases-ios/labels/ci",
"name": "ci",
"name": "pr:ci",
"color": "506B91",
"default": false,
"description": "Changes to our CI configuration files and scripts"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@
{
"id": 2141594741,
"node_id": "MDU6TGFiZWwyMTQxNTk0NzQx",
"url": "https://api.github.com/repos/RevenueCat/purchases-flutter/labels/next_release",
"name": "next_release",
"url": "https://api.github.com/repos/RevenueCat/purchases-flutter/labels/pr:next_release",
"name": "pr:next_release",
"color": "e11d21",
"default": false,
"description": null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"id": 4352868120,
"node_id": "LB_kwDOBnB8hc8AABACA3N_HQ",
"url": "https://api.github.com/repos/RevenueCat/purchases-ios/labels/perf",
"name": "perf",
"name": "pr:perf",
"color": "8E3E6B",
"default": false,
"description": ""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"id": 4352868120,
"node_id": "LB_kwDOBnB8hc8AABACA3N_HQ",
"url": "https://api.github.com/repos/RevenueCat/purchases-ios/labels/fix",
"name": "fix",
"name": "pr:fix",
"color": "8E3E6B",
"default": false,
"description": ""
Expand All @@ -47,7 +47,7 @@
"id": 4352868124,
"node_id": "LA_kwDOBnB8hc8AAAACA3N_HQ",
"url": "https://api.github.com/repos/RevenueCat/purchases-ios/labels/feat",
"name": "feat",
"name": "pr:feat",
"color": "8B3E6B",
"default": false,
"description": ""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@
{
"id": 4352868120,
"node_id": "LB_xwDOBnB8hc8AABACA3N_HQ",
"url": "https://api.github.com/repos/RevenueCat/purchases-ios/labels/next_release",
"name": "next_release",
"url": "https://api.github.com/repos/RevenueCat/purchases-ios/labels/pr:next_release",
"name": "pr:next_release",
"color": "8E3A6B",
"default": false,
"description": ""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@
{
"id": 4352868120,
"node_id": "LB_kwDOBnB8hc8AABACA3N_HQ",
"url": "https://api.github.com/repos/RevenueCat/purchases-ios/labels/phc_dependencies",
"name": "phc_dependencies",
"url": "https://api.github.com/repos/RevenueCat/purchases-ios/labels/pr:phc_dependencies",
"name": "pr:phc_dependencies",
"color": "8E3E6B",
"default": false,
"description": ""
Expand All @@ -47,7 +47,7 @@
"id": 4352868120,
"node_id": "LA_kwDOBnB8hc8AAAACA3N_HD",
"url": "https://api.github.com/repos/RevenueCat/purchases-ios/labels/minor",
"name": "minor",
"name": "pr:minor",
"color": "8B3E6C",
"default": false,
"description": ""
Expand Down

0 comments on commit 5140dbc

Please sign in to comment.