Skip to content

Add PR Auto-Fix workflow: any failing PR → Claude fixes it (Layer 2)#60

Merged
fschrhunt merged 3 commits into
mainfrom
renovate-conflict-resolver
May 31, 2026
Merged

Add PR Auto-Fix workflow: any failing PR → Claude fixes it (Layer 2)#60
fschrhunt merged 3 commits into
mainfrom
renovate-conflict-resolver

Conversation

@fschrhunt

@fschrhunt fschrhunt commented May 31, 2026

Copy link
Copy Markdown
Member

What

A reusable pr-autofix.yml that, when a PR is failing — CI red and/or merge-conflicted — runs Claude Code to get it back to a healthy, mergeable, green state, then pushes to the PR's own branch. Generalizes the original Renovate-only conflict resolver per the broader goal: any failing (trusted) PR gets auto-fixed.

Triggers (set by each repo's caller)

  • workflow_run on the repo's CI workflow completing with failure → fix that PR's checks.
  • schedule → sweep for CONFLICTING PRs (conflicts have no CI event).
  • workflow_dispatch → manual.

Security model (this auto-invokes an agent with a write token)

  • Hard trust gate: only non-fork PRs (isCrossRepository == false) whose author is allowlisted (renovate[bot], dependabot[bot], fschrhunt — extendable via allowed_authors input). Forks / unknown authors are ignored. CI-failure path also verifies the run's head repo == this repo.
  • Push pinned to the PR's exact head ref (validated against ^[A-Za-z0-9._/-]+$ first) — the agent literally cannot push to main.
  • Never merges (except the auto-merge step below). Prompt treats PR/dependency/log content as injection-hostile.
  • Only the integer PR number and the pre-validated head ref are interpolated into YAML; every run: reads via env:.

Auto-merge (resolves the Option-3 decision / DEV-44)

A Renovate/Dependabot PR that this run makes mergeable and that's stability_days (default 3) old gets GitHub auto-merge enabled — but only if the base branch has a required status check. With none (website today), the step safely skips and logs why, because GitHub auto-merge would otherwise merge with no CI gate. Human PRs never auto-merge.

Validation

ruby -ryaml parse + bash -n on all three embedded scripts pass locally. actionlint runs in this repo's CI on the PR.

Rollout

Pilot caller in getnodus/website (separate PR). Merge this first — callers reference @main. To enable safe auto-merge on website, add a required status check on main (its CI is currently advisory/none).

🤖 Generated with Claude Code

fschrhunt and others added 2 commits May 31, 2026 09:36
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Broadens the Renovate conflict resolver into a general 'failing PR -> Claude
fixes it' workflow. Triggers on CI failure (workflow_run) and a scheduled
conflict sweep. Hard trust gate (non-fork, allowlisted authors). Pushes only to
the PR's own branch; folds in the auto-merge decision (stable dependency-bot
PRs, gated on required checks).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@fschrhunt fschrhunt changed the title Add Renovate conflict-resolver workflow (Layer 2) Add PR Auto-Fix workflow: any failing PR → Claude fixes it (Layer 2) May 31, 2026
…lure)

The docker:// step produced startup_failure on every run since 2026-05-29,
leaving the repo with no working workflow-lint gate. Switch to the documented
download-actionlint.bash method, which also unblocks using this check as the
required gate for PR auto-merge.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@fschrhunt fschrhunt merged commit e61d313 into main May 31, 2026
1 check passed
@fschrhunt fschrhunt deleted the renovate-conflict-resolver branch May 31, 2026 19:07
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