-
Couldn't load subscription status.
- Fork 2
fix(gha-trunk-upgrade): wait for checks and merge with admin #42
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
Conversation
WalkthroughThis change updates the Possibly related PRs
Suggested reviewers
✨ Finishing Touches🧪 Generate Unit Tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
Documentation and Community
|
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.
Actionable comments posted: 0
🧹 Nitpick comments (2)
.github/workflows/trunk-upgrade.yaml (2)
37-42: Set both GH_TOKEN and GITHUB_TOKEN for consistent auth.Currently only
GH_TOKENis exported, but some tools or GitHub Actions expectGITHUB_TOKEN. Export both to avoid authentication issues:env: - GH_TOKEN: ${{ steps.generate-token.outputs.token }} + GH_TOKEN: ${{ steps.generate-token.outputs.token }} + GITHUB_TOKEN: ${{ steps.generate-token.outputs.token }} PR_NUMBER: ${{ steps.trunk-upgrade.outputs.pull-request-number }}
43-62: Enhance script robustness with fail-fast and retry limits.Introduce strict error handling and a maximum retry counter to avoid infinite loops or silent failures. Also verify
jqis available:run: | + set -euo pipefail + attempt=0; max_attempts=20 echo "Waiting for required status checks to pass on PR #$PR_NUMBER..." while true; do + ((attempt++)) + if [ "$attempt" -gt "$max_attempts" ]; then + echo "Exceeded max retry attempts ($max_attempts). Exiting..." + exit 1 + fi CHECKS_JSON=$(gh pr checks "$PR_NUMBER" --required --json state,bucket) echo "Current checks status: $CHECKS_JSON"
| gh pr merge "$PR_NUMBER" --squash --auto --delete-branch | ||
| echo "Waiting for required status checks to pass on PR #$PR_NUMBER..." | ||
| while true; do | ||
| CHECKS_JSON=$(gh pr checks "$PR_NUMBER" --required --json state,bucket) |
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.
What's this state,bucket
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.
@oycyc these are fields used when checking the status of pull request checks using the GitHub CLI - gh pr checks.
state- the current status of a check. Possible values:
SUCCESS - The check passed successfully
FAILURE - The check failed
PENDING - The check is still running
ERROR - The check encountered an errorbucket- a higher-level categorization of the check's status (yeah, the naming is a bit confusing).Possible values:
pass - The check has passed
fail - The check has failed
pending - The check is still running or waiting to start
More about how it "makes a decision": the workflow uses both fields to ensure that all checks have not only passed (state="SUCCESS") but are also properly categorized in the bucket before proceeding with the merge.
With this, we ensure that the PR is truly ready to be merged, as it verifies both the immediate state of the checks and their proper categorization in the GH system.
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.
Ah got it!
🤖 I have created a release *beep* *boop* --- ## [0.8.0](v0.7.1...v0.8.0) (2025-06-17) ### Features * **INT-83:** dial in configs for tflint ([#39](#39)) ([60c58f4](60c58f4)) ### Bug Fixes * **gha-trunk-upgrade:** wait for checks and merge with admin ([#42](#42)) ([0c399bc](0c399bc)) * **gha:** use app–generated token to create release-please PRs ([#45](#45)) ([a0c0d46](a0c0d46)) * linter configs to root folder ([#44](#44)) ([7aacf9f](7aacf9f)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: masterpointbot[bot] <177651640+masterpointbot[bot]@users.noreply.github.com>
what
why
references
Summary by CodeRabbit