Skip to content

Commit c54e85d

Browse files
authored
Merge pull request #69 from synonymdev/fix/ci-workflows
fix: claude code review workflow + disable rustfmt cron
2 parents 3f4c563 + 81131d7 commit c54e85d

3 files changed

Lines changed: 42 additions & 38 deletions

File tree

.github/workflows/claude-code-review.yml

Lines changed: 18 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -24,27 +24,24 @@ jobs:
2424
fetch-depth: 1
2525

2626
- name: Minimize old Claude comments
27-
uses: actions/github-script@v7
28-
with:
29-
script: |
30-
const { data: comments } = await github.rest.issues.listComments({
31-
owner: context.repo.owner,
32-
repo: context.repo.repo,
33-
issue_number: context.payload.pull_request.number,
34-
per_page: 100,
35-
});
36-
const claudeComments = comments.filter(c =>
37-
c.user?.login === 'claude[bot]' || c.user?.login === 'github-actions[bot]'
38-
);
39-
for (const comment of claudeComments) {
40-
await github.graphql(`
41-
mutation MinimizeComment($id: ID!) {
42-
minimizeComment(input: { subjectId: $id, classifier: OUTDATED }) {
27+
env:
28+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
29+
run: |
30+
REPO="${{ github.repository }}"
31+
PR_NUMBER="${{ github.event.pull_request.number }}"
32+
33+
# Minimize issue comments from claude[bot]
34+
gh api "repos/$REPO/issues/$PR_NUMBER/comments" --jq '.[] | select(.user.login == "claude[bot]") | .node_id' | while read -r node_id; do
35+
if [ -n "$node_id" ]; then
36+
echo "Minimizing comment: $node_id"
37+
gh api graphql -f query='
38+
mutation($id: ID!) {
39+
minimizeComment(input: {subjectId: $id, classifier: OUTDATED}) {
4340
minimizedComment { isMinimized }
4441
}
45-
}
46-
`, { id: comment.node_id });
47-
}
42+
}' -f id="$node_id" || true
43+
fi
44+
done
4845
4946
- name: Run Claude Code Review
5047
id: claude-review
@@ -54,5 +51,5 @@ jobs:
5451
plugin_marketplaces: 'https://github.com/anthropics/claude-code.git'
5552
plugins: 'code-review@claude-code-plugins'
5653
prompt: '/code-review:code-review ${{ github.repository }}/pull/${{ github.event.pull_request.number }}'
57-
allowed_bots: 'claude[bot]'
58-
claude_args: '--allowed-tools Bash(gh:*) WebFetch'
54+
# See https://github.com/anthropics/claude-code-action/blob/main/docs/usage.md
55+
# or https://code.claude.com/docs/en/cli-reference for available options

.github/workflows/claude.yml

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,34 +12,43 @@ on:
1212

1313
jobs:
1414
claude:
15+
# Only allow trusted actors (OWNER, MEMBER, COLLABORATOR) to trigger Claude with write permissions
1516
if: |
1617
(github.event_name == 'issue_comment' && contains(github.event.comment.body, '@claude') &&
17-
(github.event.comment.author_association == 'OWNER' || github.event.comment.author_association == 'MEMBER' || github.event.comment.author_association == 'COLLABORATOR')) ||
18+
contains(fromJSON('["OWNER", "MEMBER", "COLLABORATOR"]'), github.event.comment.author_association)) ||
1819
(github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@claude') &&
19-
(github.event.comment.author_association == 'OWNER' || github.event.comment.author_association == 'MEMBER' || github.event.comment.author_association == 'COLLABORATOR')) ||
20+
contains(fromJSON('["OWNER", "MEMBER", "COLLABORATOR"]'), github.event.comment.author_association)) ||
2021
(github.event_name == 'pull_request_review' && contains(github.event.review.body, '@claude') &&
21-
(github.event.review.author_association == 'OWNER' || github.event.review.author_association == 'MEMBER' || github.event.review.author_association == 'COLLABORATOR')) ||
22-
(github.event_name == 'issues' &&
23-
(contains(github.event.issue.body, '@claude') || contains(github.event.issue.title, '@claude')) &&
24-
(github.event.issue.author_association == 'OWNER' || github.event.issue.author_association == 'MEMBER' || github.event.issue.author_association == 'COLLABORATOR'))
22+
contains(fromJSON('["OWNER", "MEMBER", "COLLABORATOR"]'), github.event.review.author_association)) ||
23+
(github.event_name == 'issues' && (contains(github.event.issue.body, '@claude') || contains(github.event.issue.title, '@claude')) &&
24+
contains(fromJSON('["OWNER", "MEMBER", "COLLABORATOR"]'), github.event.issue.author_association))
2525
runs-on: ubuntu-latest
2626
permissions:
27-
contents: write
28-
pull-requests: write
29-
issues: write
27+
contents: write # Allow creating branches/commits
28+
pull-requests: write # Allow pushing to PR branches
29+
issues: write # Allow updating issue comments
3030
id-token: write
31-
actions: read
31+
actions: read # Required for Claude to read CI results on PRs
3232
steps:
3333
- name: Checkout repository
3434
uses: actions/checkout@v4
3535
with:
36-
fetch-depth: 0
36+
fetch-depth: 0 # Full history for git operations
3737

3838
- name: Run Claude Code
3939
id: claude
4040
uses: anthropics/claude-code-action@v1
4141
with:
4242
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
43-
use_api_for_commits: true
43+
44+
# This is an optional setting that allows Claude to read CI results on PRs
4445
additional_permissions: |
4546
actions: read
47+
48+
# Optional: Give a custom prompt to Claude. If this is not specified, Claude will perform the instructions specified in the comment that tagged it.
49+
# prompt: 'Update the pull request description to include a summary of changes.'
50+
51+
# Optional: Add claude_args to customize behavior and configuration
52+
# See https://github.com/anthropics/claude-code-action/blob/main/docs/usage.md
53+
# or https://code.claude.com/docs/en/cli-reference for available options
54+
# claude_args: '--allowed-tools Bash(gh pr:*)'

.github/workflows/cron-weekly-rustfmt.yml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,14 @@
1-
name: Nightly rustfmt
1+
name: Rustfmt (manual)
22

33
permissions:
44
contents: write
55
pull-requests: write
66

77
on:
8-
schedule:
9-
- cron: "0 0 * * 0" # runs weekly on Sunday at 00:00
10-
workflow_dispatch: # allows manual triggering
8+
workflow_dispatch: # manual only — cron schedule removed to avoid automated PRs
119
jobs:
1210
format:
13-
name: Nightly rustfmt
11+
name: Rustfmt (manual)
1412
runs-on: ubuntu-24.04
1513
steps:
1614
- uses: actions/checkout@v5

0 commit comments

Comments
 (0)