pockestrap

Programmer's memo

Update commit status on GitHub manually

Today, I published a simple command line tool to update commit status on GitHub. It is named git-update-commit-status.

github.com

Installation

It requires Go 1.11 or higher.

$ export GO111MODULE=on
$ go get -u github.com/pocke/git-update-commit-status

Usage

The command receives only one or two arguments.

The first argument is status. You can specify error, failure, pending, or success.

The second status is the target revision. It is optional. If you omit it, this command updates a status of HEAD.

For example:

# Update the commit status of HEAD to success
$ git update-commit-status success

# Update the commit status of some-branch-name to failure
$ git update-commit-status failure some-branch-name

Note: It uses personal access token of hub command implicitly. It does not ask you about authentication and authorization if you use hub.

Motivation

There are similar tools. For instance:

These are cool, but these didn't satisfy me. Because these are not easy to use for me. These have more features than my tool, but these are too complicated to me.

You don't need to specify a repository name if you use my tool. It is the most different point between existing tools and my tool.

# cloudposse/github-status-updater needs to specify many arguments.
$ github-status-updater -action update_state -token XXXXX -owner pocke -repo awesome-repo -ref HEAD -state success

# pocke/git-update-commit-status only needs one argument.
$ cd path/to/pocke/awesome-repo
$ git update-commit-status success

I think these existing tools are useful for machine because these are configurable.

git-update-commit-status, which is my tool, is useful for human. It is not configurable, but we don't need complicated configurations in many cases. We want to use a command line tool easily. I think it is the simplest tool to update commit status.

I don't need a Swiss Army Knife, just a knife is enough.

Documentation

https://developer.github.com/v3/repos/statuses/