Skip to content

Commit e5b4f9c

Browse files
committed
updating the github apps commit email post to include app commit signing
1 parent c0cd71b commit e5b4f9c

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

_posts/2024-11-22-github-apps-commit-email.md

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,12 @@ We can retrieve this in one of two ways:
5555
gh api '/users/josh-issueops-bot[bot]' --jq .id
5656
```
5757
58-
Once you have that, you can plug in the email address and you're good to go! 🚀
58+
This returns the ID of the user, which is `149130343`. Once you have that, you can plug it into the email address format and you're good to go! 🚀
59+
60+
> Email address format:
61+
>
62+
> - `USERID`+`APP-NAME`[bot]@users.noreply.github.com
63+
{: .prompt-tip }
5964
6065
## Committing via Git Command Line in Actions
6166
@@ -137,6 +142,18 @@ jobs:
137142
```
138143
{: file='.github/workflows/commit-with-github-app.yml'}
139144
145+
## Signing Commits from GitHub App
146+
147+
If you use the examples above using the `Git` command line, your commits will not be signed. If you want the commits from the GitHub App to be signed, we have to commit via the API by [creating a tree](https://docs.github.com/en/rest/git/trees?apiVersion=2022-11-28#create-a-tree), [creating a commit](https://docs.github.com/en/rest/git/commits?apiVersion=2022-11-28#create-a-commit), and [updating a reference](https://docs.github.com/en/rest/git/refs?apiVersion=2022-11-28#update-a-reference) to tie the tree to the commit.
148+
149+
For a detailed example, see this helpful Community Discussions post from [@loujr](https://github.com/loujr/):
150+
151+
- [How to Use Commit Signing with GitHub Apps](https://github.com/orgs/community/discussions/50055)
152+
153+
I also have an end-to-end example of using a GitHub App to sign a commit in GitHub Actions for reference:
154+
155+
- [commit-sign.yml - GitHub App commit signing example in Actions](https://github.com/joshjohanning-org/commit-sign-app/blob/main/.github/workflows/commit-sign.yml#L80-L153)
156+
140157
## Summary
141158

142-
In summary, if you are using a GitHub App to commit changes back to the repository, you will need to use the email address format of `<userID>+<app-name>[bot]@users.noreply.github.com`. This will allow the commit to be attributed to the GitHub App, and the author's icon to be the App's icon. 🤖
159+
In summary, if you are using a GitHub App to commit changes back to the repository, you will need to use the email address format of `USERID`+`APP-NAME`[bot]@users.noreply.github.com. This will allow the commit to be attributed to the GitHub App, and the author's icon to be the App's icon (or the org's icon if there is no app icon!). 🤖

0 commit comments

Comments
 (0)