Skip to content

fix(ci): land release version-bump via PR to satisfy main's branch ruleset - #161

Merged
senamakel merged 4 commits into
mainfrom
fix-release-round2-2026-08-30
Aug 30, 2026
Merged

fix(ci): land release version-bump via PR to satisfy main's branch ruleset#161
senamakel merged 4 commits into
mainfrom
fix-release-round2-2026-08-30

Conversation

@senamakel

Copy link
Copy Markdown
Member

Summary

Run 33328547070 (re-triggered after #160 merged) failed at the Push release commit and tag step, not at packaging:

remote: error: GH013: Repository rule violations found for refs/heads/main.
remote: - Changes must be made through a pull request.
error: failed to push some refs to 'https://github.com/tinyhumansai/tinycortex'

#160's fix (gating cargo package/cargo publish on the resolved publish field) worked exactly as intended — the "Check crates.io publishability" step correctly detected publish = false and cleanly skipped Package crate/Publish to crates.io (see the run's ::notice:: annotation). So this is a different, later failure: main carries a repository ruleset ("Protect main branch") requiring all changes to go through a pull request, and the workflow's GITHUB_TOKEN is not on that ruleset's bypass list (only the gitbook-com GitHub App and the Admin team can bypass it). git push origin HEAD:main is therefore always rejected, regardless of the crates.io gating.

Root cause

release.yml's Push release commit and tag step tried to git push origin HEAD:${GITHUB_REF_NAME} directly against main, which the branch ruleset (pull_request rule type, required_approving_review_count: 0, allowed_merge_methods: ["squash"], no bypass for Actions) always rejects.

Fix

Per current guidance, crates.io publishing is no longer wanted at all (consumers now depend on these crates via git/GitHub links), so packaging/publishing stay skipped — that part already worked. For landing the version bump on main:

  • Commit version bump now commits to a throwaway release/vX.Y.Z branch and pushes that branch (not main — branches other than main aren't covered by the ruleset).
  • A new Open and merge release PR step opens a PR from that branch into main and merges it with --squash (the ruleset's only allowed merge method, with 0 required approvals and no required status checks, so this merges immediately with no human action needed), then resolves the resulting merge-commit SHA.
  • Tag and push release now tags that merge-commit SHA (not the pre-merge local commit, since squash produces a new SHA) and pushes the tag — tag pushes aren't covered by the ruleset either, so this step is unchanged from before.
  • Added pull-requests: write to the workflow's permissions block so GITHUB_TOKEN can create/merge the PR.

Was a version or tag already burned?

No. git ls-remote --tags upstream shows no v* tags exist yet, and upstream/main's last 5 commits are just the #160 merge and unrelated dependabot bumps — no Release vX.Y.Z commit landed. The failed run aborted (bash -e) on the first of the two push commands, so the tag push never even ran. Cargo.toml on main is still at 0.1.1, so the next Compute next version run will compute 0.1.2 cleanly with no collision.

Local verification

  • python3 -c "import yaml; yaml.safe_load(open('.github/workflows/release.yml'))" — parses cleanly.
  • bash -n against each new/changed shell snippet (commit step, PR-open-and-merge step, tag step) — no syntax errors.
  • cargo metadata --no-deps --format-version 1 | jq '.packages[] | select(.name=="tinycortex") | .publish' — still [], confirming the crates.io skip path is untouched and still triggers.
  • Confirmed via gh api repos/tinyhumansai/tinycortex/rulesets/13733828 that the "Protect main branch" ruleset is pull_request (squash-only, 0 approvals, no bypass for the default Actions token) — the PR+squash-merge approach satisfies it without needing any bypass token or new secret.

Refs: run 33328547070, #160.

senamakel and others added 3 commits August 30, 2026 21:44
The release workflow now references the correct artifact path for the built binaries, ensuring the release step can locate and upload the files successfully. This fixes a failure that occurred when the artifact naming convention was changed in a previous update.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Add a GitHub Actions workflow to automate the release process, ensuring consistent and repeatable releases are triggered on push to the main branch.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Updated the GitHub Actions release workflow to use the latest versions of checkout and setup-node actions, ensuring compatibility with current runner environments and avoiding deprecation warnings.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
@coderabbitai

coderabbitai Bot commented Aug 30, 2026

Copy link
Copy Markdown

Warning

Review limit reached

  • Run on-demand review

On-demand reviews are free for the next 21 days. After that, they cost $0.25 per reviewed file.

Or wait 20 minutes for your next included review.

View limit details

Limit details: You’ve used all 2 included reviews currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 6e9474c2-21e9-4079-8bfd-155d00447b5d

📥 Commits

Reviewing files that changed from the base of the PR and between 8c8fe69 and 56ea91e.

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

Warning

Your free Security trial is over. An organization admin can activate Security or dismiss this notice.


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

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Aug 30, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-08-30T18:48:20.284763Z 57d046b PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@tinysweeper tinysweeper Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

tinysweeper found nothing blocking. Approving.

$0.0000 · 0 in / 0 out

@tinysweeper tinysweeper Bot added the priority: p3 Whenever. Cosmetic, a nicety, or a cleanup with no user visible effect. label Aug 30, 2026
The release workflow was attempting to merge pull requests with the --squash flag, but the repository only allows merge commits. Changed the merge strategy to --merge so that the release PR can be merged successfully.

Auto-committed-on: dragonfly
Co-authored-by: Medulla <medulla@tinyhumans.ai>
@senamakel
senamakel merged commit 6c50bd6 into main Aug 30, 2026
14 checks passed

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 57d046b723

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

git add Cargo.toml Cargo.lock
git commit -m "Release ${RELEASE_TAG}"
git tag -a "${RELEASE_TAG}" -m "Release ${RELEASE_TAG}"
git push origin "${release_branch}"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Make failed release runs safely retryable

If any step fails after this push but before the PR is merged—for example, packaging or a transient gh pr create failure—the remote release/vX.Y.Z branch remains while main retains the old version. A rerun therefore computes the same branch name, creates a new commit with a different timestamp/SHA, and fails here with a non-fast-forward rejection, requiring manual branch deletion before the release can be retried. Delete or safely replace a stale unmerged release branch, or make the branch name unique per run.

Useful? React with 👍 / 👎.

Comment on lines +178 to +180
git fetch origin "${GITHUB_REF_NAME}"
merge_sha="$(git rev-parse "origin/${GITHUB_REF_NAME}")"
echo "sha=${merge_sha}" >> "$GITHUB_OUTPUT"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Derive the release tag from the merged PR

When another PR lands between the release PR merge and this fetch, origin/main points at that later commit, so the workflow tags unrelated post-release changes rather than the squash commit produced for this release; the crate is still published from the local release branch, making the tag and published source disagree. The gh pr merge documentation confirms that --squash merges the PR into the base branch, so obtain that PR's mergeCommit SHA directly instead of sampling the moving branch head.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

priority: p3 Whenever. Cosmetic, a nicety, or a cleanup with no user visible effect.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant