Skip to content

Commit 1fe6678

Browse files
committed
Added rate limit check
1 parent 018d63c commit 1fe6678

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

.github/workflows/docs-build-push.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,16 @@ jobs:
8484
- name: Output variables
8585
run: |
8686
echo forked_workflow: ${{ steps.vars.outputs.forked_workflow }}
87+
- name: Check rate limit
88+
run: |
89+
RESPONSE=$(curl -s -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" https://api.github.com/rate_limit)
90+
RATE_REMAINING=$(echo "$RESPONSE" | jq -r ".rate.remaining")
91+
echo $RESPONSE
92+
if [[ "$RATE_REMAINING" -le 0 ]]; then
93+
echo "Rate limit for GitHub API has been exhausted. Failing build..."
94+
exit 1
95+
fi
96+
8797
build:
8898
needs: [checks]
8999
if: ${{ needs.checks.outputs.forked_workflow == 'false' }}

0 commit comments

Comments
 (0)