Code Monkey home page Code Monkey logo

commit-status's Introduction

commit-status

A simple CLI tool to post commit statuses to GitHub from CI.

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.

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> <context> <description> [<url>]
  • 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:

    - |
      if gulp lint
      then commit-status success lint/eslint "Linting successful."
      else commit-status failure lint/eslint "There are lint errors."
      fi

API

const commitStatus = require('commit-status')

commitStatus.post({
  state: 'success',
  context: 'lint/eslint',
  description: 'Linting successful.'
})

commit-status's People

Contributors

dtinth avatar

Watchers

Yoshiya Hinosawa avatar James Cloos avatar  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.