You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It would be great if this action would also set the email and name. In order to do other git operations it is required. I am adding this to my actions to get around it:
Unfortunately I don't have access to the user email. It seems like these can come from the account in a more clean way here, but I guess I could also create my own action. Since this is so new I am not sure what the best way forward is so thought I would post here.
Reacted by Ting Sun, Josh, Frederic Barthelemy, Warren Weckesser, Dave Henderson, Jim Hester, OdysseusLives, Unai Martinez-Corral, Vitaly, Sindre Sorhus and 70 more
I recently wrote an action that sets up the user and email the @action user, so you can also push back to the repo, as long as you use the v2 of actions/checkout
So that PR is a bit hard to grok on my phone (even with the improvements in the GitHub app), but it is unclear if that sets the name and email. This issue is specifically about that need. Does that PR solve this use case indirectly?
Auth token used to fetch the repository. The token is stored in the local
git config, which enables your scripts to run authenticated git commands.
The post-job step removes the token from the git config.
default: ${{ github.token }}
It seems to me that this issue was/is about "do other (authenticated) git operations"; precisely update gh-pages (which was/is your "first use case for this"). Explicitly setting the user and email would have been an approach. Using the token to do so is just another suitable solution.
Moreover, I think it would be desirable to support optionally using deployment keys instead of tokens (be it the default or a PAT). This is because default tokens do not allow to update other repos; while PATs provide too many permissions. Nonetheless, even if keys were supported, I believe that setting the user and email would still be a side effect.
Therefore, I think that this issue should be either closed or repurposed to account for the new feature in master.
Does using a token for git auth also stop git from complaining about no user or email when committing?
Although I'm not sure about that, I believe it should. The usefulness of the feature would be very limited otherwise.
Anyway, even if it works, there is currently a bug that prevents gh-pages from being updated when the token is used: actions/toolkit#247. Hence, you might want to keep using a deployment key.
Awesome, thanks for the more clear explanation! I have never used the method I see in that PR, so one last question I have:
Does using a token for git auth also stop git from complaining about no user or email when committing?
No, that does not stop git from complaining. You still have to git config name and email. All what it does is that commits and pushes are well authenticated, but you should provide name and email before that. And yes, that limits the usefulness as @eine said.
Reacted by Wes Todd, Roger D. Winans, David J. M. Karlsen, Mustafa, Jonathan Howard and Ben Quarmby
I think this would be a nice feature. It would also lead to a more consistent appearance of commits created by GitHub Actions. I'm currently wondering which email address and username I should use for the time being.
The README.md suggests github-actions <github-actions@github.com>. However, this email is not recognized by the platform. GitHub displays the author of the commit with the generic icon and without a link.
A thread in the GitHub Support Community suggests github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>. This seems to work nicely. The author of the commit has the same icon and name as GitHub Actions everywhere else. The link goes to https://github.com/features/actions as I would expect. I'm just wondering if there is any caveat since it is not promoted in the README.md.
Most repositories I found seem to use GitHub Action <action@github.com>. I don't know where this is comming from. GitHub seems to link it to some user but clicking on the user opens a 404-page. The icon and name doesn't match what is usually shown for GitHub Actions.
If there is no caveat for the second option, I would suggest that the checkout action configures Git accordingly if none of both options is already set. (Alternatively, GitHub's runners could be updated to use this configuration.)
Reacted by Jonathan Beliën, Henrique Silvério, Keery Nie, fregante, Felix Haus, Carl Thomé, Matthew Leather, yonran, Janosh Riebesell, Jonathan Gillespie and 41 more
Reacted by Firas Regaieg
Reacted by Dr. Jan-Philip Gehrcke, Kyler Jensen, mztnnrt, Wolfgang Schnerring, Vitalii Kryvenko, Richard L. and Jesús Leganés-Combarro
Reacted by eine, Carl Thomé, Max Kravchuk, mztnnrt and Vitalii Kryvenko
I hit this again today. Wondering if there is anyone who can take a look at this and at least provide an answer for if there is some new feature for this or if this should remain as an open request?
Reacted by Brennan Kinney, Ricardo Guimarães, Kurtis Mullins, Akos B, Joffrey Bion and Luis Quiñones
The name/email should be determined by the access token used for the checkout. That way, it would be set appropriately whenever you're using the default token, a personal access token, or an app token.
Reacted by Pierre Monier, Bengt Brodersen, Dominik Sigulski, Jan Brasna, Ben Quarmby, dave-v and Bastian Zimmermann
While I share the sentiment above regarding correctly setting the git credentials for either the PAT or maybe github.actor by default, I'm surprised there's nothing set by default, like the action bot above, to save setting that gazillion times a day from workflows…
The [README.md] suggests github-actions <github-actions@github.com>. However, this email is not recognized by the platform. GitHub displays the author of the commit with the generic icon and without a link.
This has been fixed since, as running this most simple config links the bot account as below correctly. So this is now my fav syntax, not having quote stuff and remembering ids etc., just works mid-2024.
The README now shows 2.# instead though:
[A thread in the GitHub Support Community] suggests github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>. This seems to work nicely. The author of the commit has the same icon and name as GitHub Actions everywhere else. The link goes to https://github.com/features/actions as I would expect. I'm just wondering if there is any caveat since it is not promoted in the README.md.
This is now in the README as is the most complete syntax. But a little superfluous, with risks like badly escaping the \["]" characters etc. so I prefer 1.# instead.
The last one is probably not for public use like this…
Most repositories I found seem to use GitHub Action <action@github.com>. I don't know where this is comming from. GitHub seems to link it to some user but clicking on the user opens a 404-page. The icon and name doesn't match what is usually shown for GitHub Actions.
Oh that feels like some internal user used for owning the actions, or maybe running them in the past. So basically that is a valid user and is owned by GH, it's some sort of a technical account and it's better use the well known bot accounts above.
Hi 👋🏽
In case anyone is still following this issue I've done (yet another) suggestion PR #2012 (as the other ones are old and not updated after comments) which is waiting for owner's review.
I think it makes sense to have this feature included in action/checkout rather than using another action to setup the git config.
Thanks in advance
Reacted by Bengt Brodersen, Daniel Bayley, Brennan Kinney, Wes Todd and Nick Viera
Activity
TingluoHuang commentedon Aug 16, 2019
@chrispat for feedback.
eine commentedon Oct 25, 2019
This would be useful for users willing to update
gh-pageshosted on separate repos using a deployment key (e.g. https://github.com/1138-4EB/vunit/blob/migrate-to-gha/.github/workflows/push.yml#L63-L74). This is specially so, becauseGITHUB_TOKEN's scope is limited and personal access tokens are not scoped to a single target repo.wesleytodd commentedon Oct 27, 2019
This was actually my first use case for this!
https://github.com/pkgjs/gh-pages/blob/master/entrypoint.sh#L4-L5
fregante commentedon Oct 31, 2019
I recently wrote an action that sets up the user and email the @action user, so you can also push back to the repo, as long as you use the v2 of
actions/checkouthttps://github.com/fregante/setup-git-user
Old action
I recently wrote an action that sets up the user, email and token in one go, so you can also push back to the repo.https://github.com/fregante/setup-git-token
eine commentedon Dec 16, 2019
@ericsciple, should this issue be closed now that #107 is merged? It seems to be included in v2: https://github.com/actions/checkout/commits/v2
wesleytodd commentedon Dec 18, 2019
So that PR is a bit hard to grok on my phone (even with the improvements in the GitHub app), but it is unclear if that sets the
nameandemail. This issue is specifically about that need. Does that PR solve this use case indirectly?eine commentedon Dec 18, 2019
@wesleytodd, see:
checkout/action.yml
Lines 12 to 17 in 3537747
It seems to me that this issue was/is about "do other (authenticated) git operations"; precisely update gh-pages (which was/is your "first use case for this"). Explicitly setting the user and email would have been an approach. Using the token to do so is just another suitable solution.
Moreover, I think it would be desirable to support optionally using deployment keys instead of tokens (be it the default or a PAT). This is because default tokens do not allow to update other repos; while PATs provide too many permissions. Nonetheless, even if keys were supported, I believe that setting the user and email would still be a side effect.
Therefore, I think that this issue should be either closed or repurposed to account for the new feature in
master.wesleytodd commentedon Dec 19, 2019
Awesome, thanks for the more clear explanation! I have never used the method I see in that PR, so one last question I have:
Does using a token for git auth also stop git from complaining about no user or email when committing?
eine commentedon Dec 19, 2019
Although I'm not sure about that, I believe it should. The usefulness of the feature would be very limited otherwise.
Anyway, even if it works, there is currently a bug that prevents gh-pages from being updated when the token is used: actions/toolkit#247. Hence, you might want to keep using a deployment key.
HDouss commentedon Jan 28, 2020
No, that does not stop git from complaining. You still have to
git configname and email. All what it does is that commits and pushes are well authenticated, but you should provide name and email before that. And yes, that limits the usefulness as @eine said.ericsciple commentedon Feb 13, 2020
+1 i didnt realize the built-in GITHUB_TOKEN has push permission... i'll open an adr shortly...
ericsciple commentedon Feb 14, 2020
ADR: #158
ericsciple commentedon Feb 15, 2020
Also note, in the interim it looks like
GIT_AUTHOR_NAMEetc can be specifiedJojOatXGME commentedon Nov 10, 2020
I think this would be a nice feature. It would also lead to a more consistent appearance of commits created by GitHub Actions. I'm currently wondering which email address and username I should use for the time being.
github-actions <github-actions@github.com>. However, this email is not recognized by the platform. GitHub displays the author of the commit with the generic icon and without a link.github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>. This seems to work nicely. The author of the commit has the same icon and name as GitHub Actions everywhere else. The link goes to https://github.com/features/actions as I would expect. I'm just wondering if there is any caveat since it is not promoted in the README.md.GitHub Action <action@github.com>. I don't know where this is comming from. GitHub seems to link it to some user but clicking on the user opens a 404-page. The icon and name doesn't match what is usually shown for GitHub Actions.If there is no caveat for the second option, I would suggest that the checkout action configures Git accordingly if none of both options is already set. (Alternatively, GitHub's runners could be updated to use this configuration.)
21 remaining items
wesleytodd commentedon Oct 2, 2023
I hit this again today. Wondering if there is anyone who can take a look at this and at least provide an answer for if there is some new feature for this or if this should remain as an open request?
SpecLad commentedon Oct 12, 2023
The name/email should be determined by the access token used for the checkout. That way, it would be set appropriately whenever you're using the default token, a personal access token, or an app token.
ci: fix author identity unknown error
More standard git user setup
Use GHA bot user
janbrasna commentedon Jul 3, 2024
While I share the sentiment above regarding correctly setting the git credentials for either the PAT or maybe
github.actorby default, I'm surprised there's nothing set by default, like the action bot above, to save setting that gazillion times a day from workflows…BTW to update the list above:
This has been fixed since, as running this most simple config links the bot account as below correctly. So this is now my fav syntax, not having quote stuff and remembering ids etc., just works mid-2024.
The README now shows 2.# instead though:
This is now in the README as is the most complete syntax. But a little superfluous, with risks like badly escaping the \["]" characters etc. so I prefer 1.# instead.
The last one is probably not for public use like this…
Oh that feels like some internal user used for owning the actions, or maybe running them in the past. So basically that is a valid user and is owned by GH, it's some sort of a technical account and it's better use the well known bot accounts above.
TL;DR i'm running:
to avoid any quotes and escapes and whatnot, and it is attributed correctly:
simplify git user/email
qoomon commentedon Aug 2, 2024
I wrote a simple action to tackle this problem once and for all https://github.com/qoomon/actions--setup-git
simplify git user/email in CI
chouetz commentedon Dec 20, 2024
Hi 👋🏽
In case anyone is still following this issue I've done (yet another) suggestion PR #2012 (as the other ones are old and not updated after comments) which is waiting for owner's review.
I think it makes sense to have this feature included in
action/checkoutrather than using another action to setup the git config.Thanks in advance
Set up git user/email when tagging the crate release
Set up git user/email when tagging the crate release
Set up git user/email when tagging the crate release
Set up git user/email when tagging the crate release