GithubHelp home page GithubHelp logo

rate-limit-action's Introduction

Check GitHub Rate Limit

This GitHub action displays detailed rate limit information of your GitHub API usage. This information includes the total limit, remaining limit, used limit, time of rate limit reset, and the time remaining until the reset.

Inputs

token

Optional The GitHub token to be used for authenticated requests. If not provided, the action will make unauthenticated requests.

sha

Optional Setting this to the built-in ${{ github.event.workflow_run.head_sha }} allows looking up the PR associated with the workflow run. This is needed if you want to post a comment with the results to the PR.

post_comment

Optional Setting this to true will post a comment to the PR with the results. This is only valid if sha is set to the built-in ${{ github.event.workflow_run.head_sha }}. Requires Content and Pull Request permissions. Defaults to false.

Usage

Add a step in your GitHub Actions workflow file that uses this action:

steps:
  - name: Check rate limit without token
    uses: wakamex/rate-limit-action@master
    with:
      token: ${{ secrets.GH_GITHUB_COM_TOKEN}}
      sha: ${{ github.event.workflow_run.head_sha }}
      post_comment: true

Token Permissions

Note the use of the GH_GITHUB_COM_TOKEN secret. This is a secret that you must create in your repository settings under /settings/secrets/actions.

What having an enabled repository secret looks like

If you want to use the post_comment feature, you must also add the following permissions to the token from New fine-grained personal access token.

  • Contents
  • Pull requests

What creating a permissive token looks like

Output

This output is printed in the action log:

Rate limit information:
Resource: core
Total limit: 60
Remaining: 50
Used: 10
The rate limit will reset at 2023-07-06 18:22:15 UTC
Time remaining until reset: 3599 seconds (59 minutes)

The remaining rate limit is printed to the test summary as well:

Test summary showing two lines listing the remaining rate limit, at the start and end of the workflow

This example called the action twice. At the beginning and end of the workflow, which allows you to see the change over the course of the workflow (note other workflows may be running at the same time, also eating into the rate limit).

If post_comment is set to true, the action will post a comment to the PR with the results as well:

Remaining rate limit posted in a PR comment

License

The scripts and documentation in this project are released under the MIT License

rate-limit-action's People

Contributors

wakamex avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.