-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Set git user and email #13
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
Comments
@chrispat for feedback. |
This would be useful for users willing to update |
This was actually my first use case for this! https://github.com/pkgjs/gh-pages/blob/master/entrypoint.sh#L4-L5 |
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 https://github.com/fregante/setup-git-user steps:
- uses: actions/checkout@v2
- uses: fregante/setup-git-user@v1 Old actionI 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 - uses: fregante/setup-git-token@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
name: The Bot
email: bot@example.com |
@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 |
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 |
@wesleytodd, see: 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 |
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? |
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. |
No, that does not stop git from complaining. You still have to |
+1 i didnt realize the built-in GITHUB_TOKEN has push permission... i'll open an adr shortly... |
ADR: #158 |
Also note, in the interim it looks like |
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.
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.) |
@JojOatXGME - I don't know exactly where the user from your Searching GH for this shows there are currently over 7k+ workflows using this action, so it's also possible that there is a lot of 'copy&paste' workflow creation going on (I've done this myself, several times..) -> https://github.com/search?q=git+config+local+user.email+action%40github.com&type=code No matter, thank you very much for the breakdown - an internet search landed me on this issue and your comment was exactly what I was looking for! I think this issue conversation, along with the "GitHub Actions bot email address?" conversation in the community forum is enough information for folks to figure out how to get the information needed to have the commit author show nicely on the GitHub interface. All that to say, I would also love to see this feature request implemented, as it would be nice for GitHub workflow authors. |
See the differences between these two 'users' here: actions/checkout#13 (comment) As well as some investigation here: https://github.community/t/github-actions-bot-email-address/17204 Also changing the `default` in the docs to reflect the actual default specified in the `actions.yml` file.
A quick hack that might be fragile, but also Just Might Work for most cases:
per the docs
So, in short: |
see actions/checkout#13 (comment) also update the actions to non-deprecated versions
# Objective While playing with the code, I found some problems in the recently merged version-bumping workflow: - Most importantly, now that we are using `0.8.0-dev` in development, the workflow will try to bump it to `0.9.0` 😭 - The crate filter is outdated now that we have more crates in `tools`. - We are using `bevy@users.noreply.github.com`, but according to [Github help](https://docs.github.com/en/account-and-profile/setting-up-and-managing-your-personal-account-on-github/managing-email-preferences/setting-your-commit-email-address#about-commit-email-addresses), that email address means "old no-reply email format for the user `bevy`". It is currently not associated with any account, but I feel this is still not appropriate here. ## Solution - Create a new workflow, `Post-release version bump`, that should be run after a release and bumps version from `0.X.0` to `0.X+1.0-dev`. Unfortunately, cargo-release doesn't have a builtin way to do this, so we need to parse and increment the version manually. - Add the new crates in `tools` to exclusion list. Also removes the dependency version specifier from `bevy_ecs_compile_fail_tests`. It is not in the workspace so the dependency version will not get automatically updated by cargo-release. - Change the author email to `41898282+github-actions[bot]@users.noreply.github.com`. According to the discussion [here](actions/checkout#13 (comment)) and [here](https://github.community/t/github-actions-bot-email-address/17204/6), this is the email address associated with the github-actions bot account. - Also add the workflows to our release checklist. See infmagic2047#5 and infmagic2047#6 for examples of release and post-release PRs.
# Objective While playing with the code, I found some problems in the recently merged version-bumping workflow: - Most importantly, now that we are using `0.8.0-dev` in development, the workflow will try to bump it to `0.9.0` 😭 - The crate filter is outdated now that we have more crates in `tools`. - We are using `bevy@users.noreply.github.com`, but according to [Github help](https://docs.github.com/en/account-and-profile/setting-up-and-managing-your-personal-account-on-github/managing-email-preferences/setting-your-commit-email-address#about-commit-email-addresses), that email address means "old no-reply email format for the user `bevy`". It is currently not associated with any account, but I feel this is still not appropriate here. ## Solution - Create a new workflow, `Post-release version bump`, that should be run after a release and bumps version from `0.X.0` to `0.X+1.0-dev`. Unfortunately, cargo-release doesn't have a builtin way to do this, so we need to parse and increment the version manually. - Add the new crates in `tools` to exclusion list. Also removes the dependency version specifier from `bevy_ecs_compile_fail_tests`. It is not in the workspace so the dependency version will not get automatically updated by cargo-release. - Change the author email to `41898282+github-actions[bot]@users.noreply.github.com`. According to the discussion [here](actions/checkout#13 (comment)) and [here](https://github.community/t/github-actions-bot-email-address/17204/6), this is the email address associated with the github-actions bot account. - Also add the workflows to our release checklist. See infmagic2047#5 and infmagic2047#6 for examples of release and post-release PRs.
sagemathgh-36243: ⬆️ Bump actions/checkout from 3 to 4 Bumps [actions/checkout](https://github.com/actions/checkout) from 3 to 4. <details> <summary>Release notes</summary> <p><em>Sourced from <a href="https://github.com/actions/checkout/releases">actions/checkout's releases</a>.</em></p> <blockquote> <h2>v4.0.0</h2> <h2>What's Changed</h2> <ul> <li>Update default runtime to node20 by <a href="https://github.com/takost"><code>@takost</code></a> in <a href="h ttps://redirect.github.com/actions/checkout/pull/1436">actions/checkout# 1436</a></li> <li>Support fetching without the --progress option by <a href="https://github.com/simonbaird"><code>@simonbaird</code></a> in <a href="https://redirect.github.com/actions/checkout/pull/1067">actions/ch eckout#1067</a></li> <li>Release 4.0.0 by <a href="https://github.com/takost"><code>@takost</code></a> in <a href="h ttps://redirect.github.com/actions/checkout/pull/1447">actions/checkout# 1447</a></li> </ul> <h2>New Contributors</h2> <ul> <li><a href="https://github.com/takost"><code>@takost</code></a> made their first contribution in <a href="https://redirect.github.com/actions /checkout/pull/1436">actions/checkout#1436</a></li> <li><a href="https://github.com/simonbaird"><code>@simonbaird</code></a> made their first contribution in <a href="https://redirect.github.com/actions /checkout/pull/1067">actions/checkout#1067</a></li> </ul> <p><strong>Full Changelog</strong>: <a href="https://github.com/actions/ checkout/compare/v3...v4.0.0">https://github.com/actions/checkout/compar e/v3...v4.0.0</a></p> <h2>v3.6.0</h2> <h2>What's Changed</h2> <ul> <li>Mark test scripts with Bash'isms to be run via Bash by <a href="https://github.com/dscho"><code>@dscho</code></a> in <a href="htt ps://redirect.github.com/actions/checkout/pull/1377">actions/checkout#13 77</a></li> <li>Add option to fetch tags even if fetch-depth > 0 by <a href="http s://github.com/RobertWieczoreck"><code>@RobertWieczoreck</code></a> in <a href="https://redirect.github.com/actions/checkout/pull/579">actions/ checkout#579</a></li> <li>Release 3.6.0 by <a href="https://github.com/luketomlinson"><code>@luketomlinson</code></a> in <a href="https://redirect.github.com/actions/checkout/pull/1437">acti ons/checkout#1437</a></li> </ul> <h2>New Contributors</h2> <ul> <li><a href="https://github.com/RobertWieczoreck"><code>@RobertWieczore ck</code></a> made their first contribution in <a href="https://redirect .github.com/actions/checkout/pull/579">actions/checkout#579</a></li> <li><a href="https://github.com/luketomlinson"><code>@luketomlinson</code></a> made their first contribution in <a href="https://redirect.github.com/ac tions/checkout/pull/1437">actions/checkout#1437</a></li> </ul> <p><strong>Full Changelog</strong>: <a href="https://github.com/actions/ checkout/compare/v3.5.3...v3.6.0">https://github.com/actions/checkout/co mpare/v3.5.3...v3.6.0</a></p> <h2>v3.5.3</h2> <h2>What's Changed</h2> <ul> <li>Fix: Checkout Issue in self hosted runner due to faulty submodule check-ins by <a href="https://github.com/megamanics"><code>@megamanics</code></a> in <a href="https://redirect.github.com/actions/checkout/pull/1196">actions/ch eckout#1196</a></li> <li>Fix typos found by codespell by <a href="https://github.com/DimitriP apadopoulos"><code>@DimitriPapadopoulos</code></a> in <a href="https:// redirect.github.com/actions/checkout/pull/1287">actions/checkout#1287</a ></li> <li>Add support for sparse checkouts by <a href="https://github.com/dscho"><code>@dscho</code></a> and <a href="https://github.com/dfdez"><code>@dfdez</code></a> in <a href="htt ps://redirect.github.com/actions/checkout/pull/1369">actions/checkout#13 69</a></li> <li>Release v3.5.3 by <a href="https://github.com/TingluoHuang"><code>@TingluoHuang</code></a> in <a href="https://redirect.github.com/actions/checkout/pull/1376">acti ons/checkout#1376</a></li> </ul> <h2>New Contributors</h2> <ul> <li><a href="https://github.com/megamanics"><code>@megamanics</code></a> made their first contribution in <a href="https://redirect.github.com/actions /checkout/pull/1196">actions/checkout#1196</a></li> <li><a href="https://github.com/DimitriPapadopoulos"><code>@DimitriPapa dopoulos</code></a> made their first contribution in <a href="https://re direct.github.com/actions/checkout/pull/1287">actions/checkout#1287</a>< /li> <li><a href="https://github.com/dfdez"><code>@dfdez</code></a> made their first contribution in <a href="https://redirect.github.com/actions /checkout/pull/1369">actions/checkout#1369</a></li> </ul> <p><strong>Full Changelog</strong>: <a href="https://github.com/actions/ checkout/compare/v3...v3.5.3">https://github.com/actions/checkout/compar e/v3...v3.5.3</a></p> <h2>v3.5.2</h2> <h2>What's Changed</h2> <ul> <li>Fix: Use correct API url / endpoint in GHES by <a href="https://github.com/fhammerl"><code>@fhammerl</code></a> in <a hre f="https://redirect.github.com/actions/checkout/pull/1289">actions/check out#1289</a> based on <a href="https://redirect.github.com/actions/check out/issues/1286">sagemath#1286</a> by <a href="https://github.com/1newsr"><code>@1newsr</code></a></li> </ul> <p><strong>Full Changelog</strong>: <a href="https://github.com/actions/ checkout/compare/v3.5.1...v3.5.2">https://github.com/actions/checkout/co mpare/v3.5.1...v3.5.2</a></p> <h2>v3.5.1</h2> <h2>What's Changed</h2> <ul> <li>Improve checkout performance on Windows runners by upgrading <code>@actions/github</code> dependency by <a href="https://github.com/BrettDong"><code>@BrettDong</code></a> in <a h ref="https://redirect.github.com/actions/checkout/pull/1246">actions/che ckout#1246</a></li> </ul> <h2>New Contributors</h2> <ul> <li><a href="https://github.com/BrettDong"><code>@BrettDong</code></a> made their first contribution in <a href="https://redirect.github.com/ac tions/checkout/pull/1246">actions/checkout#1246</a></li> </ul> <!-- raw HTML omitted --> </blockquote> <p>... (truncated)</p> </details> <details> <summary>Changelog</summary> <p><em>Sourced from <a href="https://github.com/actions/checkout/blob/ma in/CHANGELOG.md">actions/checkout's changelog</a>.</em></p> <blockquote> <h1>Changelog</h1> <h2>v4.0.0</h2> <ul> <li><a href="https://redirect.github.com/actions/checkout/pull/1067">Support fetching without the --progress option</a></li> <li><a href="https://redirect.github.com/actions/checkout/pull/1436">Update to node20</a></li> </ul> <h2>v3.6.0</h2> <ul> <li><a href="https://redirect.github.com/actions/checkout/pull/1377">Fix: Mark test scripts with Bash'isms to be run via Bash</a></li> <li><a href="https://redirect.github.com/actions/checkout/pull/579">Add option to fetch tags even if fetch-depth > 0</a></li> </ul> <h2>v3.5.3</h2> <ul> <li><a href="https://redirect.github.com/actions/checkout/pull/1196">Fix: Checkout fail in self-hosted runners when faulty submodule are checked- in</a></li> <li><a href="https://redirect.github.com/actions/checkout/pull/1287">Fix typos found by codespell</a></li> <li><a href="https://redirect.github.com/actions/checkout/pull/1369">Add support for sparse checkouts</a></li> </ul> <h2>v3.5.2</h2> <ul> <li><a href="https://redirect.github.com/actions/checkout/pull/1289">Fix api endpoint for GHES</a></li> </ul> <h2>v3.5.1</h2> <ul> <li><a href="https://redirect.github.com/actions/checkout/pull/1246">Fix slow checkout on Windows</a></li> </ul> <h2>v3.5.0</h2> <ul> <li><a href="https://redirect.github.com/actions/checkout/pull/1237">Add new public key for known_hosts</a></li> </ul> <h2>v3.4.0</h2> <ul> <li><a href="https://redirect.github.com/actions/checkout/pull/1209">Upgrade codeql actions to v2</a></li> <li><a href="https://redirect.github.com/actions/checkout/pull/1210">Upgrade dependencies</a></li> <li><a href="https://redirect.github.com/actions/checkout/pull/1225">Upgrade <code>@actions/io</code></a></li> </ul> <h2>v3.3.0</h2> <ul> <li><a href="https://redirect.github.com/actions/checkout/pull/1045">Implement branch list using callbacks from exec function</a></li> <li><a href="https://redirect.github.com/actions/checkout/pull/1050">Add in explicit reference to private checkout options</a></li> <li>[Fix comment typos (that got added in <a href="https://redirect.gith ub.com/actions/checkout/issues/770">sagemath#770</a>)](<a href="https://redirect .github.com/actions/checkout/pull/1057">actions/checkout#1057</a>)</li> </ul> <h2>v3.2.0</h2> <ul> <li><a href="https://redirect.github.com/actions/checkout/pull/942">Add GitHub Action to perform release</a></li> <li><a href="https://redirect.github.com/actions/checkout/pull/967">Fix status badge</a></li> <li><a href="https://redirect.github.com/actions/checkout/pull/1002">Replace datadog/squid with ubuntu/squid Docker image</a></li> <li><a href="https://redirect.github.com/actions/checkout/pull/964">Wrap pipeline commands for submoduleForeach in quotes</a></li> <li><a href="https://redirect.github.com/actions/checkout/pull/1029">Update <code>@actions/io</code> to 1.1.2</a></li> <li><a href="https://redirect.github.com/actions/checkout/pull/1039">Upgrading version to 3.2.0</a></li> </ul> <h2>v3.1.0</h2> <ul> <li><a href="https://redirect.github.com/actions/checkout/pull/939">Use <code>@actions/core</code> <code>saveState</code> and <code>getState</code></a></li> <li><a href="https://redirect.github.com/actions/checkout/pull/922">Add <code>github-server-url</code> input</a></li> </ul> <h2>v3.0.2</h2> <ul> <li><a href="https://redirect.github.com/actions/checkout/pull/770">Add input <code>set-safe-directory</code></a></li> </ul> <h2>v3.0.1</h2> <!-- raw HTML omitted --> </blockquote> <p>... (truncated)</p> </details> <details> <summary>Commits</summary> <ul> <li><a href="actions/checkout@3df4ab11eba7bda6 032a0b82a6bb43b11571feac"><code>3df4ab1</code></a> Release 4.0.0 (<a hre f="https://redirect.github.com/actions/checkout/issues/1447">#1447</a>)< /li> <li><a href="actions/checkout@8b5e8b768746b503 94015010d25e690bfab9dfbc"><code>8b5e8b7</code></a> Support fetching without the --progress option (<a href="https://redirect.github.com/acti ons/checkout/issues/1067">sagemath#1067</a>)</li> <li><a href="actions/checkout@97a652b80035363d f47baee5031ec8670b8878ac"><code>97a652b</code></a> Update default runtime to node20 (<a href="https://redirect.github.com/actions/checkout sagemath/issues/1436">sagemath#1436</a>)</li> <li>See full diff in <a href="https://github.com/actions/checkout/compare/v3...v4">compare view</a></li> </ul> </details> <br /> [](https://docs.github.com/en/github/managing- security-vulnerabilities/about-dependabot-security-updates#about- compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) --- <details> <summary>Dependabot commands and options</summary> <br /> You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot show <dependency name> ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself) </details> URL: sagemath#36243 Reported by: dependabot[bot] Reviewer(s):
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? |
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. |
Bot account details from actions/checkout#13 (comment)
Apparently lots of other people would also love this to be more automatic: actions/checkout#13
While I share the sentiment above regarding correctly setting the git credentials for either the PAT or maybe 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: |
per actions/checkout#13 (comment) this is fixed
I wrote a simple action to tackle this problem once and for all https://github.com/qoomon/actions--setup-git |
per actions/checkout#13 (comment) this is fixed
Hi 👋🏽 |
While running on github-hosted runners, it's necessary to manually set up git user/email (actions/checkout#13) for the time being. The user/email used was taken from a suggestion in `actions/checkout` README: https://github.com/actions/checkout/blob/main/README.md#push-a-commit-using-the-built-in-token
While running on github-hosted runners, it's necessary to manually set up git user/email (actions/checkout#13) for the time being. The user/email used was taken from a suggestion in `actions/checkout` README: https://github.com/actions/checkout/blob/main/README.md#push-a-commit-using-the-built-in-token
While running on github-hosted runners, it's necessary to manually set up git user/email (actions/checkout#13) for the time being. The user/email used was taken from a suggestion in `actions/checkout` README: https://github.com/actions/checkout/blob/main/README.md#push-a-commit-using-the-built-in-token
While running on github-hosted runners, it's necessary to manually set up git user/email (actions/checkout#13) for the time being. The user/email used was taken from a suggestion in `actions/checkout` README: https://github.com/actions/checkout/blob/main/README.md#push-a-commit-using-the-built-in-token
It would be great if this action would also set the
email
andname
. 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.
The text was updated successfully, but these errors were encountered: