Add pre-release prerequisite checks to perform-release.sh#11024
Add pre-release prerequisite checks to perform-release.sh#11024
Conversation
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
PerfectSlayer
left a comment
There was a problem hiding this comment.
That's a lot of change for a script that was supposed to set and push a tag 😓
I would stick with the step that can make the tag and follow up actions failed, ie
- verify the user is part of the releaser (otherwise it creates a local tag)
- verify the milestone for the release exists (otherwise the changelog generation will fail).
Some other parts are wrong or duplicate of the existing GH workflows.
tooling/perform-release.sh
Outdated
| if git rev-parse "refs/tags/$NEXT_RELEASE_VERSION" &>/dev/null; then | ||
| echo "❌ Tag '$NEXT_RELEASE_VERSION' already exists locally. Has this release already been tagged?" | ||
| exit 1 | ||
| fi |
There was a problem hiding this comment.
❔ question: How is that even possible according how the next version tag is computed?
tooling/perform-release.sh
Outdated
| if git ls-remote --tags "$REMOTE" "refs/tags/$NEXT_RELEASE_VERSION" | grep -q .; then | ||
| echo "❌ Tag '$NEXT_RELEASE_VERSION' already exists on remote '$REMOTE'. Has this release already been tagged?" | ||
| exit 1 | ||
| fi |
There was a problem hiding this comment.
❔ question: Same question. Tags are fetch just above
tooling/perform-release.sh
Outdated
| # Check that the milestone has no open issues or PRs | ||
| if ! OPEN_ISSUES=$(gh api "repos/{owner}/{repo}/milestones/$MILESTONE_NUMBER" \ | ||
| --jq ".open_issues"); then | ||
| echo "❌ Failed to query milestone '$MILESTONE_TITLE'. Check your network connection." | ||
| exit 1 | ||
| fi | ||
| if [ -z "$OPEN_ISSUES" ] || ! [[ "$OPEN_ISSUES" =~ ^[0-9]+$ ]]; then | ||
| echo "❌ Unexpected response when querying open issue count for milestone '$MILESTONE_TITLE': '$OPEN_ISSUES'." | ||
| exit 1 | ||
| fi | ||
| if [ "$OPEN_ISSUES" -gt 0 ]; then | ||
| echo "❌ Milestone '$MILESTONE_TITLE' still has $OPEN_ISSUES open issue(s) or PR(s):" | ||
| gh api "repos/{owner}/{repo}/issues?milestone=$MILESTONE_NUMBER&state=open&per_page=100" \ | ||
| --jq '.[] | " #\(.number) \(.title)"' || true | ||
| echo " All PRs must be merged before tagging a release." | ||
| exit 1 | ||
| fi | ||
| echo "✅ All issues and PRs in milestone '$MILESTONE_TITLE' are closed." |
There was a problem hiding this comment.
🔨 issue: This is wrong. This is expected to have open issue on milestone.
| # Check that all closed PRs in the milestone carry the required labels. | ||
| # Required: (comp:* or inst:*) AND (type:*), OR 'tag: no release notes'. |
There was a problem hiding this comment.
❔ question: What's the point? It's a duplicate of the PR checks workflow.
tooling/perform-release.sh
Outdated
| echo " Only release owners are allowed to push release tags." | ||
| exit 1 | ||
| fi | ||
| echo "✅ GitHub CLI authenticated with push permission." |
There was a problem hiding this comment.
🎯 suggestion: This should check the fact that you're part of the release owner teams.
Otherwise, the release must be done by a release owner.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
What Does This Do
Adds automated pre-release prerequisite checks to
tooling/perform-release.shthat validate the environment and repository state before creating a release tag:comp:/inst:+type:, ortag: no release note)Motivation
Previously the release script had minimal pre-flight checks, allowing a release to fail partway through (e.g. missing permissions, duplicate tag, unsigned tag). These checks catch problems early, before the irreversible tag-and-push step.
Additional Notes
The
confirmOrAbortfunction was refactored to accept a custom prompt parameter, enabling context-specific confirmation messages throughout the script.Contributor Checklist
type:and (comp:orinst:) labels in addition to any other useful labelsclose,fix, or any linking keywords when referencing an issueUse
solvesinstead, and assign the PR milestone to the issueJira ticket: [PROJ-IDENT]
Note: Once your PR is ready to merge, add it to the merge queue by commenting
/merge./merge -ccancels the queue request./merge -f --reason "reason"skips all merge queue checks; please use this judiciously, as some checks do not run at the PR-level. For more information, see this doc.