Skip to content

Commit fd28011

Browse files
authored
docs: update procedure to configure Git (#287)
The current procedure for configuring `git` does not allow it to push commits besides the current repository, even if the app token may have access to other repositories. It also does not allow `git` to clone such a repository. This new procedure configures `gh` first and then calls `gh auth setup-git` to configure `git` so it will work for any repository that the token has access to.
1 parent 85eb8dd commit fd28011

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ jobs:
104104
# required
105105
client-id: ${{ vars.APP_CLIENT_ID }}
106106
private-key: ${{ secrets.APP_PRIVATE_KEY }}
107+
permission-contents: write
107108
- name: Get GitHub App User ID
108109
id: get-user-id
109110
run: echo "user-id=$(gh api "/users/${{ steps.app-token.outputs.app-slug }}[bot]" --jq .id)" >> "$GITHUB_OUTPUT"
@@ -112,7 +113,10 @@ jobs:
112113
- run: |
113114
git config --global user.name '${{ steps.app-token.outputs.app-slug }}[bot]'
114115
git config --global user.email '${{ steps.get-user-id.outputs.user-id }}+${{ steps.app-token.outputs.app-slug }}[bot]@users.noreply.github.com'
115-
# git commands like commit work using the bot user
116+
gh auth setup-git
117+
env:
118+
GH_TOKEN: ${{ steps.app-token.outputs.token }}
119+
# git commands like commit and push work using the bot user
116120
- run: |
117121
git add .
118122
git commit -m "Auto-generated changes"

0 commit comments

Comments
 (0)