Code Monkey home page Code Monkey logo

hub-api-utils's Introduction

hub api utils

This is a collection of small utility scripts to showcase examples of automating GitHub tasks from the command-line via the hub api command.

Some available commands are:

Prerequisites:

  • hub 2.12+
  • git 1.8+
  • bash (for many scripts)
  • jq (for some scripts)
  • standard POSIX tools such as grep, awk, sed

Installation with Homebrew:

brew install hub jq

Then drop individual scripts from this repo into your $PATH and edit them or use them as you see fit.

How to contribute

I would love to accept your scripts into this repository! Please send your pull requests. The prerequisites for submission are simple:

  • Your script should do something useful or interesting with the GitHub API using the hub api command. Either REST or GraphQL APIs might be used.

  • The script should be written in one of the widespread shells such as bash or zsh, or in often-available interpreted languages such as ruby, node, or python.

  • When shelling out to other commands, please try to stick to jq and the POSIX set of command-line utilities to keep scripts portable.

  • There are no other rules. Go wild! But please note that when you do submit contributions to this repository, you are releasing your code into the public domain per LICENSE.

Tips for hub api

The GitHub REST API can be queried like so:

# The placeholders "{owner}" and "{repo}" get populated with values from the
# current git repository:
hub api 'repos/{owner}/{repo}/issues'

The response is always JSON, which can be parsed using jq in shell scripts. Alternatively, you may specify the --flat flag to have hub api output data in a line-based format.

The GraphQL API can be queried like this:

hub api graphql -f query='QUERY'

For more information/examples, see https://hub.github.com/hub-api.1.html.

hub-api-utils's People

Contributors

mislav avatar fgrehm avatar

Stargazers

Peter Abbasi 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.