Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ jobs:
- run: echo "committer string is ${{ steps.committer.outputs.string }}"
```

### Configure git CLI for an app's bot user
### Configure gh/git CLI for an app's bot user

```yaml
on: [pull_request]
Expand All @@ -104,6 +104,7 @@ jobs:
# required
app-id: ${{ vars.APP_ID }}
private-key: ${{ secrets.PRIVATE_KEY }}
permission-contents: write
- name: Get GitHub App User ID
id: get-user-id
run: echo "user-id=$(gh api "/users/${{ steps.app-token.outputs.app-slug }}[bot]" --jq .id)" >> "$GITHUB_OUTPUT"
Expand All @@ -112,7 +113,9 @@ jobs:
- 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 commands like commit work using the bot user
echo "${{ steps.app-token.outputs.token }}" | gh auth login --with-token
gh auth setup-git
# git commands like commit and push work using the bot user
- run: |
git add .
git commit -m "Auto-generated changes"
Expand Down