diff --git a/.github/workflows/autofix.yml b/.github/workflows/autofix.yml new file mode 100644 index 0000000..669de1e --- /dev/null +++ b/.github/workflows/autofix.yml @@ -0,0 +1,27 @@ +name: PR Autofix + +on: + issue_comment: + types: [created] + pull_request_review: + types: [submitted] + pull_request_review_comment: + types: [created] + +permissions: {} + +concurrency: + group: pr-autofix-${{ github.repository }}-${{ github.event.issue.number || github.event.pull_request.number }} + cancel-in-progress: false + +jobs: + autofix: + if: > + (github.event.issue.pull_request || github.event.pull_request) && + contains(fromJSON('["bot", "Bot"]'), github.event.comment.user.type || github.event.review.user.type || '') + permissions: + contents: write + pull-requests: read + uses: Simple-With-Us/AI-Fleet-Coordinator/.github/workflows/pr-autofix-reusable.yml@9f9eaeb7dd6b88cc48d422cd4b5dc461abd87f57 + secrets: + MINIMAX_API_KEY: ${{ secrets.MINIMAX_API_KEY }} diff --git a/.github/workflows/claude-code-autofix.yml b/.github/workflows/claude-code-autofix.yml new file mode 100644 index 0000000..83ea890 --- /dev/null +++ b/.github/workflows/claude-code-autofix.yml @@ -0,0 +1,36 @@ +name: Claude Code Autofix +on: + pull_request_review: + types: [submitted] + workflow_dispatch: + inputs: + pr: + description: "PR number to run the autofix loop on" + required: true +permissions: + contents: write + pull-requests: write +concurrency: + group: pr-autofix-${{ github.repository }}-${{ github.event.pull_request.number || github.event.inputs.pr }} + cancel-in-progress: false +jobs: + autofix: + if: >- + github.event_name == 'workflow_dispatch' || + (github.event_name == 'pull_request_review' && + github.event.review.user.type == 'Bot' && + github.event.pull_request.head.repo.full_name == github.repository) + uses: Simple-With-Us/congress-trading-shared/.github/workflows/codex-autofix-reusable.yml@3af2bff8dc3c17d713d64316ad46f5841c92701d + secrets: + MINIMAX_API_KEY: ${{ secrets.MINIMAX_API_KEY }} + GH_PAT: ${{ secrets.GH_PAT }} + with: + prompt: | + You are the fleet's autofix bot. A review bot (Codex, Kody, or Cursor) just reviewed this pull request. + 1. Read every unresolved review comment from that review. For each, decide against the current code whether it is a real defect. + 2. Fix real defects with the smallest change that answers the comment. Do not refactor unrelated code, rename things, or reformat files. + 3. Never edit files under .github/workflows, never add or print secrets, and never weaken a test to make it pass. + 4. Run this repo's verify command (below) and make sure it passes before committing. If you cannot make it pass, commit nothing. + 5. Commit with a subject starting "autofix:" and push to the PR branch. Stop after one round. + 6. If a comment is not a real defect or is unclear, change nothing for it. + This repo's verify command: npm run typecheck && npm test