Skip to content

fix(release): use a one-shot PR instead of pushing the bump to main directly#10

Merged
JohnnyVicious merged 1 commit intomainfrom
fix/release-via-pr-flow
Apr 12, 2026
Merged

fix(release): use a one-shot PR instead of pushing the bump to main directly#10
JohnnyVicious merged 1 commit intomainfrom
fix/release-via-pr-flow

Conversation

@JohnnyVicious
Copy link
Copy Markdown
Owner

Summary

Release run 24308400583 failed because the previous workflow tried to `git push origin HEAD:main` and was rejected by the branch protection rule:

```
remote: error: GH013: Repository rule violations found for refs/heads/main.
remote: - Changes must be made through a pull request.
```

The bump commit and tag never reached origin (the worker's filesystem is gone), so there is nothing to clean up — `origin/main` is still at `f19fbf0` and no `v1.0.1` tag exists.

Fix

Replace the single "commit, tag, and push" step with a PR-mediated flow that satisfies the branch protection rule:

  1. Push the bump on a release branch — checkout `release/v${version}`, commit the bumped manifests, push the branch.
  2. Open the release PR and merge it — `gh pr create` against main with a descriptive title/body, then `gh pr merge --squash --delete-branch`. The change still reaches main through a PR (which is what the rule wants), while the workflow stays fully automated.
  3. Tag the merged commit on main — fetch + `reset --hard origin/main` to pick up the squash-merge commit, tag it, push the tag.
  4. Create GitHub release — unchanged, still uses `gh release create --generate-notes`.

Permissions

Added `pull-requests: write` so the workflow can open and merge the release PR. `contents: write` is still needed for the tag push.

Test plan

  • YAML well-formed (`python3 -c "import yaml; yaml.safe_load(open(...))"`)
  • CI green on this PR (no real workflow execution — release.yml only fires on `workflow_dispatch`)
  • End-to-end smoke after merge: re-trigger release with `version: 1.0.1` and verify the release branch is created, the PR opens + merges, the tag lands, and the GitHub release is published

Alternative considered

I considered configuring the branch protection ruleset to add `github-actions[bot]` as a bypass actor instead, which would let the original direct-push flow work as-is. I went with the PR-based flow because it doesn't depend on hidden repo configuration the user has to remember, and it leaves a paper trail in the PR list for every release. Happy to switch if you'd rather have the simpler workflow + bypass list.

…irectly

Release run 24308400583 failed because the previous workflow tried to
`git push origin HEAD:main` and was rejected by the branch protection
rule "Changes must be made through a pull request" (GH013):

  remote: error: GH013: Repository rule violations found for refs/heads/main.
  remote: - Changes must be made through a pull request.

The bump commit and tag never reached origin (the worker's filesystem
is gone), so there's nothing to clean up.

This change replaces the direct-push step with a PR-mediated flow that
satisfies the branch protection rule:

1. `Push the bump on a release branch` — checkout `release/v${version}`,
   commit the bumped manifests, push the branch.
2. `Open the release PR and merge it` — `gh pr create` against main with
   a descriptive title/body, then `gh pr merge --squash --delete-branch`.
   The change reaches main *through* a PR, which is what the rule wants,
   while the workflow remains fully automated.
3. `Tag the merged commit on main` — fetch + reset --hard origin/main to
   pick up the squash-merge commit, tag it, push the tag.
4. `Create GitHub release` — unchanged, still uses
   `gh release create --generate-notes`.

Permissions: added `pull-requests: write` so the workflow can open and
merge the release PR. `contents: write` is still needed for the tag push.

Header comment updated to document the new flow.
@JohnnyVicious JohnnyVicious merged commit f9de391 into main Apr 12, 2026
1 check passed
@JohnnyVicious JohnnyVicious deleted the fix/release-via-pr-flow branch April 12, 2026 14:06
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.

1 participant