From 58e57664e2203518bc63b0f1ceedd598dd15e022 Mon Sep 17 00:00:00 2001 From: "Luis M. Gallardo D" Date: Thu, 7 Aug 2025 11:46:32 +0200 Subject: [PATCH 1/2] feat: add Claude dispatch workflow for repository events - Add claude-dispatch.yml workflow for repository_dispatch events - Enables programmatic Claude Code task execution via API - Complements existing comment-based Claude integration - Supports configurable model selection and allowed tools --- .github/workflows/claude-dispatch.yml | 36 +++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 .github/workflows/claude-dispatch.yml diff --git a/.github/workflows/claude-dispatch.yml b/.github/workflows/claude-dispatch.yml new file mode 100644 index 0000000..dc04fb2 --- /dev/null +++ b/.github/workflows/claude-dispatch.yml @@ -0,0 +1,36 @@ +name: Claude Dispatch + +on: + repository_dispatch: + types: [claude] + +jobs: + claude: + runs-on: ubuntu-latest + permissions: + contents: write + pull-requests: write + issues: write + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Run Claude Code + uses: anthropics/claude-code-action@beta + with: + claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }} + # Optional: customize model (defaults to Claude Sonnet 4) + # model: "claude-opus-4-20250514" + + # Optional: allow specific development commands + # allowed_tools: "Bash(terraform fmt),Bash(terraform validate),Bash(go test ./...)" + + # Optional: custom instructions for Claude + # custom_instructions: | + # Follow Terraform best practices + # Ensure all changes are validated and formatted + # Run tests before submitting changes + + # Optional: environment variables + # claude_env: | + # TF_IN_AUTOMATION: true \ No newline at end of file From ba7462e00b235d10ae0eed442d7e6ac87c1fafb3 Mon Sep 17 00:00:00 2001 From: "Luis M. Gallardo D" Date: Thu, 7 Aug 2025 12:06:13 +0200 Subject: [PATCH 2/2] fix: update Claude dispatch workflow to match original gist exactly - Change trigger type from 'claude' to 'claude-dispatch' - Update action version from @beta to @eap - Add remote-agent mode configuration - Include anthropic_api_key option alongside existing oauth token - Add id-token write permission - Include fetch-depth: 1 for checkout - Add preliminary setup section - Update job name to 'claude-dispatch' - Add comprehensive documentation comments --- .github/workflows/claude-dispatch.yml | 50 +++++++++++++++++---------- 1 file changed, 32 insertions(+), 18 deletions(-) diff --git a/.github/workflows/claude-dispatch.yml b/.github/workflows/claude-dispatch.yml index dc04fb2..2913a08 100644 --- a/.github/workflows/claude-dispatch.yml +++ b/.github/workflows/claude-dispatch.yml @@ -1,36 +1,50 @@ -name: Claude Dispatch +# IMPORTANT: Do not move this file in your repo! Make sure it's located at .github/workflows/claude-dispatch.yml + +name: Claude Code Dispatch + +# IMPORTANT: Do not modify this `on` section! on: repository_dispatch: - types: [claude] + types: [claude-dispatch] jobs: - claude: + claude-dispatch: runs-on: ubuntu-latest permissions: contents: write pull-requests: write issues: write + id-token: write steps: - name: Checkout repository uses: actions/checkout@v4 + with: + fetch-depth: 1 + + # - name: Preliminary Setup + # run: | + # echo "Setting up environment..." + # # Add any preliminary setup commands here to setup Claude's dev environment + # # e.g., npm install, etc. - name: Run Claude Code - uses: anthropics/claude-code-action@beta + id: claude + uses: anthropics/claude-code-action@eap with: - claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }} - # Optional: customize model (defaults to Claude Sonnet 4) + mode: 'remote-agent' + # Optional: Specify an API key, otherwise we'll use your Claude account automatically + # anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }} + + # Optional: Specify model (defaults to Claude Sonnet 4, uncomment for Claude Opus 4) # model: "claude-opus-4-20250514" - - # Optional: allow specific development commands - # allowed_tools: "Bash(terraform fmt),Bash(terraform validate),Bash(go test ./...)" - - # Optional: custom instructions for Claude - # custom_instructions: | - # Follow Terraform best practices - # Ensure all changes are validated and formatted - # Run tests before submitting changes - - # Optional: environment variables + + # Optional: Allow Claude to run specific commands + # allowed_tools: | + # Bash(npm run lint) + # Bash(npm run test) + # Bash(npm run build) + + # Optional: Custom environment variables for Claude # claude_env: | - # TF_IN_AUTOMATION: true \ No newline at end of file + # NODE_ENV: test \ No newline at end of file