Repository navigation
Allow using ssh-key to push version while using token to publish to hvcs - #419
Merged
Merged
Conversation
Contributor
Author
|
Anyone ? |
danth
suggested changes
Apr 3, 2022
danth
left a comment
Contributor
There was a problem hiding this comment.
Please add the new option to the documentation in docs/configuration.rst.
Other than that, this looks good to me.
danth
approved these changes
Apr 13, 2022
Contributor
|
Looks like some tests need to be fixed. |
Contributor
Author
|
I'll look into it, thanks @danth |
Add ignore_token_for_push parameter that allows using the underlying git authentication mechanism for pushing a new version commit and tags while also using an specified token to upload dists
Test push_new_version with token while ignore_token_for_push is True and False
push_new_version is using GITHUB_ACTOR env var but we did not contemplate in our new tests that actually Github actions running the tests will populate that var and change the test outcome Now we control the value of that env var and test for it being present or not
sp-ricard-valverde
force-pushed
the
master
branch
from
May 25, 2022 10:37
a1d1f5f to
2ed1a77
Compare
Contributor
Author
|
Sorry for the late fix @danth. I've figured out the problem which had to do with the GITHUB_ACTOR env var set by the GH runners altering the test outcome(thus why locally the tests were ok) |
Contributor
|
One of the tests is still broken 🤔 Perhaps there is still some interference from the test environment. |
Contributor
Author
|
Hope this one works. I explicitly added the GITHUB_ACTOR env var to my test execution to emulate the runner behaviour |
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Scenario
In GH Actions I want to use a ssh Deploy Key to push changes to a protected branch because not every user's GITHUB_TOKEN is allowed to push to protected branches but Deploy Keys are.
Problematic
If I specify a
GH_TOKENsuch asGITHUB_TOKENin a GitHub Action with enough permission to publish a GitHub Release, python-semantic-releases will also use that user's token to push version and tag changes to the repository.The user running the action though might not have enough permission to push to a protected branch even if grating some degree of permission to its
GITHUB_TOKEN. Only Deploy Keys or Admin user'sGITHUB_TOKEN(or Personal Access Tokens) can.Solution
Add an option that will allow to use the token to submit GitHub Releases while will avoid using that token for pushing changes to the repository, relying on the underlying git authentication mechanism. In the case of GitHub Actions it can be combined with ssh-agent action to allow using Deploy Keys for this purpose.