Skip to content

Commit d0ac2ad

Browse files
docs(README): fix the git committer string and Configure git CLI examples (#151)
1. Fix the `git committer string` and `Configure git CLI` examples. 2. Formatting examples 3. Modify the get `<BOT USER ID>` comment and add a note that [octokit/request-action](https://github.com/octokit/request-action) can be used. --------- Co-authored-by: Parker Brown <[email protected]>
1 parent 040c259 commit d0ac2ad

File tree

1 file changed

+15
-11
lines changed

1 file changed

+15
-11
lines changed

README.md

+15-11
Original file line numberDiff line numberDiff line change
@@ -79,14 +79,14 @@ jobs:
7979
# required
8080
app-id: ${{ vars.APP_ID }}
8181
private-key: ${{ secrets.PRIVATE_KEY }}
82-
- name: Retrieve GitHub App User ID
82+
- name: Get GitHub App User ID
8383
id: get-user-id
84-
run: echo "user-id=$(gh api "/users/${{ steps.generate-token.outputs.app-slug }}[bot]" --jq .id)" >> "$GITHUB_OUTPUT"
84+
run: echo "user-id=$(gh api "/users/${{ steps.app-token.outputs.app-slug }}[bot]" --jq .id)" >> "$GITHUB_OUTPUT"
8585
env:
8686
GH_TOKEN: ${{ steps.app-token.outputs.token }}
8787
- id: committer
88-
run: echo "string=${{steps.app-token.outputs.app-slug}}[bot] <${{steps.get-user-id.outputs.user-id}}+${{ steps.app-token.outputs.app-slug }}[bot]@users.noreply.github.com>" >> "$GITHUB_OUTPUT"
89-
- run: echo "committer string is ${{steps.committer.outputs.string}}"
88+
run: echo "string=${{ steps.app-token.outputs.app-slug }}[bot] <${{ steps.get-user-id.outputs.user-id }}+${{ steps.app-token.outputs.app-slug }}[bot]@users.noreply.github.com>" >> "$GITHUB_OUTPUT"
89+
- run: echo "committer string is ${ {steps.committer.outputs.string }}"
9090
```
9191

9292
### Configure git CLI for an app's bot user
@@ -104,23 +104,27 @@ jobs:
104104
# required
105105
app-id: ${{ vars.APP_ID }}
106106
private-key: ${{ secrets.PRIVATE_KEY }}
107-
- name: Retrieve GitHub App User ID
107+
- name: Get GitHub App User ID
108108
id: get-user-id
109-
run: echo "user-id=$(gh api "/users/${{ steps.generate-token.outputs.app-slug }}[bot]" --jq .id)" >> "$GITHUB_OUTPUT"
109+
run: echo "user-id=$(gh api "/users/${{ steps.app-token.outputs.app-slug }}[bot]" --jq .id)" >> "$GITHUB_OUTPUT"
110110
env:
111111
GH_TOKEN: ${{ steps.app-token.outputs.token }}
112112
- run: |
113-
git config --global user.name '${{steps.app-token.outputs.app-slug}}[bot]'
114-
git config --global user.email '${{steps.get-user-id.outputs.user-id}}+${{ steps.app-token.outputs.app-slug }}[bot]@users.noreply.github.com>'
113+
git config --global user.name '${{ steps.app-token.outputs.app-slug }}[bot]'
114+
git config --global user.email '${{ steps.get-user-id.outputs.user-id }}+${{ steps.app-token.outputs.app-slug }}[bot]@users.noreply.github.com>'
115115
# git commands like commit work using the bot user
116116
- run: |
117117
git add .
118118
git commit -m "Auto-generated changes"
119119
git push
120120
```
121121

122-
The `<BOT USER ID>` is the numeric user ID of the app's bot user, which can be found under `https://api.github.com/users/<app-slug>%5Bbot%5D`.
123-
For example, we can check at `https://api.github.com/users/dependabot%5Bbot%5D` to see the user ID of dependabot is 49699333.
122+
> [!TIP]
123+
> The `<BOT USER ID>` is the numeric user ID of the app's bot user, which can be found under `https://api.github.com/users/<app-slug>%5Bbot%5D`.
124+
>
125+
> For example, we can check at `https://api.github.com/users/dependabot[bot]` to see the user ID of Dependabot is 49699333.
126+
>
127+
> Alternatively, you can use the [octokit/request-action](https://github.com/octokit/request-action) to get the ID.
124128

125129
### Create a token for all repositories in the current owner's installation
126130

@@ -203,7 +207,7 @@ jobs:
203207
set-matrix:
204208
runs-on: ubuntu-latest
205209
outputs:
206-
matrix: ${{steps.set.outputs.matrix }}
210+
matrix: ${{ steps.set.outputs.matrix }}
207211
steps:
208212
- id: set
209213
run: echo 'matrix=[{"owner":"owner1"},{"owner":"owner2","repos":["repo1"]}]' >>"$GITHUB_OUTPUT"

0 commit comments

Comments
 (0)