Skip to content

Add guarded release workflow - #288

Merged
williammartin merged 4 commits into
trunkfrom
williammartin-add-release-script
Sep 2, 2026
Merged

Add guarded release workflow#288
williammartin merged 4 commits into
trunkfrom
williammartin-add-release-script

Conversation

@williammartin

Copy link
Copy Markdown
Member

Summary

  • Add a maintainer-facing script/release command that validates a requested version and dispatches the release workflow from trunk.
  • Add reusable release validation covering version format, duplicate tags/releases, release ordering, commit ancestry, and required checks.
  • Publish releases from an exact, revalidated trunk commit after approval through the release environment.
  • Restrict release publication to workflow-dispatch runs with a write-scoped job token.

Repository setup

Configure required reviewers for the release environment before using this workflow.

Validation

  • script/validate-release v2.14.0
  • ShellCheck
  • zizmor

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 40801f35-ff1f-4057-99ad-4a7b0c9f7ddf
needs: validate
runs-on: ubuntu-latest
timeout-minutes: 5
environment: release

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This requires approval from an environment release but note that it doesn't block any user with write from just creating a tag. What we need to do is create a rule set that prevents tag creation, then register a specific github app that can bypass it and mint credentials for that app on release.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

The workflow/scripts as written have concrete permission/error-handling and user-output issues that can cause failed runs or misleading behavior during release dispatch/validation.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review tier: Lite
Findings: 1 High severity · 1 Medium severity · 1 Low severity

New issues introduced by this change (3)
Severity Finding
High severity .github/​workflows/​release.ymlscript/validate-release calls the branch-protection required-status-checks endpoint, which…
Medium severity script/​validate-release — The required-checks lookup will currently exit abruptly (because of set -e) if the…
Low severity script/​release — The output of gh workflow run is not a run URL, so storing it in run_url and printing "Release…
What changed in this PR

This PR introduces a guarded, maintainer-driven release process for cli/go-gh, adding local scripts to validate and dispatch releases and a GitHub Actions workflow to revalidate and publish releases after environment approval.

Changes:

  • Add script/validate-release to validate a candidate version against origin/trunk, tag/release existence, release ordering, commit ancestry, and required checks.
  • Add script/release to run validation and dispatch the Release workflow from trunk.
  • Add script/publish-release plus .github/workflows/release.yml to revalidate and publish the release after release environment approval with scoped permissions.
File Description
script/​validate-release Adds reusable release validation logic against origin/trunk, tags/releases, ancestry, and required checks.
script/​release Adds maintainer-facing command to validate and dispatch the release workflow.
script/​publish-release Adds workflow-only command to revalidate and create the GitHub release/tag.
.github/​workflows/​release.yml Adds a two-job, environment-gated release workflow (validate → publish).
Suppressed comments (1)

.github/workflows/release.yml:46

  • The release job overrides workflow-level permissions, so it also needs administration: read for the second validation pass to read branch protection required checks.
    permissions:
      checks: read # Reverify required checks after environment approval.
      contents: write # Create the release and its tag.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread .github/workflows/release.yml
Comment thread script/validate-release Outdated
Comment thread script/release Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

The publishing guardrails are not fully enforced as written (workflow identity and write-scoped token verification need tightening) and the validate-release help text is currently misleading.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review tier: Lite
Findings: 2 Medium severity · 1 Low severity

New issues introduced by this change (3)
Severity Finding
Medium severity script/​publish-release — This guard only checks that the run is a workflow_dispatch event, but the usage/error text says it…
Medium severity script/​publish-release — Using GET repos/{owner}/{repo} and checking .permissions.push is not a reliable way to verify…
Low severity script/​validate-release — The usage text implies TARGET_SHA is used as the validation target, but the script always validates…
Issues resolved since last review (3)
Severity Finding
Low severity script/​release — The output of gh workflow run is not a run URL, so storing it in run_url and printing "Release… View resolved comment
Medium severity script/​validate-release — The required-checks lookup will currently exit abruptly (because of set -e) if the… View resolved comment
High severity .github/​workflows/​release.ymlscript/validate-release calls the branch-protection required-status-checks endpoint, which… View resolved comment

Comment thread script/publish-release
Comment thread script/publish-release Outdated
Comment thread script/validate-release

@babakks babakks left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, with a just a quick suggestion.

Comment thread script/validate-release Outdated
Comment thread script/publish-release
williammartin and others added 2 commits September 2, 2026 13:46
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 0268640a-dbfd-4065-9112-eff95ca18d66
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 0268640a-dbfd-4065-9112-eff95ca18d66

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🔵 Needs a closer look

It introduces a new release/publishing workflow and validation logic where small robustness issues can block or mis-route releases, so it warrants final human review before approval.

Review tier: Lite
Findings: 2 Medium severity

New issues introduced by this change (2)
Severity Finding
Medium severity script/​release — This script only dispatches the release workflow, but it blocks users without .permissions.push
Medium severity script/​validate-release — The release existence check relies on matching the human-readable error text "release not found"…
Issues resolved since last review (3)
Severity Finding
Low severity script/​validate-release — The usage text implies TARGET_SHA is used as the validation target, but the script always validates… View resolved comment
Medium severity script/​publish-release — Using GET repos/{owner}/{repo} and checking .permissions.push is not a reliable way to verify… View resolved comment
Medium severity script/​publish-release — This guard only checks that the run is a workflow_dispatch event, but the usage/error text says it… View resolved comment

Comment thread script/release Outdated
Comment thread script/validate-release
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 0268640a-dbfd-4065-9112-eff95ca18d66
@williammartin
williammartin marked this pull request as ready for review September 2, 2026 12:02
@williammartin
williammartin requested a review from a team as a code owner September 2, 2026 12:02
@williammartin
williammartin requested review from tidy-dev and removed request for a team September 2, 2026 12:02
@williammartin
williammartin enabled auto-merge (squash) September 2, 2026 12:02
@williammartin
williammartin merged commit 96a581e into trunk Sep 2, 2026
11 checks passed
@williammartin
williammartin deleted the williammartin-add-release-script branch September 2, 2026 12:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants