github-checks v1.0.1
GitHub-Checks CLI
github-checks
is a small CLI tool to create and update check runs for commits on GitHub. It is designed to be used in CI/CD pipelines.
This tool uses the GitHub Check Runs REST API.
Installation
npm install -g github-checks
Alternatively, you can use npx
to run the CLI without installing it:
npx github-checks ...
Usage
There are 2 commands available:
create
- Create a new check runupdate
- Update an existing check run
Commands
Create a new check run
npx github-checks create --accessToken=<string> --owner=<string> --repo=<string> --head_sha=<string> --name=<string> --status=queued|in_progress --details_url=<string>
npx github-checks create --accessToken=<string> --owner=<string> --repo=<string> --head_sha=<string> --name=<string> --status=completed --conclusion=<string> --details_url=<string>
This command returns the
checkRunId
that you can use to update the check run:Refer to the Error Handling section for details on failure behavior.
Update an existing check run
npx github-checks update --accessToken=<string> --owner=<string> --repo=<string> --head_sha=<string> --checkRunId=<string> --name=<string> --status=queued|in_progress --details_url=<string> --output.title=<string> --output.summary=<string>
npx github-checks update --accessToken=<string> --owner=<string> --repo=<string> --head_sha=<string> --checkRunId=<string> --name=<string> --status=completed --conclusion=<string> --details_url=<string> --output.title=<string> --output.summary=<string>
If successful, the command will return the updated check run and return
success
in the terminal:Refer to the Error Handling section for details on failure behavior.
Environment Variables
Alternatively, you can just set the environment variables for the following parameters:
GITHUB_ACCESS_TOKEN=<string>
OWNER=<string>
REPO=<string>
HEAD_SHA=<string>
These environment variables will be used as default values for the CLI arguments. You can still override them by passing the arguments.
Error Handling
On failure, the CLI throws an error and exits with the status code 1
.
Resilience
If the request fails, the CLI will retry the request up to 3
times before failing.
Documentation
A detailed documentation will be available soon.