fix(ci): js-autofix pushes via PR instead of direct push to main - #65186
Merged
Conversation
Contributor
✅ CI-sensitive file review passedThe |
ethernet8023
force-pushed
the
ethie/autofix-fix
branch
3 times, most recently
from
July 15, 2026 20:23
bbae57f to
33a369c
Compare
prettier and eslint should never touch package-lock.json. main has a repo rule requiring team approval when lockfiles change, so an autofix PR touching it would hang waiting for review. - Add .prettierignore at repo root - Add '**/package-lock.json' to eslint shared config ignores
ethernet8023
force-pushed
the
ethie/autofix-fix
branch
from
July 15, 2026 20:25
33a369c to
ce87ad7
Compare
Main now has repository rules requiring pull requests + required status
checks ("All required checks pass"), so the workflow's direct push to
main is rejected with GH013 every time eslint --fix produces changes.
Switch apply-patch to push to a dedicated bot/js-autofix branch, create
or update a PR, and enable auto-merge (squash). The PR auto-merges once
CI passes. If CI fails or main moves, the PR is auto-closed and the
branch deleted — the next run re-applies on the current state.
The two-job security split is preserved:
- generate-patch stays unprivileged (contents: read only) — it runs npm
on an ephemeral runner with zero push permissions.
- apply-patch (contents: write + pull-requests: write) still never runs
npm, never installs anything, never executes repo code — it applies
the trusted patch artifact and delivers it via PR.
This was referenced Jul 15, 2026
Gravezzz
pushed a commit
to Gravezzz/hermes-agent
that referenced
this pull request
Jul 21, 2026
…sResearch#65186) * fix(js): never format package-lock.json prettier and eslint should never touch package-lock.json. main has a repo rule requiring team approval when lockfiles change, so an autofix PR touching it would hang waiting for review. - Add .prettierignore at repo root - Add '**/package-lock.json' to eslint shared config ignores * fix(ci): js-autofix pushes via PR instead of direct push to main Main now has repository rules requiring pull requests + required status checks ("All required checks pass"), so the workflow's direct push to main is rejected with GH013 every time eslint --fix produces changes. Switch apply-patch to push to a dedicated bot/js-autofix branch, create or update a PR, and enable auto-merge (squash). The PR auto-merges once CI passes. If CI fails or main moves, the PR is auto-closed and the branch deleted — the next run re-applies on the current state. The two-job security split is preserved: - generate-patch stays unprivileged (contents: read only) — it runs npm on an ephemeral runner with zero push permissions. - apply-patch (contents: write + pull-requests: write) still never runs npm, never installs anything, never executes repo code — it applies the trusted patch artifact and delivers it via PR.
randlee
pushed a commit
to randlee/hermes-agent
that referenced
this pull request
Aug 11, 2026
…sResearch#65186) * fix(js): never format package-lock.json prettier and eslint should never touch package-lock.json. main has a repo rule requiring team approval when lockfiles change, so an autofix PR touching it would hang waiting for review. - Add .prettierignore at repo root - Add '**/package-lock.json' to eslint shared config ignores * fix(ci): js-autofix pushes via PR instead of direct push to main Main now has repository rules requiring pull requests + required status checks ("All required checks pass"), so the workflow's direct push to main is rejected with GH013 every time eslint --fix produces changes. Switch apply-patch to push to a dedicated bot/js-autofix branch, create or update a PR, and enable auto-merge (squash). The PR auto-merges once CI passes. If CI fails or main moves, the PR is auto-closed and the branch deleted — the next run re-applies on the current state. The two-job security split is preserved: - generate-patch stays unprivileged (contents: read only) — it runs npm on an ephemeral runner with zero push permissions. - apply-patch (contents: write + pull-requests: write) still never runs npm, never installs anything, never executes repo code — it applies the trusted patch artifact and delivers it via PR.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
The
js-autofixworkflow'sapply-patchjob pushes directly tomainwithgit push --force-with-lease origin HEAD:main. Main now has repository rulesrequiring pull requests + required status checks ("All required checks pass"),
so the push is rejected with GH013 every time eslint --fix produces changes
— the workflow is permanently broken.
This switches
apply-patchto push to a dedicatedbot/js-autofixbranch,create or update a PR, and enable auto-merge (squash). The repo already
has
allow_auto_merge=true+delete_branch_on_merge=true, so the PR mergesautomatically once status checks pass and the branch is cleaned up.
If the PR's CI fails or
mainmoves while the PR is open, the job auto-closesthe PR and deletes the branch — the next workflow run re-applies on the current
state. This keeps the bot branch from accumulating stale PRs.
The two-job security split is preserved:
generate-patchstays unprivileged (contents: readonly) — it runs npm/eslinton an ephemeral runner with zero push permissions.
apply-patch(contents: write+pull-requests: write) still never runs npm,never installs anything, never executes repo code — it applies the trusted patch
artifact and delivers it via PR instead of a direct push.
Also includes a companion fix:
.prettierignorenow excludespackage-lock.jsonso
npm run fixdoesn't reformat the lockfile (which would produce massivenoisy diffs).
Related Issue
Fixes the failing
auto-fix lint issues & formattingrun:https://github.com/NousResearch/hermes-agent/actions/runs/29447393854/job/87461501477
Type of Change
Changes Made
.github/workflows/js-autofix.yml:apply-patchjob now pushes tobot/js-autofixbranch + creates/updates a PR with
gh pr merge --auto --squashinstead ofgit push --force-with-lease origin HEAD:mainpull-requests: writepermission toapply-patch(needed for PR creationif CI fails, conflicts, or
mainmoves.prettierignore: excludepackage-lock.jsonfrom formattingeslint.config.shared.mjs: excludepackage-lock.jsonfrom eslintHow to Test
auto-fix lint issues & formattingworkflow should:generate-patch: produce a non-empty patch artifact (unchanged behavior)apply-patch: push tobot/js-autofix, open a PR, enable auto-mergeThe failing run's error for reference:
Checklist
Code
fix(scope):,feat(scope):, etc.)pytest tests/ -qand all tests pass — N/A: CI workflow change, no Python tests affectedyaml.safe_load)Documentation & Housekeeping
cli-config.yaml.exampleif I added/changed config keys — N/ACONTRIBUTING.mdorAGENTS.mdif I changed architecture or workflows — N/A (workflow internal, no dev-facing change)Screenshots / Logs
Failing run (current main):