mirror of
https://github.com/anthropics/claude-code-action.git
synced 2026-01-22 22:44:13 +08:00
This change removes the custom timeout_minutes parameter from the action in favor of using GitHub Actions' native timeout-minutes feature. Changes: - Removed timeout_minutes input from action.yml and base-action/action.yml - Removed all timeout handling logic from base-action/src/run-claude.ts - Updated base-action/src/index.ts to remove timeoutMinutes parameter - Removed timeout-related tests from base-action/test/run-claude.test.ts - Removed timeout_minutes from all example workflow files (19 files) Rationale: - Simplifies the codebase by removing custom timeout logic - Users can use GitHub Actions' native timeout-minutes at the job/step level - Reduces complexity and maintenance burden - Follows GitHub Actions best practices BREAKING CHANGE: The timeout_minutes parameter is no longer supported. Users should use GitHub Actions' native timeout-minutes instead. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-authored-by: Claude <noreply@anthropic.com>
98 lines
3.5 KiB
YAML
98 lines
3.5 KiB
YAML
name: Auto Fix CI Failures (Signed Commits)
|
|
|
|
on:
|
|
workflow_run:
|
|
workflows: ["CI"]
|
|
types:
|
|
- completed
|
|
|
|
permissions:
|
|
contents: write
|
|
pull-requests: write
|
|
actions: read
|
|
issues: write
|
|
id-token: write # Required for OIDC token exchange
|
|
|
|
jobs:
|
|
auto-fix-signed:
|
|
if: |
|
|
github.event.workflow_run.conclusion == 'failure' &&
|
|
github.event.workflow_run.pull_requests[0] &&
|
|
!startsWith(github.event.workflow_run.head_branch, 'claude-auto-fix-ci-signed-')
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
with:
|
|
ref: ${{ github.event.workflow_run.head_branch }}
|
|
fetch-depth: 0
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Generate fix branch name
|
|
id: branch
|
|
run: |
|
|
BRANCH_NAME="claude-auto-fix-ci-signed-${{ github.event.workflow_run.head_branch }}-${{ github.run_id }}"
|
|
echo "branch_name=$BRANCH_NAME" >> $GITHUB_OUTPUT
|
|
# Don't create branch locally - MCP tools will create it via API
|
|
echo "Generated branch name: $BRANCH_NAME (will be created by MCP tools)"
|
|
|
|
- name: Get CI failure details
|
|
id: failure_details
|
|
uses: actions/github-script@v7
|
|
with:
|
|
script: |
|
|
const run = await github.rest.actions.getWorkflowRun({
|
|
owner: context.repo.owner,
|
|
repo: context.repo.repo,
|
|
run_id: ${{ github.event.workflow_run.id }}
|
|
});
|
|
|
|
const jobs = await github.rest.actions.listJobsForWorkflowRun({
|
|
owner: context.repo.owner,
|
|
repo: context.repo.repo,
|
|
run_id: ${{ github.event.workflow_run.id }}
|
|
});
|
|
|
|
const failedJobs = jobs.data.jobs.filter(job => job.conclusion === 'failure');
|
|
|
|
let errorLogs = [];
|
|
for (const job of failedJobs) {
|
|
const logs = await github.rest.actions.downloadJobLogsForWorkflowRun({
|
|
owner: context.repo.owner,
|
|
repo: context.repo.repo,
|
|
job_id: job.id
|
|
});
|
|
errorLogs.push({
|
|
jobName: job.name,
|
|
logs: logs.data
|
|
});
|
|
}
|
|
|
|
return {
|
|
runUrl: run.data.html_url,
|
|
failedJobs: failedJobs.map(j => j.name),
|
|
errorLogs: errorLogs
|
|
};
|
|
|
|
- name: Fix CI failures with Claude (Signed Commits)
|
|
id: claude
|
|
uses: anthropics/claude-code-action@v1-dev
|
|
env:
|
|
CLAUDE_BRANCH: ${{ steps.branch.outputs.branch_name }}
|
|
BASE_BRANCH: ${{ github.event.workflow_run.head_branch }}
|
|
with:
|
|
prompt: |
|
|
/fix-ci-signed
|
|
Failed CI Run: ${{ fromJSON(steps.failure_details.outputs.result).runUrl }}
|
|
Failed Jobs: ${{ join(fromJSON(steps.failure_details.outputs.result).failedJobs, ', ') }}
|
|
PR Number: ${{ github.event.workflow_run.pull_requests[0].number }}
|
|
Branch Name: ${{ steps.branch.outputs.branch_name }}
|
|
Base Branch: ${{ github.event.workflow_run.head_branch }}
|
|
Repository: ${{ github.repository }}
|
|
|
|
Error logs:
|
|
${{ toJSON(fromJSON(steps.failure_details.outputs.result).errorLogs) }}
|
|
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
|
|
use_commit_signing: true
|
|
claude_args: "--allowedTools 'Edit,MultiEdit,Write,Read,Glob,Grep,LS,Bash(bun:*),Bash(npm:*),Bash(npx:*),Bash(gh:*),mcp__github_file_ops__commit_files,mcp__github_file_ops__delete_files'"
|