-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Workflows: Use Gutenberg token for version bump, changelog commits #30212
Workflows: Use Gutenberg token for version bump, changelog commits #30212
Conversation
I like this plan :P |
Size Change: 0 B Total Size: 1.41 MB ℹ️ View Unchanged
|
It failed again, with a similar error 😭 : https://github.com/WordPress/gutenberg/runs/2188123299?check_suite_focus=true Note that it now says
rather than
|
I'll try bumping the |
Seems to have worked! 🎉 https://github.com/WordPress/gutenberg/runs/2188220126?check_suite_focus=true |
Nice, awesome work @ockham. |
Description
When @gziolo attempted running the release workflow to create the 10.3.0 RC earlier today, the workflow errored:
After a short discussion in #core-editor, @youknowriad, Grzegorz, and I concluded that the problem is probably that we're protecting
trunk
against direct pushes from anyone, except for members of thegutenberg-core
team. (I probably didn't catch this error while developing the new workflow (#28138) since I was testing it in my personal fork, where I didn't have branch protection fortrunk
enabled.)In our GitHub Actions (GHA) workflows however, we're using the default
GITHUB_TOKEN
provided by GitHub for some default permissions for a given repository. Those permissions do not include pushing to a protected branch. In fact, there are a number of github.community threads (e.g.) asking for that behavior to be allowed -- so far to no avail. The suggested workaround is to create a Personal Access Token for a user that has those permissions, store it in a (repository-level) secret, and use that in GHA workflows in order to vest them with those permissions.Since we don't want to couple that Personal Access Token (PAT) with any one individual, I've created a new GitHub user account , added it to the
WordPress/gutenberg
repo, added it to the list of users and teams that are allowed to push totrunk
, and created a new PAT that we can use in our workflows.I've then created a repository-level secret called
GUTENBERG_TOKEN
, and set it to that PAT.The final step is then to use this token in any of our GHA jobs that attempt to push to
trunk
. It should be sufficient to pass them astoken
argument to theactions/checkout
action, since it's then persisted it the local git config (and used for allgit
commands run by the job 🤞 ), and only destroyed after the job ends.How has this been tested?
We could test this by running it in a fork again, this time enabling branch protection for
trunk
. Furthermore, we'd need to add an repository-level secret calledGUTENBERG_TOKEN
that contains a Personal Access Token.Or maybe we'll just merge this, delete the
release/10.3
branch, and try kicking off the release process again 😬 Worst thing that happens is that we create anotherrelease/10.3
branch with another version bump commit before the workflow chokes 🤷♂️