Skip to content

Commit 784065f

Browse files
cmungallclaude
andcommitted
Upgrade claude-code-action from @beta to @v1, add anti-pile-on controls
Lessons learned from monarch-initiative/dismech#150 and dismech PR #268: - Migrate all workflows from anthropics/claude-code-action@beta to @v1 - Replace deprecated `direct_prompt` input with `prompt` - Add concurrency control (cancel-in-progress) to all review workflows so only the latest review runs when multiple commits arrive quickly - Enable `use_sticky_comment: true` on review workflows so reviews update a single comment instead of posting new ones - Change pull-requests permission from `read` to `write` (required for sticky comments) - Clean up deprecated/commented-out boilerplate from template files (trigger_phrase, assignee_trigger, claude_env, etc.) Applies to both template/ files and repo's own dogfood workflows. Closes #18, closes #19 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent d53bbe4 commit 784065f

5 files changed

Lines changed: 125 additions & 144 deletions

File tree

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

Lines changed: 11 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -3,28 +3,20 @@ name: Claude Code Review
33
on:
44
pull_request:
55
types: [opened, synchronize]
6-
# Optional: Only run on specific file changes
7-
# paths:
8-
# - "src/**/*.ts"
9-
# - "src/**/*.tsx"
10-
# - "src/**/*.js"
11-
# - "src/**/*.jsx"
6+
7+
concurrency:
8+
group: claude-review-${{ github.event.pull_request.number }}
9+
cancel-in-progress: true
1210

1311
jobs:
1412
claude-review:
15-
# Optional: Filter by PR author
16-
# if: |
17-
# github.event.pull_request.user.login == 'external-contributor' ||
18-
# github.event.pull_request.user.login == 'new-developer' ||
19-
# github.event.pull_request.author_association == 'FIRST_TIME_CONTRIBUTOR'
20-
2113
runs-on: ubuntu-latest
2214
permissions:
2315
contents: read
24-
pull-requests: read
16+
pull-requests: write
2517
issues: read
2618
id-token: write
27-
19+
2820
steps:
2921
- name: Checkout repository
3022
uses: actions/checkout@v4
@@ -33,46 +25,16 @@ jobs:
3325

3426
- name: Run Claude Code Review
3527
id: claude-review
36-
uses: anthropics/claude-code-action@beta
28+
uses: anthropics/claude-code-action@v1
3729
with:
3830
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
3931

40-
# Optional: Specify model (defaults to Claude Sonnet 4, uncomment for Claude Opus 4)
41-
# model: "claude-opus-4-20250514"
42-
43-
# Direct prompt for automated review (no @claude mention needed)
44-
direct_prompt: |
32+
prompt: |
4533
Please review this pull request and provide feedback on:
4634
- Code quality and best practices
4735
- Potential bugs or issues
48-
- Performance considerations
49-
- Security concerns
50-
- Test coverage
51-
52-
Be constructive and helpful in your feedback.
36+
- Whether template files are consistent with the repo's own workflow files
5337
54-
# Optional: Use sticky comments to make Claude reuse the same comment on subsequent pushes to the same PR
55-
# use_sticky_comment: true
56-
57-
# Optional: Customize review based on file types
58-
# direct_prompt: |
59-
# Review this PR focusing on:
60-
# - For TypeScript files: Type safety and proper interface usage
61-
# - For API endpoints: Security, input validation, and error handling
62-
# - For React components: Performance, accessibility, and best practices
63-
# - For tests: Coverage, edge cases, and test quality
64-
65-
# Optional: Different prompts for different authors
66-
# direct_prompt: |
67-
# ${{ github.event.pull_request.author_association == 'FIRST_TIME_CONTRIBUTOR' &&
68-
# 'Welcome! Please review this PR from a first-time contributor. Be encouraging and provide detailed explanations for any suggestions.' ||
69-
# 'Please provide a thorough code review focusing on our coding standards and best practices.' }}
70-
71-
# Optional: Add specific tools for running tests or linting
72-
# allowed_tools: "Bash(npm run test),Bash(npm run lint),Bash(npm run typecheck)"
73-
74-
# Optional: Skip review for certain conditions
75-
# if: |
76-
# !contains(github.event.pull_request.title, '[skip-review]') &&
77-
# !contains(github.event.pull_request.title, '[WIP]')
38+
Be constructive and helpful in your feedback.
7839
40+
use_sticky_comment: true

.github/workflows/claude.yml

Lines changed: 5 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,15 @@ jobs:
3232

3333
- name: Install uv
3434
uses: astral-sh/setup-uv@v5
35-
35+
3636
- name: Install python tools
3737
run: |
3838
uv sync
3939
4040
- name: Run Claude Code
4141
id: claude
42-
uses: anthropics/claude-code-action@beta
43-
42+
uses: anthropics/claude-code-action@v1
43+
4444
with:
4545
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
4646
mcp_config: |
@@ -51,40 +51,9 @@ jobs:
5151
"args": [
5252
"ols-mcp"
5353
]
54-
},
55-
"sequential-thinking": {
56-
"command": "npx",
57-
"args": [
58-
"-y",
59-
"@modelcontextprotocol/server-sequential-thinking"
60-
]
6154
}
6255
}
6356
}
6457
65-
# This is an optional setting that allows Claude to read CI results on PRs
66-
additional_permissions: |
67-
actions: read
68-
69-
# Optional: Specify model (defaults to Claude Sonnet 4, uncomment for Claude Opus 4.1)
70-
# model: "claude-opus-4-1-20250805"
71-
72-
# Optional: Customize the trigger phrase (default: @claude)
73-
# trigger_phrase: "/claude"
74-
75-
# Optional: Trigger when specific user is assigned to an issue
76-
# assignee_trigger: "claude-bot"
77-
78-
# Optional: Allow Claude to run specific commands
79-
allowed_tools: "Bash(*),FileEdit,Edit,MultiEdit,WebSearch,WebFetch,mcp__ols_mcp__search_all_ontologies,mcp__ols_mcp__get_terms_from_ontology"
80-
81-
# Optional: Add custom instructions for Claude to customize its behavior for your project
82-
# custom_instructions: |
83-
# Follow our coding standards
84-
# Ensure all new code has tests
85-
# Use TypeScript for new files
86-
87-
# Optional: Custom environment variables for Claude
88-
# claude_env: |
89-
# NODE_ENV: test
90-
58+
claude_args: |
59+
--permission-mode bypassPermissions

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

Lines changed: 13 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -7,24 +7,25 @@ on:
77
# paths:
88
# - "src/**/*.ts"
99
# - "src/**/*.tsx"
10-
# - "src/**/*.js"
11-
# - "src/**/*.jsx"
10+
11+
concurrency:
12+
group: claude-review-${{ github.event.pull_request.number }}
13+
cancel-in-progress: true
1214

1315
jobs:
1416
claude-review:
1517
# Optional: Filter by PR author
1618
# if: |
1719
# github.event.pull_request.user.login == 'external-contributor' ||
18-
# github.event.pull_request.user.login == 'new-developer' ||
1920
# github.event.pull_request.author_association == 'FIRST_TIME_CONTRIBUTOR'
20-
21+
2122
runs-on: ubuntu-latest
2223
permissions:
2324
contents: read
24-
pull-requests: read
25+
pull-requests: write
2526
issues: read
2627
id-token: write
27-
28+
2829
steps:
2930
- name: Checkout repository
3031
uses: actions/checkout@v4
@@ -33,46 +34,22 @@ jobs:
3334

3435
- name: Run Claude Code Review
3536
id: claude-review
36-
uses: anthropics/claude-code-action@beta
37+
uses: anthropics/claude-code-action@v1
3738
with:
3839
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
3940

