Skip to content

chore: use correct github token #436

chore: use correct github token

chore: use correct github token #436

name: Require Garnix CI Success
on:
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
branches:
- main
merge_group:
permissions:
checks: read
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: true
jobs:
evaluate-app-status:
runs-on: ubuntu-latest
steps:
- name: Evaluate Checks
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
REPO: ${{ github.repository }}
REF: ${{ github.head_ref }}
run: |
sleep 15
status=''
while [[ $status != 'completed' ]]; do
check_suites=$(gh api \
-H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" \
"/repos/$REPO/commits/$REF/check-suites")
status=$(echo "$check_suites" | jq -r '.check_suites | .[] | select(.app.name == "Garnix CI") | .status')
sleep 15
done
conclusion=$(echo "$check_suites" | jq -r '.check_suites | .[] | select(.app.name == "Garnix CI") | .conclusion')
case "$conclusion" in
failure | timed_out | action_required | stale | startup_failure)
echo "ERROR: Garnix CI concluded with $conclusion"
exit 1
;;
*)
echo "INFO: Garnix CI concluded with $conclusion"
;;
esac