Skip to content
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

fix: use of github workflow tokens - different from PATs #134

Merged
merged 2 commits into from
Jul 23, 2021

Conversation

consideRatio
Copy link
Member

@consideRatio consideRatio commented Jul 23, 2021

Closes #131 - this has bugged me a long time! I got confused by the fact that personal access tokens behaved differently from the ${{ github.token }} one can get from a github workflow.

I've tested this well manually now, actually by setting up a dummy repo and running it via SSH etc.

@consideRatio consideRatio added the bug Something isn't working label Jul 23, 2021
Comment on lines +120 to +126
if github_actor and github_token:
# this format works for a token created for a github
# workflow's job, no matter what we pass as github_actor.
return f"https://{github_actor}:{github_token}@github.com/{git_repo}"
elif github_token:
# this format works for personal access token, but
# not for a token created for a github workflow's job.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmmm... Well... If someone use a personal access token in a github workflow, will this be breaking for them? I'll investigate.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No! I've learned that a PAT works fine even if it includes some random content before: like this change could end up doing.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In other words, this is not a breaking change even if a PAT is used in a github workflow.

(I also learned that PATs are recognized by being prefixed ghp_ while the others are prefixed ghs_)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Failure to use GITHUB_TOKEN to push to gh-pages branch
2 participants