-
Notifications
You must be signed in to change notification settings - Fork 0
98 lines (90 loc) · 4.33 KB
/
claude.yml
File metadata and controls
98 lines (90 loc) · 4.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
## Copyright 2025-2026 Intel Corporation
## SPDX-License-Identifier: BSD-3-Clause
name: Claude Code
on:
issue_comment:
types: [created]
pull_request_review_comment:
types: [created]
issues:
types: [opened, assigned]
pull_request_review:
types: [submitted]
workflow_dispatch:
inputs:
prompt:
description: "Prompt for Claude"
required: true
type: string
workflow_call:
inputs:
prompt:
description: "Prompt for Claude"
required: true
type: string
secrets:
ANTHROPIC_API_KEY:
required: true
permissions: {}
env:
LLVM_VERSION: "21.1"
LLVM_TAR: llvm-21.1.8-ubuntu22.04-Release+Asserts-x86.arm.wasm.tar.xz
LLVM_REPO: https://github.com/ispc/ispc.dependencies
jobs:
claude:
# Only run in the main ispc/ispc repo where the secret is available.
if: |
github.repository == 'ispc/ispc' &&
(github.event_name == 'workflow_dispatch' ||
github.event_name == 'workflow_call' ||
(github.event_name == 'issue_comment' && contains(github.event.comment.body, '@claude') &&
(github.event.comment.author_association == 'OWNER' || github.event.comment.author_association == 'MEMBER')) ||
(github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@claude') &&
(github.event.comment.author_association == 'OWNER' || github.event.comment.author_association == 'MEMBER')) ||
(github.event_name == 'pull_request_review' && contains(github.event.review.body, '@claude') &&
(github.event.review.author_association == 'OWNER' || github.event.review.author_association == 'MEMBER')) ||
(github.event_name == 'issues' && (contains(github.event.issue.body, '@claude') || contains(github.event.issue.title, '@claude')) &&
(github.event.issue.author_association == 'OWNER' || github.event.issue.author_association == 'MEMBER')))
runs-on: ubuntu-22.04
timeout-minutes: 60
permissions:
contents: write # Required to push branches and create commits
pull-requests: write
issues: write
actions: read # Required for Claude to read CI results on PRs
steps:
- name: Checkout repository
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
with:
fetch-depth: 0
- name: Install build dependencies
run: |
echo "APT::Acquire::Retries \"3\";" | sudo tee -a /etc/apt/apt.conf.d/80-retries
sudo apt-get update
sudo apt-get install -y --no-install-recommends \
cmake ninja-build bison flex m4 \
libc6-dev libc6-dev-i386 g++-multilib \
libtbb-dev libstdc++6
- name: Download LLVM
run: |
wget -q --retry-connrefused --waitretry=5 --read-timeout=20 --timeout=15 -t 5 \
"$LLVM_REPO/releases/download/llvm-$LLVM_VERSION-ispc-dev/$LLVM_TAR"
tar xf "$LLVM_TAR"
rm -f "$LLVM_TAR"
echo "$GITHUB_WORKSPACE/bin-$LLVM_VERSION/bin" >> "$GITHUB_PATH"
- name: Run Claude Code
id: claude
uses: anthropics/claude-code-action@8a1c4371755898f67cd97006ba7c97702d5fc4bf # v1.0.0
with:
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
github_token: ${{ secrets.GITHUB_TOKEN }}
# track_progress only works with issue/PR events, not workflow_dispatch/workflow_call
track_progress: ${{ github.event_name != 'workflow_dispatch' && github.event_name != 'workflow_call' }}
# prompt is only used for workflow_dispatch/workflow_call; empty for issue/PR events
prompt: ${{ inputs.prompt || '' }}
# Required for Claude to access CI workflow logs
additional_permissions: |
actions: read
# Allow tools for building, testing, and code formatting
claude_args: |
--allowedTools "Edit,Glob,Grep,LS,Read,Write,Bash(git *:*),Bash(gh *:*),Bash(cmake *:*),Bash(*cmake *:*),Bash(clang-format *:*),Bash(*/ispc *:*),Bash(./build/*:*),Bash(build/*:*),Bash(*run_tests.py *:*),Bash(python3 *:*),Bash(curl *:*),Bash(jq *:*),Bash(rm *:*),Bash(ls *:*),Bash(mkdir *:*),Bash(cp *:*),Bash(mv *:*),Bash(touch *:*),Bash(diff *:*),Bash(cat *:*),Bash(head *:*),Bash(tail *:*),Bash(wc *:*),Bash(pwd *:*),Bash(which *:*),Bash(realpath *:*),Bash(llvm-* *:*),Bash(opt *:*),Bash(llc *:*),Bash(FileCheck *:*)"