Skip to content

Commit fa3fd5e

Browse files
committed
Fix the AddLabel workflow permission issue
Also allow the action to be run manually by giving the pull request number.
1 parent 24d2c1f commit fa3fd5e

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

.github/workflows/AddLabel.yml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,22 +22,34 @@ on:
2222
pull_request_review:
2323
pull_request_review_comment:
2424
workflow_dispatch:
25+
inputs:
26+
pull_number:
27+
description: 'The Pull Request number to process manually'
28+
required: true
29+
type: string
2530

2631
jobs:
2732
AddPullReady:
2833
permissions:
2934
checks: read
3035
pull-requests: write
36+
issues: write
37+
contents: read
3138
runs-on: ubuntu-latest
3239

3340
steps:
3441
- uses: actions/github-script@v7
3542
with:
3643
script: |
44+
const token_status = await github.rest.rateLimit.get();
45+
console.log("X-OAuth-Scopes:", token_status.headers['x-oauth-scopes']);
3746
const owner = "google"
3847
const repo = "maxtext"
3948
let pull_number = -1
40-
if (context.payload.pull_request !== undefined) {
49+
if (context.payload.inputs && context.payload.inputs.pull_number) {
50+
pull_number = parseInt(context.payload.inputs.pull_number)
51+
console.log(`Manual trigger for PR #${pull_number}`)
52+
} else if (context.payload.pull_request !== undefined) {
4153
pull_number = context.payload.pull_request.number
4254
} else if (context.payload.workflow_run !== undefined) {
4355
if (context.payload.workflow_run.pull_requests.length === 0) {

0 commit comments

Comments
 (0)