4041
# Optional: Specify model (defaults to Claude Sonnet 4, uncomment for Claude Opus 4)
4142
# model: "claude-opus-4-20250514"
42-
43-
# Direct prompt for automated review (no @claude mention needed)
44-
direct_prompt: |
43+
44+
prompt: |
4545
Please review this pull request and provide feedback on:
4646
- Code quality and best practices
4747
- Potential bugs or issues
4848
- Performance considerations
4949
- Security concerns
5050
- Test coverage
51-
52-
Be constructive and helpful in your feedback.
5351
54-
# Optional: Use sticky comments to make Claude reuse the same comment on subsequent pushes to the same PR
55-
# use_sticky_comment: true
56-
57-
# Optional: Customize review based on file types
58-
# direct_prompt: |
59-
# Review this PR focusing on:
60-
# - For TypeScript files: Type safety and proper interface usage
61-
# - For API endpoints: Security, input validation, and error handling
62-
# - For React components: Performance, accessibility, and best practices
63-
# - For tests: Coverage, edge cases, and test quality
64-
65-
# Optional: Different prompts for different authors
66-
# direct_prompt: |
67-
# ${{ github.event.pull_request.author_association == 'FIRST_TIME_CONTRIBUTOR' &&
68-
# 'Welcome! Please review this PR from a first-time contributor. Be encouraging and provide detailed explanations for any suggestions.' ||
69-
# 'Please provide a thorough code review focusing on our coding standards and best practices.' }}
70-
71-
# Optional: Add specific tools for running tests or linting
72-
# allowed_tools: "Bash(npm run test),Bash(npm run lint),Bash(npm run typecheck)"
73-
74-
# Optional: Skip review for certain conditions
75-
# if: |
76-
# !contains(github.event.pull_request.title, '[skip-review]') &&
77-
# !contains(github.event.pull_request.title, '[WIP]')
52+
Be constructive and helpful in your feedback.
7853
54+
# Reuse same comment on subsequent pushes (avoids review pile-ons)
55+
use_sticky_comment: true
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
# This action invokes claude to review a PR.
2+
# This is a generic action - you can customize, or delete in favor of the ontology review PR.
3+
# --
4+
# This github action is from the copier template in https://github.com/ai4curation/github-ai-integrations, donated by the Monarch Initiative
5+
# For more documentation, see https://ai4curation.github.io/aidocs/how-tos/set-up-github-actions/
6+
# Author: Chris Mungall (@cmungall)
7+
name: Claude Code Ontology Review
8+
9+
on:
10+
pull_request:
11+
types: [opened, synchronize]
12+
paths:
13+
- "src/ontology"
14+
15+
concurrency:
16+
group: claude-ontology-review-${{ github.event.pull_request.number }}
17+
cancel-in-progress: true
18+
19+
jobs:
20+
claude-review:
21+
runs-on: ubuntu-latest
22+
permissions:
23+
contents: read
24+
pull-requests: write
25+
issues: read
26+
id-token: write
27+
28+
steps:
29+
- name: Checkout repository
30+
uses: actions/checkout@v4
31+
with:
32+
fetch-depth: 1
33+
34+
- name: Run Claude Code Ontology Review
35+
id: claude-review
36+
uses: anthropics/claude-code-action@v1
37+
with:
38+
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
39+
40+
# Use Opus for ontology review (needs deeper reasoning)
41+
model: "claude-opus-4-1-20250805"
42+
43+
prompt: |
44+
REPO: ${{ github.repository }}
45+
PR NUMBER: ${{ github.event.pull_request.number }}
46+
47+
This PR modifies critical ontology files.
48+
49+
Review this PR against our team checklist:
50+
51+
## Issue alignment
52+
- [ ] The PR aligns with the source issue, and only closes it if all components of the issue addressed
53+
- [ ] The PR summary gives sufficient context for any decisions made, attributing them to issue authors where appropriate
54+
55+
## Ontology Metadata
56+
- [ ] PR is linked to source issue(s) via appropriate annotation property
57+
- [ ] any added definitions have provenance
58+
59+
## Identifiers and hallucinations
60+
- [ ] all identifiers are CURIEs (or URLs), with standard prefixes
61+
- [ ] I have looked up term identifiers and confirm that they denote what is intended
62+
- [ ] all PMIDs and publication references resolve to the appropriate article/title
63+
64+
## Design patterns (DPs)
65+
- [ ] any new terms conform to documented DPs for this ontology
66+
- [ ] if the term fits into a DP, then the label is constructed in a standard way (although scientific norms prevail)
67+
- [ ] if the term is compositional in nature, then it should conform to a DP, and have a relevant logical definition
68+
69+
## Definitions (if the PR adds or updates a definition)
70+
- [ ] Definitions are present for any new term
71+
- [ ] Definitions conform to the style guide for this ontology
72+
- [ ] Definitions follows genus-differentia form (while prioritizing normal scientific phrasing over awkward ontology language)
73+
- [ ] The genus of the definition is an ancestor of the term
74+
- [ ] The differentia of the definition are necessary and sufficient for distinguishing from the genus
75+
- [ ] The definition has appropriate provenance
76+
- [ ] I have looked up the provenance, and it is correct and relevant
77+
- [ ] The label, definition, and logical definition (when present) are largely consistent
78+
79+
## Relationships and logical axioms
80+
- [ ] If a logical definition is not present, then there should be at least one is_a (subClassOf) to the most precise parent term
81+
- [ ] If a logical definition is present, then there is reasonable expectation the term should classify precisely
82+
- [ ] Other relationships are present to a reasonable degree and as dictated by the general ontology stye (e.g part-ofs for anatomy)
83+
- [ ] Additional logical axioms (such as disjointness) are added as appropriate, depending on ontology style, and design patterns
84+
- [ ] Additional logical axioms make sense and do not over-constrain
85+
86+
Be constructive and helpful in your feedback.
87+
88+
# Reuse same comment on subsequent pushes (avoids review pile-ons)
89+
use_sticky_comment: true

