更改GitHub Actions Bot提交的显示名称

huangapple go评论61阅读模式
英文:

Change display name for GitHub Actions Bot commit

问题

如何更改 GitHub Actions 机器人在提交上的显示名称?

目前,我正在使用以下工作流 Git 参数:

- name: 配置 Git
  run: |
    git config --local user.email "github-actions[bot]@users.noreply.github.com"
    git config --local user.name "GitHub Actions [Bot]"
              
- name: 提交文件
  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"    

结果看起来类似于这样:

更改GitHub Actions Bot提交的显示名称

github-actions[bot] Commited compiled binaries

但我想要的结果是这样的,就像我在配置中指定的那样:

GitHub Actions [Bot] Commited compiled binaries

是否有可能更改显示名称?

英文:

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 &quot;github-actions[bot]@users.noreply.github.com&quot;
    git config --local user.name &quot;GitHub Actions [Bot]&quot;
              
- name: Commit files
  run: |
    git add ${{github.workspace}}/lib/bin/*
    git diff-index --quiet HEAD || git commit --author=&quot;GitHub Actions [Bot] &lt;github-actions[bot]@users.noreply.github.com&gt;&quot; -m &quot;Commited compiled binaries&quot;    

The result looks something like this:

更改GitHub Actions Bot提交的显示名称

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?

答案1

得分: 0

是的,这是可能的,技术上你做得对(--author选项对于git-commit(1)看起来多余),但github-actions[bot]@users.noreply.github.com是Github已知的电子邮件,因此在Microsoft Github上进行的电子邮件到用户的转换会生效,并且将使用用户名/头像。

使用不同的电子邮件地址,你可以选择要显示的名称,只要该电子邮件对于Microsoft Github是未知的,该名称就会被用来代替用户名,并且头像将被留空。

这不会影响git的历史记录,只会影响通过HTTP在超文本界面上在github.com上显示的提交。

英文:

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.

huangapple
  • 本文由 发表于 2023年5月25日 17:23:52
  • 转载请务必保留本文链接:https://go.coder-hub.com/76330731.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定