Skip to content

ci(sync-upstream): revert workflow changes before push - #13

Closed
dogmar wants to merge 2 commits into
mainfrom
claude/workflow-push-permission-HvH1g
Closed

dogmar wants to merge 2 commits into
mainfrom
claude/workflow-push-permission-HvH1g

Conversation

@dogmar

@dogmar dogmar commented May 21, 2026

Copy link
Copy Markdown
Collaborator

Summary

Fixes the sync workflow push failure:

! [remote rejected]   sync/v0.21.1-20260513 -> sync/v0.21.1-20260513
  (refusing to allow a GitHub App to create or update workflow
   `.github/workflows/autofix.yml` without `workflows` permission)

GITHUB_TOKEN cannot push changes to .github/workflows/* — it lacks the workflow scope, and that scope is not exposed via the workflow permissions: block. The previous auto-resolution rules only handled pr.yml and release.yml as conflict cases. An upstream-only edit to a workflow file the fork hadn't customized (e.g. autofix.yml) merged cleanly, then broke the push.

Changes

  • Generalize workflow conflict handling: any .github/workflows/* conflict keeps the fork's version (or keeps the file deleted, for modify/delete conflicts). Replaces the hard-coded pr.yml and release.yml cases.
  • Post-merge workflow reset: after the merge commits, diff .github/workflows/ against origin/main and restore any changed files (or delete any newly-added ones), then git commit --amend. The pushed merge therefore never contains workflow file changes.

Upstream workflow changes are no longer adopted automatically. They can be brought in via a separate PR using a PAT with workflow scope.

Test plan

  • Manually trigger Sync Upstream workflow on a state where upstream has modified autofix.yml but the fork has not. Confirm the merge commit lands on sync/... branch without touching .github/workflows/autofix.yml.
  • Confirm that an upstream release.yml modify-vs-fork-delete conflict still resolves to "deleted".
  • Confirm that an upstream pr.yml edit conflict still keeps fork version.
  • Confirm a sync with no workflow changes at all is unaffected (no amend, single merge commit).

Generated by Claude Code

claude added 2 commits May 21, 2026 17:00
GITHUB_TOKEN lacks the `workflow` scope, so a sync merge that picks up
upstream edits to any .github/workflows/* file is rejected at push time
("refusing to allow a GitHub App to create or update workflow ... without
`workflows` permission"). The previous auto-resolution rules only covered
pr.yml and release.yml as conflict cases; an upstream-only edit to a file
the fork hadn't customized (e.g. autofix.yml) merged cleanly and then
broke the push.

Generalize the workflow handling: in the conflict path, keep fork's
version (or keep deletion) for any .github/workflows/* file. After the
merge commits, reset .github/workflows/ back to origin/main's state and
amend the merge, so the push never contains workflow file changes.
Upstream workflow changes must now be brought in via a separate PR using
a PAT with `workflow` scope.
If upstream modifies a workflow file the push will fail (GITHUB_TOKEN
lacks the `workflow` scope) and the sync will be finished locally by
hand. Keep the generalized .github/workflows/* conflict resolution so
auto-resolvable conflicts still complete.
@dogmar dogmar closed this May 28, 2026
@dogmar
dogmar deleted the claude/workflow-push-permission-HvH1g branch May 28, 2026 22: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.

2 participants