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

Improve error message when no committer configuration is available #34

Closed
josecelano opened this issue Feb 9, 2022 · 2 comments
Closed
Assignees
Labels
good first issue Good for newcomers

Comments

@josecelano
Copy link
Member

I've found a hidden "bug" (or not friendly error) after refactoring the test workflow. You need to setup the git committer identity before using the action. You can do it for example with:

git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'

if you want to use the GitHub Bot.

The error was hidden because in my local machine I have it and in the previous workflow we were using this action which set up the global user config (git_config_global: true):

- name: Import GPG key
  id: import-gpg
  uses: crazy-max/ghaction-import-gpg@v4
  with:
    gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
    passphrase: ${{ secrets.PASSPHRASE }}
    git_config_global: true
    git_user_signingkey: true
    git_commit_gpgsign: false
    fingerprint: 'BD98B3F42545FF93EFF55F7F3F39AA1432CA6AD7'

I think the action should fail if it does not find that configuration, at least for the commands that generate a commit.

what do you think @da2ce7 , @yeraydavidrodriguez ? This is the factory class from SimpleGit.

Originally posted by @josecelano in #19 (comment)

@josecelano
Copy link
Member Author

josecelano commented May 10, 2022

How to reproduce the error using only Git:

  1. Remove user and email from your global git config:
$ cat ~/.gitconfig 
[user]
	name = Your Name
	email = your@email.com
  1. Try to commit changes to a new repo with:
cd /tmp && mkdir test-identity && cd test-identity/
git init
touch a.txt
git add -A
git commit -m "add a.txt"

You will see an error like this:

Author identity unknown

*** Please tell me who you are.

Run

  git config --global user.email "you@example.com"
  git config --global user.name "Your Name"

to set your account's default identity.
Omit --global to set the identity only in this repository.

fatal: unable to auto-detect email address (got 'xxx@xxx.(none)')

@josecelano
Copy link
Member Author

Finally, we did not implement this feature because the action is showing the original Git error message which is enough. When I created the issue I thought it was being hidden.

I've just created a PR to confirm that the action shows the original Git error message.

You can see the error here: https://github.com/Nautilus-Cyberneering/git-queue/runs/6472678051?check_suite_focus=true#step:5:11

image

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

Successfully merging a pull request may close this issue.

2 participants