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

Respect author/committer if configured in git #132

Open
jasonkarns opened this issue Dec 23, 2020 · 1 comment
Open

Respect author/committer if configured in git #132

jasonkarns opened this issue Dec 23, 2020 · 1 comment
Labels
enhancement New feature or request

Comments

@jasonkarns
Copy link

Is your feature request related to a problem? Please describe.

I'm attempting to use this action with this action: https://github.com/crazy-max/ghaction-import-gpg.
The gpg action imports gpg keys and configures git such that commits, tags, and pushes may be signed.
Because gpg signing must use the proper email address associated with the gpg key, it's important to ensure the git author/committer email address is correct.
To this end, the gpg action sets the git user information explicitly.
In other words, after the gpg action has run, git commit uses the properly configured author name and email.

A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

I'm replacing my manual git operations with this auto-commit action.
However, the auto-commit action (by default), is not respecting the author and committer information as configured in git.

Describe the solution you'd like

It's quite possible to explicitly override the default author information using this actions' parameters.
However, I think that if author information is already configured in git, that it should take precedence over this action's defaults.
Desired order of precedence for deriving authorship info:

  1. action params
  2. git user.name/user.email
  3. action defaults (actor + "GitHub Actions")

Describe alternatives you've considered

It works to explicitly set the authorship info for the action. However, this is especially redundant as it needs to match the gpg configuration precisely. Any typo or misconfiguration of the email address and the gpg signing will fail to apply (since the key won't be found for that email address). Hence, it would be preferable (and "safer") to use the authorship information as configured in git itself if set.

@stefanzweifel
Copy link
Owner

I guess this could be achieved by wrapping the current git commit and git tag code with an if-condition. We would check if git config user.email and git config user.name are already configured.
Only if those values are empty we will apply the input values given to the Action.

But the desired order of precedence you describe is basically not possible to implement. The default values get supplied through the Action Input params. The Action doesn't know if you explicitly set them in your Workflow or if they are the default values set in action.yml.
We could maybe hardcode the values in the shell script itself, but I think that would make things just more complicated down the line for me as the maintainer.

I can see the frustration you might have of repeating the user configuration for git-auto-commit. Will have to think about this a bit longer.


Would it be possible to share the portions of your workflow where you setup import-gpg and git-auto-commit? Just so that I see, how those 2 Actions work together?
We could also add an example configuration to the README. We already have a section which mentions the import-gpg Action. (https://github.com/stefanzweifel/git-auto-commit-action#signing-commits--other-git-command-line-options)

@stefanzweifel stefanzweifel added the enhancement New feature or request label Dec 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants