-
Notifications
You must be signed in to change notification settings - Fork 1
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
Migrate prepare hotfix #21
Conversation
it needs ^{} at the end in order to extract a tagged commit from an annotated tag. Using bare ^ makes it return the parent commit of a tagged commit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good overall! I added a small change to fix the usage of git rev-parse
.
I'd like us to do something with the gh cli tool call for creating a branch - either replace it with Octokit API call, or, if possible, remove the is_ci condition and stick to git calls.
@@ -416,7 +416,7 @@ def self.get_task_ids_from_git_log(from_ref, to_ref = "HEAD") | |||
|
|||
git_log | |||
.gsub("\n", " ") | |||
.scan(%r{\bTask/Issue URL:.*?https://app\.asana\.com[/0-9f]+\b}) | |||
.scan(%r{\bTask/Issue URL:\s*https://app\.asana\.com[/0-9f]+\b}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👨🍳 💋
if Helper.is_ci? | ||
sha = Actions.sh("git", "rev-parse", "#{source_version}^{}").strip | ||
repo = Helper::GitHelper.repo_name(platform) | ||
Actions.sh("gh", "api", "--method", "POST", "/repos/#{repo}/git/refs", "-f", "ref=refs/heads/#{branch_name}", "-f", "sha=#{sha}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd rather not use gh
CLI tool directly in fastlane:
- It requires GitHub token to be set (which needs to be done manually in the GHA step environment)
- some of our actions (including start_new_release), already take GH token as parameter so it would require extra setup to have this work.
We have Octokit to access GitHub API. Can we create a helper function in git_helper to create a branch? Similar to existing merge_branch
and delete_branch
? Maybe called create_branch
.
Alternatively, may be it's worth considering dropping the entire is_ci
thing and just sticking to git fetch & checkout & push?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed is_ci
, it forced me to update this seemed simplest approach, then it's just 3 simple git commands and no API interaction. This required me to check the branch out in macos workflow with the elevated token, which seems fine, see here .
Without this it is unable to push the branch due to workflow changes. See workflow if you're interested.
@@ -131,6 +131,138 @@ def load_file(file) | |||
end | |||
end | |||
|
|||
describe ".create_hotfix_branch" do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reminder about using #
in place of .
:)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, updated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great, thanks @kshann!
Task/Issue URL: https://app.asana.com/0/0/1208793082476405/f
Description:
prepare_hotfix
lane and accompanying logicget_task_ids_from_git_log