Give GITHUB_TOKEN permission to write during pkgdown build-and-deploy#719
Merged
gaborcsardi merged 1 commit intov2-branchfrom Apr 21, 2023
Merged
Give GITHUB_TOKEN permission to write during pkgdown build-and-deploy#719gaborcsardi merged 1 commit intov2-branchfrom
GITHUB_TOKEN permission to write during pkgdown build-and-deploy#719gaborcsardi merged 1 commit intov2-branchfrom
Conversation
Member
|
Thanks! |
|
This pull request has been automatically locked. If you believe you have found a related problem, please file a new issue and include a link to this pull request. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In February, GitHub changed the default permissions for
GITHUB_TOKENto read-only:https://github.blog/changelog/2023-02-02-github-actions-updating-the-default-github_token-permissions-to-read-only/
This doesn't impact existing organizations or repositories, which is why we (who work mostly in r-lib and tidyverse orgs) don't immediately feel the effects. But regular users, creating new repos, will, by default, have a read-only
GITHUB_TOKENin GHA.And this means our standard example pkgdown build-and-deploy workflow fails in that scenario.
Closes r-lib/usethis#1813
Closes r-lib/pkgdown#2280 (according to @maelle r-lib/usethis#1813 (comment))
Closes hadley/r-pkgs#977
The most narrowly scoped change is to give
GITHUB_TOKENpermission to write content in the workflow config, which is what this PR does. Notably this is also what is now shown in the docs for https://github.com/JamesIves/github-pages-deploy-action. More useful docs and examples are here: https://docs.github.com/en/actions/security-guides/automatic-token-authentication#modifying-the-permissions-for-the-github_tokenHere's a small example. First attempt to deploy a pkgdown site for this new package fails in the deploy step:
https://github.com/jennybc/teengecko/actions/runs/4767788243
Here's the most clear part of the log:
With the change in this PR, next attempt succeeds:
https://github.com/jennybc/teengecko/actions/runs/4767894848