Skip to content

Commit 3b927ac

Browse files
committed
error handling
1 parent 4df7db9 commit 3b927ac

1 file changed

Lines changed: 9 additions & 5 deletions

File tree

.github/workflows/update.yml

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,13 @@ jobs:
4545
- name: Trigger legacy repo to update READMEs to keep in sync
4646
if: github.ref == 'refs/heads/main'
4747
run: |
48-
export GH_GRANTS_TOKEN=${{ secrets.GH_GRANTS_TOKEN }}
49-
curl -H "Accept: application/vnd.github.everest-preview+json" \
50-
-H "Authorization: token $GH_GRANTS_TOKEN" \
51-
--request POST --data '{"event_type": "TRIGGER_UPDATE"}' \
52-
https://api.github.com/repos/getlantern/lantern/dispatches
48+
http_code=$(curl -s -o /dev/null -w '%{http_code}' \
49+
-H "Accept: application/vnd.github.everest-preview+json" \
50+
-H "Authorization: token ${{ secrets.GH_GRANTS_TOKEN }}" \
51+
--request POST --data '{"event_type": "TRIGGER_UPDATE"}' \
52+
https://api.github.com/repos/getlantern/lantern/dispatches)
53+
if ! [ "$http_code" -ge 200 ] || ! [ "$http_code" -lt 300 ]; then
54+
echo "::error::Dispatch failed with HTTP $http_code"
55+
exit 1
56+
fi
5357

0 commit comments

Comments
 (0)