ci: use Github App token to authenticate (#621)

This uses the new Ansible Documentation Bot Github app to authenticate with
the Github API instead of the limited token built in to Github Actions.
The app token allows creating automatic dependency update PRs that
trigger CI properly.
A github-bot environment to store the BOT_APP_ID and BOT_APP_KEY
secrets.

Fixes: https://github.com/ansible/ansible-documentation/issues/382
This commit is contained in:
Maxwell G
2023-10-17 14:35:41 -05:00
committed by GitHub
parent 96d5929c8d
commit 1efa06b8a6
5 changed files with 36 additions and 16 deletions

14
hacking/get_bot_user.sh Executable file
View File

@@ -0,0 +1,14 @@
#!/usr/bin/bash -x
# Set Github committer to a bot user
set -euo pipefail
bot="${1}"
name="${2-${1}}"
path="https://api.github.com/users/${bot}%5Bbot%5D"
user_id="$(curl -sS "${path}" | jq -r .id)"
GIT="${GIT:-git}"
${GIT} config user.name "${name}"
${GIT} config user.email "${user_id}+${bot}@users.noreply.github.com"