|
18 | 18 | # but NEVER checkout the PR head — only fetch diff/files via API. |
19 | 19 | pull_request_target: |
20 | 20 | types: [opened, synchronize] |
| 21 | + # Allow manual triggering for testing |
| 22 | + workflow_dispatch: |
| 23 | + inputs: |
| 24 | + pr_number: |
| 25 | + description: 'PR number to review' |
| 26 | + required: true |
21 | 27 |
|
22 | 28 | # Only one review per PR at a time; cancel stale runs. |
23 | 29 | concurrency: |
24 | | - group: perspective-review-${{ github.event.pull_request.number }} |
| 30 | + group: perspective-review-${{ github.event.pull_request.number || github.event.inputs.pr_number }} |
25 | 31 | cancel-in-progress: true |
26 | 32 |
|
27 | 33 | permissions: |
28 | 34 | contents: read |
29 | 35 | pull-requests: write |
30 | | - models: read |
31 | 36 |
|
32 | 37 | jobs: |
33 | 38 | perspective-review: |
34 | 39 | runs-on: ubuntu-latest |
35 | | - # Skip draft PRs and bot PRs |
| 40 | + # Skip draft PRs and bot PRs (only for PR events) |
36 | 41 | if: > |
37 | | - !github.event.pull_request.draft && |
38 | | - github.event.pull_request.user.login != 'dependabot[bot]' |
| 42 | + github.event_name == 'workflow_dispatch' || |
| 43 | + (!github.event.pull_request.draft && |
| 44 | + github.event.pull_request.user.login != 'dependabot[bot]') |
39 | 45 |
|
40 | 46 | steps: |
41 | 47 | - name: Checkout base branch only (security: never checkout PR head) |
|
47 | 53 | id: meta |
48 | 54 | env: |
49 | 55 | GH_TOKEN: ${{ github.token }} |
50 | | - PR_NUMBER: ${{ github.event.pull_request.number }} |
| 56 | + PR_NUMBER: ${{ github.event.pull_request.number || github.event.inputs.pr_number }} |
51 | 57 | run: | |
52 | 58 | # Get changed files |
53 | 59 | gh api "repos/${{ github.repository }}/pulls/${PR_NUMBER}/files" \ |
@@ -254,7 +260,7 @@ jobs: |
254 | 260 | - name: Post or update review comment |
255 | 261 | env: |
256 | 262 | GH_TOKEN: ${{ github.token }} |
257 | | - PR_NUMBER: ${{ github.event.pull_request.number }} |
| 263 | + PR_NUMBER: ${{ github.event.pull_request.number || github.event.inputs.pr_number }} |
258 | 264 | run: | |
259 | 265 | MARKER="<!-- perspective-review-bot -->" |
260 | 266 | BODY="${MARKER} |
|
0 commit comments