fix: handle branch name retrieval in GitHub Actions context#295
Open
rmenner wants to merge 1 commit into
Open
Conversation
Reviewer's guide (collapsed on small PRs)Reviewer's GuideUpdates Git branch detection in gitUtils.ts to correctly resolve the PR branch name in GitHub Actions, preferring GITHUB_HEAD_REF in CI over the detached HEAD branchLocal() result. Flow diagram for updated Git branch detection in Git classflowchart TD
A[Start determine branch] --> B{sourceBranch provided?}
B -- Yes --> C[Use sourceBranch]
B -- No --> D{GITHUB_ACTIONS and GITHUB_HEAD_REF set?}
D -- Yes --> E[branch = GITHUB_HEAD_REF]
D -- No --> F[call branchLocal]
F --> G[branch = branchLocal.current]
C --> H[Proceed with branch]
E --> H
G --> H
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
|
🚀 PR Release Published! |
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- Consider scoping the GitHub Actions override to PR events explicitly (e.g., checking
GITHUB_EVENT_NAME === 'pull_request'or similar) so thatGITHUB_HEAD_REFis not used unexpectedly in other workflow contexts. - You might want to extract the branch resolution logic into a small helper method (e.g.,
getCurrentBranchName()), which would make the behavior easier to reason about and reuse, and simplify future CI-specific adjustments.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Consider scoping the GitHub Actions override to PR events explicitly (e.g., checking `GITHUB_EVENT_NAME === 'pull_request'` or similar) so that `GITHUB_HEAD_REF` is not used unexpectedly in other workflow contexts.
- You might want to extract the branch resolution logic into a small helper method (e.g., `getCurrentBranchName()`), which would make the behavior easier to reason about and reuse, and simplify future CI-specific adjustments.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Alaska Airlines Pull Request
This pull request updates the logic for determining the current Git branch in
gitUtils.ts, specifically to improve compatibility with GitHub Actions. The change ensures that, when running in a GitHub Actions pull request context, the correct branch name is used instead of the detached HEAD reference.Branch detection improvements for CI:
Gitclass to use theGITHUB_HEAD_REFenvironment variable when running in GitHub Actions, ensuring the correct PR branch name is used instead of the detached HEAD state, which avoids issues with invalid remote-tracking refs.Checklist:
By submitting this Pull Request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
Pull Requests will be evaluated by their quality of update and whether it is consistent with the goals and values of this project. Any submission is to be considered a conversation between the submitter and the maintainers of this project and may require changes to your submission.
Thank you for your submission!
-- Auro Design System Team
Summary by Sourcery
Enhancements: