Skip to content

Commit d9db8b5

Browse files
authored
chore: add a github action for setting up the bot app (#491)
1 parent 2a74dc4 commit d9db8b5

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

actions/setup-bot-token/action.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Setup app bot
2+
description: Gets a github app token and configures git with the app's user
3+
inputs:
4+
app-id:
5+
description: The app id
6+
required: true
7+
private-key:
8+
description: The app private key
9+
required: true
10+
outputs:
11+
token:
12+
description: The token to use for the GitHub App
13+
value: ${{ steps.app-token.outputs.token }}
14+
runs:
15+
using: "composite"
16+
steps:
17+
- uses: actions/create-github-app-token@v1
18+
id: app-token
19+
with:
20+
app-id: ${{ inputs.app-id }}
21+
private-key: ${{ inputs.private-key }}
22+
23+
- name: Get GitHub App User ID
24+
id: get-user-id
25+
run: echo "user-id=$(gh api "/users/${{ steps.app-token.outputs.app-slug }}[bot]" --jq .id)" >> "$GITHUB_OUTPUT"
26+
shell: bash
27+
env:
28+
GH_TOKEN: ${{ steps.app-token.outputs.token }}
29+
30+
- name: Set up Git
31+
run: |
32+
git config --global user.name '${{ steps.app-token.outputs.app-slug }}[bot]'
33+
git config --global user.email '${{ steps.get-user-id.outputs.user-id }}+${{ steps.app-token.outputs.app-slug }}[bot]@users.noreply.github.com>'
34+
shell: bash

0 commit comments

Comments
 (0)