Skip to content

Commit d1d13b6

Browse files
committed
Update Claude workflow configuration
1 parent c67e688 commit d1d13b6

File tree

1 file changed

+37
-11
lines changed

1 file changed

+37
-11
lines changed

.github/workflows/claude.yml

Lines changed: 37 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -467,6 +467,7 @@ jobs:
467467
token: ${{ secrets.GITHUB_TOKEN }}
468468

469469
- name: Validate Environment
470+
id: validate-env
470471
run: |
471472
echo "🔍 Runtime Environment Information"
472473
echo "=================================="
@@ -480,8 +481,26 @@ jobs:
480481
echo "Base Ref: ${{ needs.setup.outputs.base-ref }}"
481482
echo "Head SHA: ${{ needs.setup.outputs.head-sha }}"
482483
echo "Has Linked PR: ${{ needs.setup.outputs.has-linked-pr }}"
483-
echo "Trigger Text: '${{ needs.setup.outputs.trigger-text }}'"
484+
485+
# Capture trigger text once using heredoc (safely handles multiline/special chars)
486+
TRIGGER_TEXT=$(cat << 'TRIGGER_EOF'
487+
${{ needs.setup.outputs.trigger-text }}
488+
TRIGGER_EOF
489+
)
490+
echo "Trigger Text: $TRIGGER_TEXT"
484491
echo "=================================="
492+
493+
# Check for model keywords (case-insensitive)
494+
if echo "$TRIGGER_TEXT" | grep -qi '\bopus\b'; then
495+
echo "🧠 Opus model requested"
496+
echo "model=opus" >> $GITHUB_OUTPUT
497+
elif echo "$TRIGGER_TEXT" | grep -qi '\bhaiku\b'; then
498+
echo "⚡ Haiku model requested"
499+
echo "model=haiku" >> $GITHUB_OUTPUT
500+
else
501+
echo "🎵 Using default Sonnet model"
502+
echo "model=sonnet" >> $GITHUB_OUTPUT
503+
fi
485504
486505
- name: Fetch Base Branch (PR only)
487506
if: needs.setup.outputs.is-pr == 'true' && needs.setup.outputs.base-ref
@@ -546,13 +565,14 @@ jobs:
546565
echo "total-files=$total_files" >> $GITHUB_OUTPUT
547566
548567
echo "📊 Project summary: $framework ($total_files files)"
549-
550-
- name: Setup Env
551-
id: setup-env
552-
uses: DavidWells/actions/get-claude-tokens@master
553-
with:
554-
api-key: ${{ secrets.CLAUDE_CREDS_API_KEY }}
555-
api-endpoint: ${{ secrets.CLAUDE_CREDS_API }}
568+
569+
# Old claude code action to fetch tokens
570+
# - name: Setup Env
571+
# id: setup-env
572+
# uses: DavidWells/actions/get-claude-tokens@master
573+
# with:
574+
# api-key: ${{ secrets.CLAUDE_CREDS_API_KEY }}
575+
# api-endpoint: ${{ secrets.CLAUDE_CREDS_API }}
556576

557577
# - name: Run Claude PR Action
558578
# uses: davidwells/claude-code-action@main
@@ -564,7 +584,7 @@ jobs:
564584
# model: ${{ steps.setup-env.outputs.model || 'claude-sonnet-4-20250514' }}
565585
# allowed_tools: ${{ steps.setup-env.outputs.allowed_tools || 'Bash,Edit,Read,Write,Glob,Grep,LS,MultiEdit,NotebookRead,NotebookEdit' }}
566586
# timeout_minutes: "60"
567-
587+
568588
- name: Run Claude Code
569589
id: claude
570590
uses: anthropics/claude-code-action@main
@@ -580,7 +600,8 @@ jobs:
580600
"allowedTools": [
581601
"Edit", "View", "Replace", "Write", "Create",
582602
"BatchTool", "GlobTool", "GrepTool", "NotebookEditCell",
583-
"Bash(git:*)", "Bash(npm:*)", "Bash(yarn:*)", "Bash(python:*)",
603+
"Bash(git:*)", "Bash(npm:*)", "Bash(npx:*)", "Bash(yarn:*)",
604+
"Bash(python:*)", "Bash(bun:*)", "Bash(pnpm:*)",
584605
"Bash(docker:*)", "Bash(make:*)", "Bash(cargo:*)", "Bash(go:*)",
585606
"Bash(ls:*)", "Bash(cat:*)", "Bash(echo:*)", "Bash(curl:*)",
586607
"mcp__*"
@@ -592,7 +613,7 @@ jobs:
592613
}
593614
}
594615
claude_args: |
595-
--model sonnet
616+
--model ${{ steps.validate-env.outputs.model }} --dangerously-skip-permissions
596617
# If the workflow is triggered by a workflow_dispatch event, use the agent mode, otherwise use the tag mode
597618
mode: ${{ github.event_name == 'workflow_dispatch' && 'agent' || 'tag' }}
598619
# direct prompt from workflow_dispatch event
@@ -1081,6 +1102,11 @@ jobs:
10811102
10821103
*resolves #${issueNumber}*
10831104
1105+
Please review @copilot
1106+
1107+
<!-- CLAUDE_ISSUE_RESPONSE start -->
1108+
<!-- CLAUDE_ISSUE_RESPONSE end -->
1109+
10841110
---
10851111
*Automated PR by [Claude Code Action - Run #${{ github.run_id }}](https://github.com/${owner}/${repo}/actions/runs/${{ github.run_id }})*
10861112
`

0 commit comments

Comments
 (0)