Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/taskworld/commit-status
A simple CLI tool to post status to GitHub
https://github.com/taskworld/commit-status
cli github nodejs
Last synced: about 2 months ago
JSON representation
A simple CLI tool to post status to GitHub
- Host: GitHub
- URL: https://github.com/taskworld/commit-status
- Owner: taskworld
- Archived: true
- Created: 2015-08-19T07:38:11.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2018-07-26T08:53:50.000Z (about 6 years ago)
- Last Synced: 2024-07-09T07:36:02.049Z (2 months ago)
- Topics: cli, github, nodejs
- Language: JavaScript
- Homepage:
- Size: 23.4 KB
- Stars: 25
- Watchers: 10
- Forks: 5
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# commit-status
A simple CLI tool to post [commit statuses](https://developer.github.com/v3/repos/statuses/) to GitHub from CI.
Supports CircleCI, Travis CI, and Codeship.## About
At Taskworld, we want to have fine-grain status report for each commit.
This is a perfect use case for GitHub’s commit status API.## Usage
### Configure CI to expose GitHub access token
`commit-status` will look for GitHub access from these environment variables, in this order:
- `GH_STATUS_TOKEN`
- `GH_TOKEN`That token should have `repo:status` scope.
You can create a bot account and obtain a token at https://github.com/settings/tokens/new.
### Use with GitHub Enterprise
If you use GitHub Enterprise, then you can override the API endpoint by `GITHUB_API` environment variable.
```sh
env GITHUB_API=https://[hostname]/api/v3 commit-message ...
```## CLI
### Install
Inside your CI deps script, install `commit-status` there:
```
npm install -g commit-status
```### Post commit status
Whenever you want to post a commit status from CI, invoke the command:
```
commit-status []
```- `state` — Either `pending`, `success`, `error`, `failure`
- `context` — “A string label to differentiate this status from the status of other systems.”
- `description` — “A short description of the status.”
- `url` — The URL to display.Example CircleCI setup:
```yaml
- |
if gulp lint
then commit-status success lint/eslint "Linting successful."
else commit-status failure lint/eslint "There are lint errors."
fi
```## API
```js
const commitStatus = require('commit-status')commitStatus.post({
state: 'success',
context: 'lint/eslint',
description: 'Linting successful.'
})
```