Skip to content

Commit 11d8a78

Browse files
authored
fix(workflow): Fix permission issue with github app and PR draft graphql endpoint (#5887)
### Description There's a bug/limitation with the convertPullRequestToDraft GraphQL endpoint that does not allow GitHub app to access it, even with pull-request:write the workaround is to use the github action token with write access to both content and pull request #### Issues https://linear.app/getsentry/issue/SEC-1205/github-app-graphql-limitation-with-convertpullrequesttodraft-endpoint #### Reminders
1 parent 3debca0 commit 11d8a78

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

.github/workflows/enforce-draft-pr.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ jobs:
99
name: Enforce Draft PR
1010
runs-on: ubuntu-24.04
1111
if: github.event.pull_request.draft == false
12+
permissions:
13+
pull-requests: write
14+
contents: write
1215
steps:
1316
- name: Generate GitHub App token
1417
id: app-token
@@ -19,7 +22,7 @@ jobs:
1922

2023
- name: Convert PR to draft
2124
env:
22-
GH_TOKEN: ${{ steps.app-token.outputs.token }}
25+
GH_TOKEN: ${{github.token}}
2326
PR_URL: ${{ github.event.pull_request.html_url }}
2427
run: |
2528
gh pr ready "$PR_URL" --undo

0 commit comments

Comments
 (0)