https://github.com/hipstersmoothie/create-check
Create a GitHub check + annotation
https://github.com/hipstersmoothie/create-check
Last synced: 22 days ago
JSON representation
Create a GitHub check + annotation
- Host: GitHub
- URL: https://github.com/hipstersmoothie/create-check
- Owner: hipstersmoothie
- License: mit
- Created: 2019-08-19T06:32:32.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2025-04-07T19:11:45.000Z (25 days ago)
- Last Synced: 2025-04-07T20:24:39.736Z (24 days ago)
- Language: TypeScript
- Size: 226 KB
- Stars: 19
- Watchers: 1
- Forks: 5
- Open Issues: 19
-
Metadata Files:
- Readme: readme.md
- Changelog: CHANGELOG.md
- License: license
Awesome Lists containing this project
README
![]()
create-check
Create a GitHub check with annotations on a PR
## Highlights
- Detects PR number and creates check w/annotations
- Does nothing locally
- Only runs in CI environment## Install
```sh
npm install --save-dev create-check
# or
yarn add -D create-check
```## Usage
Everything is written in typescript with JSDOC comments so your editor should tell you what each option is and does.
```ts
import createCheck from 'create-check';async function main() {
await createCheck({
tool: 'stylelint',
name: 'Check Styles for Errors',
annotations: createAnnotations(results),
errorCount,
warningCount,
appId: APP_ID,
privateKey: PRIVATE_KEY,
});console.log('Created check on PR');
}main();
```## Changing GitHub URL (enterprise)
To get this package to work on github enterprise instances you will need to set the `GH_API` or `GITHUB_URL` environment variable to a url pointing towards your enterprise GitHub's API.
You may also need custom previews for some apis to work. Set the `GH_PREVIEWS` variable to a comma separated list of previews you'd like enabled.
Example:
```
GH_PREVIEWS=eye-scream-preview,machine-man-preview
```## Env Vars
This library will detect all the data it needs from the env, but sometimes a CI doesn't expose everything. The following env vars can be set:
- `REPO`
- `OWNER`## Related Libraries
- [stylelint-formatter-github](https://github.com/hipstersmoothie/stylelint-formatter-github) - See stylelint errors and warnings directly in pull requests
- [eslint-formatter-github](https://github.com/hipstersmoothie/eslint-formatter-github) - See eslint errors and warnings directly in pull requests
- [jest-github-reporter](https://github.com/hipstersmoothie/jest-github-reporter) - Report jest test errors directly in pull requests