Skip to content

Commit a1ade8c

Browse files
authored
chore: revert per-push review trigger; drop synchronize from summary (#7)
Restores pre-9bc9666 on-demand-only behavior for the PR review caller example. 9bc9666 added auto-runs on every PR push (opened, synchronize, reopened, ready_for_review) bundled into a structured_output fix; that trigger expansion caused token-burn storms downstream — one observed PR had 14 review runs in 24h from repeated pushes, and each review fans out to 30-67 Anthropic API calls. Review now runs only on: - /review comment (optionally /review opus or /review haiku) - needs-review label Summary loses the synchronize trigger (still runs on opened/reopened/ ready_for_review) and gains paths-ignore for docs. Security hardening from 9bc9666 (env-var refactor of get-pr / get-model steps to avoid shell injection in ${{ }} interpolation) is preserved. README updated to match new trigger semantics for both workflows. Downstream callers in LiskHQ/lisk-{backend,web,mobile,infra} need the same change applied to their .github/workflows/claude-pr-*.yml files; this PR fixes the example so future copies don't reintroduce the issue.
1 parent 75442e0 commit a1ade8c

3 files changed

Lines changed: 22 additions & 21 deletions

File tree

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@ Reusable GitHub Actions workflows for Claude Code reviews. Each repo defines its
1313

1414
### 1. PR Review
1515
- **File**: `claude-pr-review.yml`
16-
- **Trigger**: Auto-runs on every PR push (open, synchronize, reopen, ready_for_review). Manual re-runs via `/review` comment or `needs-review` label; skips draft PRs and bot actors.
16+
- **Trigger**: On-demand only — `/review` comment (optionally `/review opus` or `/review haiku`) or `needs-review` label. Skips bot actors. No auto-run on push (avoids token burn from PRs with many pushes).
1717
- **Does**: Structured code review with inline comments, severity levels, focuses on bugs/security/performance
1818
- **Example**: See `examples/workflows/claude-pr-review-caller.yml`
1919

2020
### 2. PR Summary
2121
- **File**: `claude-pr-summary.yml`
22-
- **Trigger**: Auto-runs when PR opens or updates
22+
- **Trigger**: Runs on PR `opened`, `reopened`, or `ready_for_review`. Skips doc-only PRs (`**/*.md`, `docs/**`).
2323
- **Does**: Generates concise summary, updates PR description
2424
- **Example**: See `examples/workflows/claude-pr-summary-caller.yml`
2525

examples/workflows/claude-pr-review-caller.yml

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,35 @@
11
# Example: Call the reusable PR review workflow
22
# Copy this file to your repo's .github/workflows/ directory
33
#
4-
# Triggers:
5-
# Every push to a PR (opened, synchronize, reopened, ready_for_review)
6-
# /review - manual re-run (also lets you pick a model)
7-
# /review opus - manual re-run with opus
8-
# /review haiku - manual re-run with haiku
9-
# needs-review - label trigger (also re-runs)
4+
# Triggers (on-demand only — does NOT auto-run on every push):
5+
# /review - comment to run review (default sonnet)
6+
# /review opus - comment to run with opus
7+
# /review haiku - comment to run with haiku
8+
# needs-review - apply label to run review
9+
#
10+
# Rationale: auto-running on every push (synchronize) burns Anthropic
11+
# tokens proportional to PR push count. On-demand triggers keep cost
12+
# bounded to actual review requests.
1013

1114
name: Claude PR Review
1215

1316
on:
1417
pull_request:
15-
types: [opened, synchronize, reopened, ready_for_review, labeled]
18+
types: [labeled]
1619
issue_comment:
1720
types: [created]
1821

19-
# Prevent multiple runs for the same PR. cancel-in-progress means a fresh push
20-
# cancels the in-flight review and starts a new one — avoids reviewing stale SHAs.
22+
# Prevent overlapping runs for the same PR (e.g. label + comment in quick
23+
# succession). cancel-in-progress drops the older run.
2124
concurrency:
2225
group: claude-review-${{ github.event.pull_request.number || github.event.issue.number }}
2326
cancel-in-progress: true
2427

2528
jobs:
2629
check-trigger:
2730
# Run when any of:
28-
# 1. PR push/open/ready (non-draft, non-bot)
29-
# 2. PR labeled with `needs-review`
30-
# 3. PR comment contains `/review`
31+
# 1. PR labeled with `needs-review`
32+
# 2. PR comment contains `/review`
3133
# Always skip bot-authored PRs and bot comments.
3234
if: |
3335
github.actor != 'dependabot[bot]' &&
@@ -36,12 +38,8 @@ jobs:
3638
github.actor != 'github-actions[bot]' &&
3739
(
3840
(github.event_name == 'pull_request' &&
39-
github.event.pull_request.draft == false &&
40-
(github.event.action == 'opened' ||
41-
github.event.action == 'synchronize' ||
42-
github.event.action == 'reopened' ||
43-
github.event.action == 'ready_for_review' ||
44-
(github.event.action == 'labeled' && github.event.label.name == 'needs-review'))) ||
41+
github.event.action == 'labeled' &&
42+
github.event.label.name == 'needs-review') ||
4543
(github.event_name == 'issue_comment' &&
4644
github.event.issue.pull_request &&
4745
contains(github.event.comment.body, '/review'))

examples/workflows/claude-pr-summary-caller.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@ name: Claude PR Summary
55

66
on:
77
pull_request:
8-
types: [opened, synchronize, reopened, ready_for_review]
8+
types: [opened, reopened, ready_for_review]
9+
paths-ignore:
10+
- '**/*.md'
11+
- 'docs/**'
912

1013
# Prevent multiple runs for the same PR
1114
concurrency:

0 commit comments

Comments
 (0)