Skip to content

HappyOnigiri/Refix

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Repository files navigation

Refix

Japanese version

A GitHub Action that lets Claude review each pull request and then auto-fix the issues it finds, all in a single workflow run.

Refix

Features

  • Claude self-review: runs an Opus session (configurable) against the PR diff and produces a structured XML review with concrete fix suggestions
  • Automatic fix session: a separate Sonnet session (configurable) applies every finding as a commit, following the review verbatim
  • State comment: each run appends a Self-Review Log entry with the head SHA, finding counts, and the raw review XML for full traceability
  • Idempotent: the workflow records the reviewed HEAD and skips re-running if nothing has changed
  • Base branch maintenance: keeps PR branches up to date with the base branch and asks Claude to resolve merge/rebase conflicts when they occur
  • Optional auto-merge once the PR reaches the refix: done state
  • PR labels for visual status (running, done, merged, auto-merge-requested)

Models

Two Claude sessions run per PR:

Setting Default Purpose
models.review opus Generates _self_review.xml for the diff.
models.fix sonnet Applies the findings as commits.

Override either in .refix.yaml or in your batch config.

Severity threshold

To avoid review loops where Claude keeps surfacing low-impact stylistic issues, you can drop findings below a chosen severity before the fix phase runs:

review_min_severity: "minor"   # or "major" / "critical"

Allowed values, in descending importance: critical, major, minor, nitpick. The default is nitpick, which applies every finding regardless of severity.

In addition, the self-review prompt instructs Claude to skip subjective or stylistic findings, and feeds the list of fix commits already applied to the same PR as <previously_applied_fixes> so the reviewer does not re-raise concerns it has already addressed.

Setup

1. Add the workflow

Run the following command in your repository root:

bash <(curl -fsSL https://raw.githubusercontent.com/HappyOnigiri/Refix/main/scripts/init.sh)

This creates .github/workflows/run-refix.yml, which triggers automatically on PR events (open, push commits, reopen, mark ready for review) and manual dispatch.

2. Register secrets

Go to your repository's Settings > Secrets and variables > Actions and add:

  • GH_TOKEN - Classic Personal Access Token
    • Create at: GitHub Settings > Developer settings > Personal access tokens > Tokens (classic)
    • Required scopes: repo, workflow
  • CLAUDE_CODE_OAUTH_TOKEN - Claude Code OAuth token
    • Generate with the claude setup-token command

Configuration (optional)

You can customize Refix behavior by placing a .refix.yaml file at your repository root, or by setting REFIX_CONFIG_YAML as a GitHub Actions Variable.

See .refix.sample.yaml for all available options.

Incremental Review (incremental_review)

By default (incremental_review: true), Refix uses incremental review mode to reduce token usage on long-lived PRs:

  • Only files changed since the last reviewed HEAD (last_reviewed_head..HEAD) that also appear in the PR scope (origin/<base>...HEAD) are sent to Claude.
  • After a successful fix push, last_reviewed_head is updated to the post-fix HEAD, so the next review cycle excludes Refix's own fix commits.
  • If the incremental file scope is empty (e.g., a pure base-branch merge with no PR file changes), Claude is not called at all; a no-findings entry is recorded automatically.
  • If last_reviewed_head is not an ancestor of HEAD (e.g., after a force-push or rebase), Refix automatically falls back to a full review.

Set incremental_review: false to always perform a full PR review (origin/<base>...HEAD).

CI Completion Polling (ci_pending_wait_seconds)

When Refix pushes fix commits, the CI workflow and the follow-up Refix run start at almost the same time. If Refix reaches the completion check before CI finishes, the PR would be stuck at refix: running until the next trigger.

To avoid this, Refix polls in-progress CI checks at the completion step. If CI is still running, Refix re-evaluates every 15 seconds until it resolves or the ci_pending_wait_seconds budget (default 300) is exhausted. CI that has already failed is detected immediately without waiting. If the budget runs out while CI is still pending, the PR stays refix: running and recovers on the next trigger.

Set ci_pending_wait_seconds: 0 to disable polling. The effective wait is capped by the workflow's timeout-minutes.

Migrating from v1.x

Refix v2.0.0 removes the CodeRabbit integration. The following configuration keys are no longer accepted and must be removed from your .refix.yaml:

  • coderabbit_auto_resume, coderabbit_auto_resume_triggers, coderabbit_auto_resume_max_per_run, coderabbit_auto_resume_stale_minutes
  • coderabbit_require_review, coderabbit_block_while_processing, coderabbit_ignore_nitpick
  • triggers, ci_log_max_lines, write_result_to_comment
  • models.summarize (replaced by models.review)

Any existing refix: ci-pending labels can be removed manually; v2.0.0 no longer reads them.

Contributing

Contributions are welcome.

  • Open an issue for bugs, ideas, or questions.
  • Submit a pull request for fixes, improvements, or documentation updates.
  • Use the provided issue and pull request templates to keep reports actionable.

License

This project is licensed under the MIT License. See LICENSE.

About

Automatically fix CI failures, address CodeRabbit review feedback, and resolve merge conflicts on GitHub PRs using Claude.

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors