Skip to content

Commit

Permalink
feat: extend output with committer information (#228)
Browse files Browse the repository at this point in the history
  • Loading branch information
WipeAir authored Jan 30, 2025
1 parent abbe3d8 commit 449d361
Showing 1 changed file with 22 additions and 3 deletions.
25 changes: 22 additions & 3 deletions actions/get-github-app-token/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ outputs:
token:
description: ""
value: ${{ steps.token.outputs.token }}
app-commiter-email:
description: ""
value: ${{ steps.get-details.outputs.committer-email }}
app-commiter-name:
description: ""
value: ${{ steps.get-details.outputs.committer-name }}
runs:
using: composite
steps:
Expand All @@ -29,7 +35,20 @@ runs:
certificate:${{ env.APP_CERTIFICATE }}
- id: token
name: "Generate token"
uses: tibdex/github-app-token@v1
uses: actions/create-github-app-token@v1
with:
app_id: ${{ steps.secrets.outputs.id }}
private_key: ${{ steps.secrets.outputs.certificate }}
app-id: ${{ steps.secrets.outputs.id }}
private-key: ${{ steps.secrets.outputs.certificate }}
- id: get-details
env:
GH_TOKEN: ${{ steps.app-token.outputs.token }}
shell: bash
run: |
# Fetch the id of the bot user.
response=$(gh api "/users/${{ steps.token.outputs.app-slug }}[bot]") >> "$GITHUB_OUTPUT"
# Extract the id of the bot user.
user_id=$(echo "$response" | jq -cr ".id")
echo "committer-email=${{ steps.token.outputs.app-slug }}[bot] <$user_id+${{ steps.app-token.outputs.app-slug }}[bot]@users.noreply.github.com>" >> "$GITHUB_OUTPUT"
echo "committer-name=${{ steps.token.outputs.app-slug }}[bot]" >> "$GITHUB_OUTPUT"

0 comments on commit 449d361

Please sign in to comment.