Skip to content

Commit fe5c3ac

Browse files
committed
Increase token permissions, to view draft releases
Draft releases are viewable to users with write permissions on the repository. Accordingly, for a GitHub tokens for a GitHub Actions job to be able to view draft releases, it needs `contents: write`, even if (as here) it is neither changing any state associated with the release nor accessing other repository content in any way. (It does read and write the discussion, but `content` doesn't cover that.) Otherwise, attempting to view the release would have the same effect whether the release exists but is a draft, or does not exist at all. Even in testing, we do not want the job to go ahead and announce a nonexistent release, such as one that has been deleted (including deleted after the job has run but before it is re-run), into a discussion. So it can be useful to distingiush those cases.
1 parent 4c1f540 commit fe5c3ac

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -435,7 +435,7 @@ jobs:
435435
needs: [ create-release, publish-release ]
436436

437437
permissions:
438-
contents: read
438+
contents: write # Needed to distinguish unpublished (still draft) from missing releases.
439439
discussions: write
440440

441441
env:

0 commit comments

Comments
 (0)