Skip to content

Commit 608bb04

Browse files
anakrishCopilot
andcommitted
fix: remove models permission, add workflow_dispatch trigger
The 'models: read' permission may not be recognized by GitHub Actions yet, potentially causing silent workflow failures. Remove it and rely on GITHUB_TOKEN's default access. Add workflow_dispatch for manual testing. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 5f810f8 commit 608bb04

1 file changed

Lines changed: 13 additions & 7 deletions

File tree

.github/workflows/perspective-review.yml

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,24 +18,30 @@ on:
1818
# but NEVER checkout the PR head — only fetch diff/files via API.
1919
pull_request_target:
2020
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
2127

2228
# Only one review per PR at a time; cancel stale runs.
2329
concurrency:
24-
group: perspective-review-${{ github.event.pull_request.number }}
30+
group: perspective-review-${{ github.event.pull_request.number || github.event.inputs.pr_number }}
2531
cancel-in-progress: true
2632

2733
permissions:
2834
contents: read
2935
pull-requests: write
30-
models: read
3136

3237
jobs:
3338
perspective-review:
3439
runs-on: ubuntu-latest
35-
# Skip draft PRs and bot PRs
40+
# Skip draft PRs and bot PRs (only for PR events)
3641
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]')
3945
4046
steps:
4147
- name: Checkout base branch only (security: never checkout PR head)
@@ -47,7 +53,7 @@ jobs:
4753
id: meta
4854
env:
4955
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 }}
5157
run: |
5258
# Get changed files
5359
gh api "repos/${{ github.repository }}/pulls/${PR_NUMBER}/files" \
@@ -254,7 +260,7 @@ jobs:
254260
- name: Post or update review comment
255261
env:
256262
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 }}
258264
run: |
259265
MARKER="<!-- perspective-review-bot -->"
260266
BODY="${MARKER}

0 commit comments

Comments
 (0)