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

Author and Commiter #29

Closed
yelizariev opened this issue Jan 7, 2020 · 6 comments · Fixed by #40
Closed

Author and Commiter #29

yelizariev opened this issue Jan 7, 2020 · 6 comments · Fixed by #40

Comments

@yelizariev
Copy link
Contributor

There are two main use cases and corresponding ways to sign a commit:

Branch Style

Author=Commiter=Custom User
Example: yelizariev/git-auto-commit-action-demo-app@ac69197

PR Style

Author=Actor
Commiter=GitHub Actions
Example: yelizariev/git-auto-commit-action-demo-app@fcee21e


The questions to discuss:

  • Do we agree about described use cases? I.e. do we need another style, e.g. Author=Commiter=Github Actions
  • Do we want to support both styles in the Action?
  • If yes, how to allow both styles? What could be the configs for it (config name, default values, etc.)
@yelizariev
Copy link
Contributor Author

I suggest following solution:

  1. Add two optional action args:
    commit_author_name: "My Bot"
    commit_author_email: "bot@example.com"
  1. If the args are set, use them both for Author and Committer

  2. If the args are not set, compute author and committer depending on GITHUB_EVENT_NAME

    3.1. For pull_request:
    Keep as it works now, i.e.

       > Author=Actor
       > Commiter=GitHub Actions
    

    3.2. For push and other events:

       > Author=Commiter=GitHub Actions
    

@yelizariev
Copy link
Contributor Author

@stefanzweifel did you have a chance to check my suggestion: #29 (comment) ? After such an update, it would work the same way for pull requests by default

@stefanzweifel
Copy link
Owner

@yelizariev Sorry mate, life got in the way the last few days.

+1 for the new optional commit_author_* inputs. However, I would keep the logic around them a bit simpler.

If no value has been passed by a user, the values should be $GITHUB_ACTOR <$GITHUB_ACTOR@users.noreply.github.com> (Independent of any GitHub events).

I would also like to keep the committer to be "GitHub Actions actions@github.com". My idea behind the committer/author split was to allow users to differentiate commits which have been created by Actions.

Could you maybe describe more, why you would like to have different author/committer logic depending on GitHub events?
Or why you want to remove the differentiation between author and committer? Did that break your workflows?

@yelizariev
Copy link
Contributor Author

yelizariev commented Jan 14, 2020

Here is the explanation of my desigin.

Author=Commiter=Custom Value

The idea is to fully "brand" commit with custom "Bot" (technically, I just create another github user). Imagine there is a repo "jedi-tools" and some CI\CD bot named "R2D2". The maintainers may not want to have "Github Actions" Name\Avatar along with R2D2

vs

I understand your idea to mention "Github Actions" in the commit, but I prefer to do it explicitly in commit message. example:

👽 update translation files
Sent from Github Actions (see .github/workflows/translations.yml )

Also, the maintainer would want to hide any reference to Github Actions and use some funny commit description.

Author=Actor

This seems ok for Pull Request. Not sure about Branches. Do you know which value for GITHUB_ACTOR is used on branches? Does it refer to a one who made a push? If so, then it's ok for branches too. My first understanding was that it's the owner of the repository

@yelizariev
Copy link
Contributor Author

Adjusted suggestion

I suggest following solution:

  1. Add two optional action args:
    commit_author_name: "My Bot"
    commit_author_email: "bot@example.com"
  1. If the args are set, then

    Author = Commiter = Custom

  2. If the args are not set, then

    Author=Actor
    Commiter=GitHub Actions

@stefanzweifel
Copy link
Owner

Do you know which value for GITHUB_ACTOR is used on branches?

That is always the user which made the push.
From the docs:

The name of the person or app that initiated the workflow. For example, octocat.


I suggest following solution

Yeah, I think this is the way forward. I'm going to create a PR to implement this (hopefully over the next days).
And sorry for the dragged out discussion here in the issues. I hope I can answer questions faster/more frequent after January is over.

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

Successfully merging a pull request may close this issue.

2 participants