[Test] - PR to Check github rate limit #6228
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: "CLA Assistant" | |
on: | |
# issue_comment triggers this action on each comment on issues and pull requests | |
issue_comment: | |
types: [ created ] | |
pull_request_target: | |
types: [ opened, synchronize ] | |
push: | |
jobs: | |
CLAssistant: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Make API Request and Check Rate Limit | |
run: | | |
RESPONSE_HEADERS=$(curl -I -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" https://api.github.com/rate_limit) | |
LIMIT=$(echo "$RESPONSE_HEADERS" | grep -i "X-RateLimit-Limit" | awk '{print $2}') | |
REMAINING=$(echo "$RESPONSE_HEADERS" | grep -i "X-RateLimit-Remaining" | awk '{print $2}') | |
RESET=$(echo "$RESPONSE_HEADERS" | grep -i "X-RateLimit-Reset" | awk '{print $2}') | |
echo "Rate Limit: $LIMIT" | |
echo "Remaining Requests: $REMAINING" | |
# Check if the remaining value is a number before comparing | |
if [[ "$REMAINING" =~ ^[0-9]+$ && "$REMAINING" -eq 0 ]]; then | |
RESET_DATE=$(date -d @"$RESET") | |
echo "Rate limit exceeded. Resets at: $RESET_DATE" | |
exit 1 | |
fi | |
- name: Run CLA Check | |
uses: jfrog/.github/actions/cla@main | |
with: | |
event_comment_body: ${{ github.event.comment.body }} | |
event_name: ${{ github.event_name }} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
CLA_SIGN_TOKEN: ${{ secrets.CLA_SIGN_TOKEN }} |