Skip to content

chore(ci): stop pushing release version bump to protected default branch#274

Merged
mogita merged 1 commit into
mainfrom
chore/release-no-main-commit
Jul 15, 2026
Merged

chore(ci): stop pushing release version bump to protected default branch#274
mogita merged 1 commit into
mainfrom
chore/release-no-main-commit

Conversation

@mogita

@mogita mogita commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Summary

The release job's version-bump step pushed the bump commit directly to the protected default branch and was rejected:

remote: error: GH006: Protected branch update failed for refs/heads/main.
- Changes must be made through a pull request.

Versioning is already tag-driven — bump_version.py derives the previous version from the latest semver tag (find_latest_semver_tag), not from pyproject.toml — so the bump does not need to live on the default branch.

Changes

  • Commit version bump (local, for tagging only): commit the bump locally so the release tag points at a tree with the correct version, but do not push it to the default branch.
  • Create release tag: annotate the tag with the trigger (PR number on merges).
  • Skip when PR is already released: track idempotency on the annotated release tag instead of a default-branch commit (so re-runs don't double-bump).

Test plan

  • Workflow YAML validated.
  • Actions workflows can't run locally; verify on the next release or a manual workflow_dispatch.

Summary by CodeRabbit

  • Release Improvements
    • Improved release detection to prevent duplicate releases for the same pull request.
    • Version updates used for releases no longer modify the protected default branch.
    • Release tags now include clearer context indicating whether they were created manually or for a pull request.

The release workflow pushed the version-bump commit directly to the default
branch, which is protected and rejects direct pushes (GH006). Commit the bump
locally only and tag it; do not push to the default branch. Track release
idempotency on the annotated release tag instead of a default-branch commit.
@coderabbitai

coderabbitai Bot commented Jul 15, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: d31f2cb8-daac-4b2f-ba63-1dc25c3566e4

📥 Commits

Reviewing files that changed from the base of the PR and between c98b0e9 and 5e281c4.

📒 Files selected for processing (1)
  • .github/workflows/release.yml

📝 Walkthrough

Walkthrough

The release workflow now detects prior releases by searching annotated tag contents for PR markers. Version bump commits remain local for tagging, are not pushed to the protected default branch, and tags receive manual or PR-specific annotations.

Changes

Release workflow

Layer / File(s) Summary
Tag-based release detection
.github/workflows/release.yml
Existing release tags are searched for the PR number instead of release commit messages in git history.
Local version bump and tag annotation
.github/workflows/release.yml
Version bump commits are created locally without pushing to the default branch, and tags use manual or PR-number-based messages.

Estimated code review effort: 3 (Moderate) | ~15–30 minutes

Sequence Diagram(s)

sequenceDiagram
  participant GitHubEvent
  participant ReleaseWorkflow
  participant GitRepository
  participant ReleaseTag
  GitHubEvent->>ReleaseWorkflow: provide trigger type and PR number
  ReleaseWorkflow->>GitRepository: search annotated tag contents
  GitRepository-->>ReleaseWorkflow: return release marker result
  ReleaseWorkflow->>GitRepository: commit version bump locally
  ReleaseWorkflow->>ReleaseTag: create annotated tag
  ReleaseTag-->>ReleaseWorkflow: store manual or PR-specific message
Loading
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately captures the main change: the release workflow no longer pushes the version-bump commit to the protected default branch.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch chore/release-no-main-commit

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@mogita mogita merged commit 9878a8e into main Jul 15, 2026
39 of 40 checks passed
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