From 2744424b0ae8d9892004ae38c3ab07b2504a8818 Mon Sep 17 00:00:00 2001 From: sayantikabanik Date: Tue, 7 Jan 2025 14:23:14 +0700 Subject: [PATCH 1/2] rate limit checker --- .github/workflows/rate-limit-monitor.yml | 34 ++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 .github/workflows/rate-limit-monitor.yml diff --git a/.github/workflows/rate-limit-monitor.yml b/.github/workflows/rate-limit-monitor.yml new file mode 100644 index 00000000..0148827b --- /dev/null +++ b/.github/workflows/rate-limit-monitor.yml @@ -0,0 +1,34 @@ +name: Monitor GitHub API Rate Limit + +on: + schedule: + - cron: "0 * * * *" # Runs every hour + workflow_dispatch: # Allows manual trigger + +jobs: + check-rate-limit: + runs-on: ubuntu-latest + + steps: + - name: Check out code + uses: actions/checkout@v3 + + - name: Monitor GitHub API Rate Limit + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + echo "Fetching rate limit information..." + curl -s -H "Authorization: token $GITHUB_TOKEN" https://api.github.com/rate_limit | jq '.' + + - name: Log rate limit to file + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + curl -s -H "Authorization: token $GITHUB_TOKEN" https://api.github.com/rate_limit > rate_limit.json + echo "Rate limit logged to rate_limit.json" + + - name: Upload rate limit log (optional) + uses: actions/upload-artifact@v3 + with: + name: rate-limit-log + path: rate_limit.json From 3aef23d98a41a07f93d9b3af60e7f3769b412699 Mon Sep 17 00:00:00 2001 From: sayantikabanik Date: Tue, 7 Jan 2025 14:25:10 +0700 Subject: [PATCH 2/2] cron fix --- .github/workflows/rate-limit-monitor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/rate-limit-monitor.yml b/.github/workflows/rate-limit-monitor.yml index 0148827b..6fce853d 100644 --- a/.github/workflows/rate-limit-monitor.yml +++ b/.github/workflows/rate-limit-monitor.yml @@ -2,7 +2,7 @@ name: Monitor GitHub API Rate Limit on: schedule: - - cron: "0 * * * *" # Runs every hour + - cron: "0 0 * * *" # Runs daily at midnight workflow_dispatch: # Allows manual trigger jobs: