Search code examples
gitgithubgithub-actions

Change display name for GitHub Actions Bot commit


how can I change the display name for the GitHub Actions bot on a commit?

Currently I am using this workflow git parameters:

- name: Configure Git
  run: |
    git config --local user.email "github-actions[bot]@users.noreply.github.com"
    git config --local user.name "GitHub Actions [Bot]"
          
- name: Commit files
  run: |
    git add ${{github.workspace}}/lib/bin/*
    git diff-index --quiet HEAD || git commit --author="GitHub Actions [Bot] <github-actions[bot]@users.noreply.github.com>" -m "Commited compiled binaries"

The result looks something like this:

enter image description here

github-actions[bot] Commited compiled binaries

But I want a result like this, like I specified in the config...:

GitHub Actions [Bot] Commited compiled binaries

Is this even possible to change the display name?


Solution

  • Yes, it is possible and technically you're doing it right (the --author option for git-commit(1) looks superfluous), but github-actions[bot]@users.noreply.github.com is a known email to Github, henceforth the email-to-user translation on Microsoft Github is in effect and the username / avatar is used.

    Use a different emailaddress and you can choose the name to display and as long as the email is unknown to Microsoft Github, that name will be used instead of the username and the avatar is blanked.

    The git history is not affected by this, it is only the display of the commits on github.com via HTTP in the hypertext interface.