-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
revise adr to support user-name and user-email #158
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -46,12 +46,17 @@ We want to take this opportunity to make behavioral changes, from v1. This docum | |
lfs: | ||
description: 'Whether to download Git-LFS files' | ||
default: false | ||
user-name: | ||
description: 'User name to set in the local git config' | ||
user-email: | ||
description: 'User email to set in the local git config' | ||
``` | ||
|
||
Note: | ||
- `persist-credentials` is new | ||
- `path` behavior is different (refer [below](#path) for details) | ||
- `submodules` was removed (error if specified; add later if needed) | ||
- `user-name` and `user-email` are new | ||
|
||
### Fallback to GitHub API | ||
|
||
|
@@ -70,7 +75,6 @@ A post script will remove the credentials from the git config (cleanup for self- | |
Users may opt-out by specifying `persist-credentials: false` | ||
|
||
Note: | ||
- Users scripting `git commit` may need to set the username and email. The service does not provide any reasonable default value. Users can add `git config user.name <NAME>` and `git config user.email <EMAIL>`. We will document this guidance. | ||
- The auth header (stored in the repo's git config), is scoped to all of github `http.https://github.com/.extraheader` | ||
- Additional public remotes also just work. | ||
- If users want to authenticate to an additional private remote, they should provide the `token` input. | ||
|
@@ -179,6 +183,33 @@ A better solution is: | |
|
||
Given a source file path, walk up the directories until the first `.git/config` is found. Check if it matches the self repo (`url = https://github.com/OWNER/REPO`). If not, drop the source file path. | ||
|
||
|
||
### User name and email | ||
|
||
The `user-name` and `user-email` can be used to set the user name and email in the local git config. | ||
|
||
This is useful for the command `git commit`, which requires a user name and email to be configured. | ||
|
||
The example uses the GITHUB_TOKEN to push a commit to the server: | ||
|
||
```yaml | ||
jobs: | ||
my-job: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
user-name: github-actions | ||
user-email: [email protected] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am unsure off the top of my head, but is there a way in your actions file to reference the user and email on the commit being built from or the action triggering user? As I mentioned in #13 I would like to be able to amend the commit or make a new one without having different commit ownership. If not it would be awesome if these were just defaulted to that with these option here to override. Or is there a reason that is not a good idea? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On push it looks like Haven't looked at values on pull_request. I dumped the context using this: on: push
jobs:
build:
runs-on: [ubuntu-latest]
steps:
- run: |
echo "$GITHUB_CONTEXT"
env:
GITHUB_CONTEXT: ${{ toJson(github) }} I'm hesitant to add any default since it would regress folks who are setting and relying on global config user name. If we make a new major version (v3), then would be an opportunity to break compat. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Makes sense, as long as there is an easy way to achieve this! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @wesleytodd I believe you can read the context/json and set outputs in the step before using checkout. However, this seems unnecessarily complex. @ericsciple, what do you think about supporting a single There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does GitHub associate @wesleytodd Amending a commit does not change the author unless |
||
- run: | | ||
if [ ! -e generated.txt ]; then | ||
echo hello > generated.txt | ||
git add generated.txt | ||
git commit -m "generated file" | ||
git push | ||
fi | ||
``` | ||
|
||
### Port to typescript | ||
|
||
The checkout action should be a typescript action on the GitHub graph, for the following reasons: | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unclear how this will be impacted by submodules support. probably need to add to local git config for each submodule too