Skip to content

Commit c09922a

Browse files
committed
Use token for comment perm
1 parent ac35382 commit c09922a

1 file changed

Lines changed: 10 additions & 3 deletions

File tree

.github/workflows/pr-comment-sweep.yml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ concurrency:
2929
permissions:
3030
contents: read
3131
issues: write
32+
pull-requests: write
3233

3334
jobs:
3435
get-jobs:
@@ -65,12 +66,14 @@ jobs:
6566
echo "pr-number=$PR_NUMBER" >> "$GITHUB_OUTPUT"
6667
6768
- name: Reply with run link
68-
if: ${{ github.event_name == 'issue_comment' && startsWith(github.event.comment.body, '/sweep') }}
69+
if: ${{ github.event_name == 'issue_comment' && startsWith(github.event.comment.body, '/sweep') && github.repository_owner == 'InferenceMAX' }}
6970
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
71+
continue-on-error: true
7072
env:
7173
RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
7274
AUTHOR: ${{ github.event.comment.user.login }}
7375
with:
76+
github-token: ${{ github.token }}
7477
script: |
7578
const owner = context.repo.owner;
7679
const repo = context.repo.repo;
@@ -114,13 +117,15 @@ jobs:
114117
echo "generator-args=$gen_args" >> "$GITHUB_OUTPUT"
115118
116119
- name: Reply with run link (manual trigger)
117-
if: ${{ github.event_name == 'workflow_dispatch' && steps.resolve.outputs.pr-number != '' }}
120+
if: ${{ github.event_name == 'workflow_dispatch' && steps.resolve.outputs.pr-number != '' && github.repository_owner == 'InferenceMAX' }}
118121
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
122+
continue-on-error: true
119123
env:
120124
RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
121125
AUTHOR: ${{ github.actor }}
122126
ISSUE_NUMBER: ${{ steps.resolve.outputs.pr-number }}
123127
with:
128+
github-token: ${{ github.token }}
124129
script: |
125130
const owner = context.repo.owner;
126131
const repo = context.repo.repo;
@@ -131,13 +136,15 @@ jobs:
131136
await github.rest.issues.createComment({ owner, repo, issue_number, body });
132137
133138
- name: Reply with run link (push trigger)
134-
if: ${{ github.event_name == 'push' && steps.resolve.outputs.pr-number != '' }}
139+
if: ${{ github.event_name == 'push' && steps.resolve.outputs.pr-number != '' && github.repository_owner == 'InferenceMAX' }}
135140
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
141+
continue-on-error: true
136142
env:
137143
RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
138144
AUTHOR: ${{ github.actor }}
139145
ISSUE_NUMBER: ${{ steps.resolve.outputs.pr-number }}
140146
with:
147+
github-token: ${{ github.token }}
141148
script: |
142149
const owner = context.repo.owner;
143150
const repo = context.repo.repo;

0 commit comments

Comments
 (0)