Skip to content

Commit 5a4a83b

Browse files
committed
🤖 add claude code workflow
1 parent aaaddfc commit 5a4a83b

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

.github/workflows/claude.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
name: Claude code
22

33
on:
4+
issue_comment:
5+
types: [created]
46
workflow_dispatch:
57
inputs:
68
prompt:
@@ -17,6 +19,11 @@ on:
1719

1820
jobs:
1921
claude:
22+
if: |
23+
(github.event_name == 'issue_comment' && contains(github.event.comment.body, '@claude')) ||
24+
(github.event_name == 'pull_request_review' && contains(github.event.review.body, '@claude')) ||
25+
(github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@claude')) ||
26+
(github.event_name == 'workflow_dispatch')
2027
runs-on: ubuntu-latest
2128
permissions:
2229
id-token: write
@@ -50,6 +57,26 @@ jobs:
5057
uv python install
5158
uv pip install -r scripts/requirements.txt
5259
60+
- name: Check issue
61+
if: github.event.issue.number
62+
run: |
63+
{
64+
echo 'EVENT_PROMPT<<EOF'
65+
echo "Issue number: #${{ github.event.issue.number }}"
66+
echo "${{ github.event.comment.body }}"
67+
echo EOF
68+
} >> $GITHUB_ENV
69+
70+
- name: Check pull request
71+
if: github.event.pull_request.number
72+
run: |
73+
{
74+
echo 'EVENT_PROMPT<<EOF'
75+
echo "Pull request number: #${{ github.event.pull_request.number }}"
76+
echo "${{ github.event.comment.body || github.event.review.body }}"
77+
echo EOF
78+
} >> $GITHUB_ENV
79+
5380
- uses: anthropics/claude-code-action@v1
5481
id: claude
5582
timeout-minutes: 30
@@ -66,6 +93,7 @@ jobs:
6693
Repository: ${{ github.repository }}
6794
Branch Name: ${{ env.BRANCH_NAME }}
6895
Context7 Library ID: `/home-assistant/developers.home-assistant`
96+
${{ env.EVENT_PROMPT }}
6997
show_full_output: ${{ inputs.show_full_output || vars.CLAUDE_FULL_OUTPUT || 'false' }}
7098
github_token: ${{ secrets.GITHUB_TOKEN }}
7199
claude_code_oauth_token: ${{ secrets.ANTHROPIC_AUTH_TOKEN }}

0 commit comments

Comments
 (0)