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

REPO_ACCESS_TOKEN is not necessary #35

Closed
gr2m opened this issue Sep 19, 2019 · 2 comments

Comments

@gr2m
Copy link

commented Sep 19, 2019

Hey there,

I was just looking for an action that would allow me to create a pull request. I read that you use REPO_ACCESS_TOKEN in "order to commit", but you can in fact use GITHUB_TOKEN to push back to the repository, I did it a several times myself. You will need to configure user.email and user.name. Example:

https://github.com/octokit/routes/blob/72f18c4272acebab61e9decc99d6e2d9b40ce2a6/.github/workflows/nightly-update.yml#L21-L24

Then the trick is to prefix the token with x-access-token: in the Git URL, as I've done here:
https://github.com/octokit/routes/blob/72f18c4272acebab61e9decc99d6e2d9b40ce2a6/lib/notify-about-routes-changes.js#L42

The reason this prefix is necessary is that the GITHUB_TOKEN is in fact an installation token (GitHub Actions is basically an internal GitHub App). But you can use installation tokens for Git access. See https://developer.github.com/apps/building-github-apps/authenticating-with-github-apps/#http-based-git-access-by-an-installation

Hope that helps :)

@peter-evans

This comment has been minimized.

Copy link
Owner

commented Sep 19, 2019

This is very helpful! I will try and get it working with just GITHUB_TOKEN.

@peter-evans

This comment has been minimized.

Copy link
Owner

commented Sep 20, 2019

Made an update for this and bumped the version.
Please try peter-evans/create-pull-request@v1.2.0

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.