template/.github/workflows/claude.yml

Lines changed: 7 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,15 @@ jobs:
3232

3333
- name: Install uv
3434
uses: astral-sh/setup-uv@v5
35-
35+
3636
- name: Install python tools
3737
run: |
3838
uv sync
3939
4040
- name: Run Claude Code
4141
id: claude
42-
uses: anthropics/claude-code-action@beta
43-
42+
uses: anthropics/claude-code-action@v1
43+
4444
with:
4545
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
4646
mcp_config: |
@@ -62,29 +62,13 @@ jobs:
6262
}
6363
}
6464
65-
# This is an optional setting that allows Claude to read CI results on PRs
66-
additional_permissions: |
67-
actions: read
68-
69-
# Optional: Specify model (defaults to Claude Sonnet 4, uncomment for Claude Opus 4.1)
70-
# model: "claude-opus-4-1-20250805"
71-
72-
# Optional: Customize the trigger phrase (default: @claude)
73-
# trigger_phrase: "/claude"
74-
75-
# Optional: Trigger when specific user is assigned to an issue
76-
# assignee_trigger: "claude-bot"
77-
65+
# Optional: Specify model (defaults to Claude Sonnet 4, uncomment for Claude Opus 4)
66+
# model: "claude-opus-4-20250514"
67+
7868
# Optional: Allow Claude to run specific commands
7969
allowed_tools: "Bash(*),FileEdit,Edit,MultiEdit,WebSearch,WebFetch,mcp__ols_mcp__search_all_ontologies,mcp__ols_mcp__get_terms_from_ontology"
80-
70+
8171
# Optional: Add custom instructions for Claude to customize its behavior for your project
8272
# custom_instructions: |
8373
# Follow our coding standards
8474
# Ensure all new code has tests
85-
# Use TypeScript for new files
86-
87-
# Optional: Custom environment variables for Claude
88-
# claude_env: |
89-
# NODE_ENV: test
90-

0 commit comments

Comments
 (0)