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

Clarify default author/user/email in readme #123

Closed
vincerubinetti opened this issue Oct 28, 2020 · 5 comments
Closed

Clarify default author/user/email in readme #123

vincerubinetti opened this issue Oct 28, 2020 · 5 comments

Comments

@vincerubinetti
Copy link

vincerubinetti commented Oct 28, 2020

Some suggestions for the readme.

Currently, this is near the top:

The default committer is "GitHub Actions actions@github.com", and the default author of the commit is "Your GitHub Username github_username@users.noreply.github.com".

Seems kinda weird to put that at the top. I recommend putting that info in the Usage section, since that's where all the other defaults are specified. Also I think the explanation of the defaults could be better.

How about something like this:

    # Optional commit user and author settings
    commit_user_name: Jane Smith # defaults to username of commit that triggered the run
    commit_user_email: jane-smith@example.org # defaults to email of commit that triggered the run
    commit_author: Jane Smith <jane-smith@example.org> # defaults to author of commit that triggered the run

Also, it seems like that maybe that's not currently how the default author settings work, but I think that's how they should work, so maybe I'll create a feature request for that.

@stefanzweifel
Copy link
Owner

Thanks for the suggestions! Always love when people have ideas to improve the documentation.

Currently, this is near the top: […]

Yeah, that line seems out of place in the README. It's an artefact from the earliest days of the Action. I will update the README shortly.

I will update the README with some of your suggestions, but the name and email of the user of the commit is by default "GitHub Actions" and "actions@github.com". This is by design.

When I developed this Action, I wanted to to make it clear to the "consumer" that the Action has been created by a bot and not by an actual human.
The README doesn't reflect this decision. I will try to add section which explains this more.

@stefanzweifel
Copy link
Owner

The README has been updated in 021e855 and 7cec9ac.

As mentioned, the current "feature" of setting different user and author stays for now.
I will close this issue now.

If you think the README can be improved or other things might be unclear, please reopen this issue, leave a comment or create a new issue.

@npanuhin
Copy link
Contributor

@stefanzweifel, can I ask a few questions regarding the commit author field:

the name and email of the user of the commit is by default "GitHub Actions" and "actions@github.com". This is by design.

When using the --amend commit option I noticed that git-auto-commit-action changes the author of the commit. For me, the change was as follows:

  • Commit made with the author: Nikita Panyuhin <n.panuhin@somemail.com>
  • After running the action that commit --amends the author of the same commit is changed to npanuhin <npanuhin@users.noreply.github.com>

Q1) Did you actually intend to change the commit author field by default? If so, it would be nice to have an option to leave the commit author field untouched)

README states the following about the committed author filed:

commit_author: Author <actions@github.com> # defaults to author of the commit that triggered the run

Q2) This section only shows Author <actions@github.com> as an example and never states that the default commit author will be username <username@users.noreply.github.com>. I find this a bit misleading, maybe we should add an actual email address somewhere in the description?

Q3) Can you clarify, what is meant by "defaults to author of the commit that triggered the run"? Because many options fall under this description (untouched, changed to username@users.noreply.github.com, changed to username@github.com, etc.)

To sum up, if a change in the commit author field by default is intended, I suggest making roughly the following change to the README:

- commit_author: Author <actions@github.com> # defaults to author of the commit that triggered the run
+ commit_author: Author <actions@github.com> # defaults to "username <username@users.noreply.github.com>", where "username" belongs to the author of the commit that triggered the run

@stefanzweifel
Copy link
Owner

@npanuhin More than happy to answer your questions.

Q1) Did you actually intend to change the commit author field by default? If so, it would be nice to have an option to leave the commit author field untouched)

It wasn't my intention, but in your described scenario, --amend changes the author of the existing commit.
--amend is a git feature and not necessarily a git-auto-commit-feature.

(There is a --reset-author option available for git which could help you here. (I've never used this before, just found it in the docs))

If you must use --amend and want to make 100% sure that the author remains the same, you would have to extract the author details in your workflow and pass the values to git-auto-commit.

Q2) This section only shows Author actions@github.com as an example and never states that the default commit author will be username username@users.noreply.github.com. I find this a bit misleading, maybe we should add an actual email address somewhere in the description?

More than happy to merge a pull request that improves the documentation around this and gives a good example.

The default commit_author value is declared in action.yml, but I agree that this is a bit too hidden.

Q3) Can you clarify, what is meant by "defaults to author of the commit that triggered the run"? Because many options fall under this description (untouched, changed to username@users.noreply.github.com, changed to username@github.com, etc.)

With "defaults to author of the commit that triggered the run" I tried to describe/explain, that the so called github.actor GitHub Actions context is used to build the commit_author values.

More information about the contexts are in the GitHub Actions docs: https://docs.github.com/en/actions/learn-github-actions/contexts

I'm more than happy to merge a PR with your proposed changes to the README.

@npanuhin
Copy link
Contributor

Thank you very much for your quick response!
I forgot to look into the code before asking a question — action.yaml does explain everything)

I will extract the committed author and add it as a parameter for git-auto-commit-action in my workflow, thanks for the tip!

I opened a PR with the previously proposed change + your tip in the example section: #315

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants