From d0ac2addd11ed098fdfa86566abc8d715759aaa9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B2=99=E6=BC=A0=E4=B9=8B=E5=AD=90?= <7850715+maboloshi@users.noreply.github.com> Date: Wed, 3 Jul 2024 11:09:29 +0800 Subject: [PATCH] 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 `` comment and add a note that [octokit/request-action](https://github.com/octokit/request-action) can be used. --------- Co-authored-by: Parker Brown <17183625+parkerbxyz@users.noreply.github.com> --- README.md | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 3d3060d..4e6e9ba 100644 --- a/README.md +++ b/README.md @@ -79,14 +79,14 @@ jobs: # required app-id: ${{ vars.APP_ID }} private-key: ${{ secrets.PRIVATE_KEY }} - - name: Retrieve GitHub App User ID + - name: Get GitHub App User ID id: get-user-id - run: echo "user-id=$(gh api "/users/${{ steps.generate-token.outputs.app-slug }}[bot]" --jq .id)" >> "$GITHUB_OUTPUT" + run: echo "user-id=$(gh api "/users/${{ steps.app-token.outputs.app-slug }}[bot]" --jq .id)" >> "$GITHUB_OUTPUT" env: GH_TOKEN: ${{ steps.app-token.outputs.token }} - id: committer - 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" - - run: echo "committer string is ${{steps.committer.outputs.string}}" + 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" + - run: echo "committer string is ${ {steps.committer.outputs.string }}" ``` ### Configure git CLI for an app's bot user @@ -104,14 +104,14 @@ jobs: # required app-id: ${{ vars.APP_ID }} private-key: ${{ secrets.PRIVATE_KEY }} - - name: Retrieve GitHub App User ID + - name: Get GitHub App User ID id: get-user-id - run: echo "user-id=$(gh api "/users/${{ steps.generate-token.outputs.app-slug }}[bot]" --jq .id)" >> "$GITHUB_OUTPUT" + run: echo "user-id=$(gh api "/users/${{ steps.app-token.outputs.app-slug }}[bot]" --jq .id)" >> "$GITHUB_OUTPUT" env: GH_TOKEN: ${{ steps.app-token.outputs.token }} - run: | - git config --global user.name '${{steps.app-token.outputs.app-slug}}[bot]' - git config --global user.email '${{steps.get-user-id.outputs.user-id}}+${{ steps.app-token.outputs.app-slug }}[bot]@users.noreply.github.com>' + git config --global user.name '${{ steps.app-token.outputs.app-slug }}[bot]' + git config --global user.email '${{ steps.get-user-id.outputs.user-id }}+${{ steps.app-token.outputs.app-slug }}[bot]@users.noreply.github.com>' # git commands like commit work using the bot user - run: | git add . @@ -119,8 +119,12 @@ jobs: git push ``` -The `` is the numeric user ID of the app's bot user, which can be found under `https://api.github.com/users/%5Bbot%5D`. -For example, we can check at `https://api.github.com/users/dependabot%5Bbot%5D` to see the user ID of dependabot is 49699333. +> [!TIP] +> The `` is the numeric user ID of the app's bot user, which can be found under `https://api.github.com/users/%5Bbot%5D`. +> +> For example, we can check at `https://api.github.com/users/dependabot[bot]` to see the user ID of Dependabot is 49699333. +> +> Alternatively, you can use the [octokit/request-action](https://github.com/octokit/request-action) to get the ID. ### Create a token for all repositories in the current owner's installation @@ -203,7 +207,7 @@ jobs: set-matrix: runs-on: ubuntu-latest outputs: - matrix: ${{steps.set.outputs.matrix }} + matrix: ${{ steps.set.outputs.matrix }} steps: - id: set run: echo 'matrix=[{"owner":"owner1"},{"owner":"owner2","repos":["repo1"]}]' >>"$GITHUB_OUTPUT"