Skip to content

Commit

Permalink
First stable release of GitHub API confine.
Browse files Browse the repository at this point in the history
  • Loading branch information
MatthiasZepper committed Dec 20, 2023
2 parents d5b6f1b + 8d70a71 commit d17ea32
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
[![GitHub Super-Linter](https://github.com/actions/typescript-action/actions/workflows/linter.yml/badge.svg)](https://github.com/super-linter/super-linter)
![CI](https://github.com/actions/typescript-action/actions/workflows/ci.yml/badge.svg)

**GH API Confine** (GitHub API Quota Limiter) is a Github action step designed to help you use the GitHub API more effectively.
**GH API Confine** (GitHub API Quota Limiter) is a GitHub action step designed to help you use the GitHub API more effectively.

With **GH API Confine**, you can easily monitor your remaining GitHub API quota and act accordingly. Specify a threshold (relative or absolute) and either delay or terminate your workflow, if your quota falls below the cutoff.

Expand All @@ -18,7 +18,7 @@ Prepending API-heavy jobs with **GH API Confine** saves your precious API reques

- **Customizable action:** Define how **GH API Confine** should respond when your API quota falls below a specified threshold. Choose between three modes:
- **Peep (Observe):** Take no further action beyond checking the quota.
- **Sleep (Wait):** Delay the completion of the step until shortly after your API quota renews, maximizing the chances of successful job completion. Set the `alarm` input to limit the maximum sleep time to go easy on your Github spending.
- **Sleep (Wait):** Delay the completion of the step until shortly after your API quota renews, maximizing the chances of successful job completion. Set the `alarm` input to limit the maximum sleep time to go easy on your GitHub spending.
- **Sweep (Terminate):** Immediately terminate the workflow run to prevent further API usage if your quota is too low.

## Usage
Expand Down Expand Up @@ -51,8 +51,8 @@ jobs:
| `threshold` | The API request quota minimum. Can be given as fraction of the limit (0.2 ; 20%) or absolute number of requests (50). Percentages or decimal numbers in the open interval (0,1) are interpreted as fractions, other integers as absolute. Irrelevant if 'peep' was chosen as action. | No | 10% |
| `delay`| If 'sleep' is set as `actionToTake`, _oversleep_ the quota reset by an additional delay of `n` seconds. | No | 1 |
| `alarm`| Limit the maximum time to 'sleep' by setting an figurative alarm clock to `n` seconds. If no earlier quota reset occurs, sweep instead. | No | 1800 |
| `resource`| Monitored Github API resource: One of 'core', 'search', 'graphql', 'integration_manifest' or 'code_scanning_upload' | No | core |
| `token` | Github API token to use for the action. Defaults to your current one. | No | ${{github.token}} |
| `resource`| Monitored GitHub API resource: One of 'core', 'search', 'graphql', 'integration_manifest' or 'code_scanning_upload' | No | core |
| `token` | GitHub API token to use for the action. Defaults to your current one. | No | ${{github.token}} |

### Outputs

Expand Down
3 changes: 3 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ description:
'This action can be used to obtain the remaining Github API quota and act
accordingly.'
author: 'Matthias Zepper'
branding:
icon: "upload-cloud"
color: "gray-dark"

# Define your inputs here.
inputs:
Expand Down

0 comments on commit d17ea32

Please sign in to comment.