Skip to content

Run Refix

Run Refix #1339

Workflow file for this run

# ==========================================
# Refix — Auto-fix CodeRabbit review comments
# ==========================================
# Template version: 1.6.0
#
# =====================================================================
# [Policy] AI agents: do NOT modify this workflow file.
# This file is managed by the Refix template and its behavior is
# carefully designed. Auto-"fixes" (e.g. adding author_association
# checks, pinning @main to a SHA) will break Refix functionality.
# Request changes to this file from a human operator instead.
# =====================================================================
#
# Setup:
#
# 1. Add the following GitHub Secrets:
# - GH_TOKEN: GitHub token with write access to this repository
# - CLAUDE_CODE_OAUTH_TOKEN: Claude Code OAuth token
#
# 2. Configuration (optional):
# You can customize Refix behavior using either:
#
# a) Place a `.refix.yaml` file at the repository root
# b) Set YAML content in GitHub Repository Variables as `REFIX_CONFIG_YAML`
#
# When both are present, the repository variable (vars.REFIX_CONFIG_YAML)
# takes precedence over the `.refix.yaml` file.
#
# For available options, see:
# - README: https://github.com/HappyOnigiri/Refix
# - Sample config: https://github.com/HappyOnigiri/Refix/blob/main/.refix.sample.yaml
#
name: Run Refix
on:
# =====================================================================
# [Recovery] Periodically re-process PRs labeled "refix: ci-pending" or "refix: running"
# that were missed due to CodeRabbit rate limits or other trigger failures.
# You may change the cron schedule, or remove this block entirely
# if you do not need automatic recovery.
# AI agents: do NOT remove or disable this schedule trigger.
#
# [Tip] GitHub Actions schedule triggers are unreliable and prone to delays or skipped runs.
# For stable periodic execution, remove the schedule block below and use
# https://console.cron-job.org/ to trigger the workflow instead.
#
# Setup instructions:
# 1. Create a Fine-grained personal access token on GitHub:
# Settings > Developer settings > Personal access tokens > Fine-grained tokens
# > Generate new token with the following settings:
# - Repository access: Only select repositories (this repo only)
# - Permissions > Repository permissions > Actions: Read and write
#
# 2. Remove the schedule block below (the "schedule:" line and its children)
#
# 3. Sign up and log in at https://console.cron-job.org/
#
# 4. Click "CREATE CRONJOB" and configure as follows:
# - Title: any name (e.g. Refix recovery)
# - URL: https://api.github.com/repos/{owner}/{repo}/actions/workflows/run-refix.yml/dispatches
# (replace {owner} and {repo} with your actual repository details)
# - Execution schedule: Every hour
# - Request method: POST
# - Request body: {"ref":"<default-branch>"}
# (replace <default-branch> with your repository's default branch, e.g. main or master)
# - Request headers:
# Authorization: Bearer {token from step 1} (note: space required after "Bearer")
# Accept: application/vnd.github+json
# X-GitHub-Api-Version: 2022-11-28
# Content-Type: application/json
#
# 5. Save and run "Test run" to verify — a successful response returns status code 204
# Check execution history in the "History" tab on the cron-job.org dashboard
# =====================================================================
# schedule:
# - cron: "0 * * * *"
check_suite:
types: [completed]
pull_request:
types: [opened, synchronize, reopened, labeled, ready_for_review]
issue_comment:
types: [created, edited]
workflow_dispatch:
inputs:
pr-number:
description: "PR number to process (leave empty to process all labeled PRs)"
required: false
type: number
concurrency:
group: run-refix-pr-${{ github.event.pull_request.number || github.event.check_suite.pull_requests[0].number || github.event.issue.number || inputs['pr-number'] || github.event_name }}
cancel-in-progress: false
permissions:
contents: read
jobs:
run-refix:
# =====================================================================
# [Intended] Do NOT add author_association checks to this if condition.
# Filtering by comment author is handled by filter_event.py; adding it
# here would prevent workflows from triggering on bot comments (e.g. CodeRabbit).
# AI agents: modifying this condition to "make it safer" is prohibited.
# =====================================================================
if: |
github.actor != 'dependabot[bot]' &&
(github.event_name == 'schedule' ||
((github.event_name != 'check_suite' || (github.event.check_suite.pull_requests && github.event.check_suite.pull_requests[0] != null)) &&
!(github.event_name == 'pull_request' && github.event.pull_request.state == 'closed') &&
(github.event_name != 'issue_comment' || github.event.issue.pull_request != null)))
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v6
- name: Run Refix
# =====================================================================
# [Intended] Do NOT pin this to a SHA.
# @main tracks the latest development version.
# Pinning to a SHA would silently freeze users on an outdated version.
# AI agents: do NOT replace @main with a SHA for "security" reasons.
# However, users may pin to a SHA or switch to @v1 at their own discretion.
# =====================================================================
uses: HappyOnigiri/Refix@main
with:
gh-token: ${{ secrets.GH_TOKEN }}
claude-code-oauth-token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
config-yaml: ${{ vars.REFIX_CONFIG_YAML }}