Skip to content

ci: move dist/ auto-commit to PR branch instead of main#21

Merged
ranarn merged 4 commits into
mainfrom
fix/dist-auto-commit-branch-protection
May 27, 2026
Merged

ci: move dist/ auto-commit to PR branch instead of main#21
ranarn merged 4 commits into
mainfrom
fix/dist-auto-commit-branch-protection

Conversation

@ranarn
Copy link
Copy Markdown
Owner

@ranarn ranarn commented May 27, 2026

Summary

  • Removes the git push step from main.yml that was pushing dist/ directly to main — this violated branch protection rules (PR required + Test status check required), causing CI to fail after every Dependabot merge
  • Adds an equivalent step to pull-request.yml that commits and pushes dist/ to the PR branch instead
  • Adds permissions: contents: write to the PR workflow job so it can push to the PR branch

How it works after this change

  1. A PR (including Dependabot) runs the PR workflow
  2. If pnpm build changes dist/, the workflow auto-commits it to the PR branch
  3. When the PR is squash-merged, the updated dist/ is included in the squash commit
  4. main.yml runs after merge, builds dist/ again, finds no changes — nothing to push

Test plan

  • Merge this PR and verify main.yml completes without the GH013 push error
  • Open a test PR and verify pull-request.yml auto-commits dist/ to the PR branch if it changed

Generated with Claude Code

ranarn and others added 4 commits May 27, 2026 09:49
The post-merge auto-commit in main.yml violated branch protection rules
(PR required + Test status check required), causing CI to fail after
Dependabot merges.

dist/ is now built and committed to the PR branch during the pull-request
workflow. Squash-merging includes the updated dist/, so main.yml no longer
needs to push dist/ directly to main.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
actions/checkout defaults to a detached HEAD at the merge commit on pull_request
events, making it impossible to push back to the PR branch without --force.
Using ref: github.head_ref checks out the actual PR branch so the push succeeds
with a normal fast-forward.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@ranarn ranarn merged commit 1e31c4e into main May 27, 2026
3 checks passed
@ranarn ranarn deleted the fix/dist-auto-commit-branch-protection branch May 27, 2026 07:59
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