Skip to content

An easy way to query GitHub's GraphQL API from the command-line

License

Notifications You must be signed in to change notification settings

MichaelCurrin/github-gql-go

Repository files navigation

GitHub GraphQL Go

An easy way to query GitHub's GraphQL API from the command-line

Go CI GitHub tag License

Made with Go dependency - githubv4

A CLI tool to query the GitHub GraphQL API by acting as a wrapper on another Go package.

Sample usage

Create your GH auth token and set it on the environment.

$ export GH_TOKEN=abcdef

Run the CLI app to do a query and print results.

$ ghgql
Login: MichaelCurrin
Created at: 2016-04-30 11:19:17 +0000 UTC
Avatar URL: https://avatars.githubusercontent.com/u/18750745?s=72&u=ec21949f76c6d8f152f3d8c8f8204d86d6fceba5&v=4

Purpose

The intention for this project is:

  • Be easy to use for developers who are not familiar with Go.
  • Produce an binary executable for downloading (without needing Node or Python installed).
  • Allow use interactively in the CLI or in project pipeline to handle (such as to download GitHub data as JSON data and use it to make a site).

Limitations ⚠️

  • This project only uses fixed GQL queries. There is a request for the current user and a request for this repo. The results get printed as text.
  • Aims for future development:
    • Use a selection of .gql input file given by the user, or choose from queries known to the app. Currently using a Go object, which might be more practical anyway for types.
    • Save output as a JSON or CSV file.
  • For a more full-fledged project that has a variety GQL files and writes CSV reports for each one, see my GH Reporting Tool in Python.

Documentation

How to install and run this project locally and release it

Documentation

License

Released under MIT by @MichaelCurrin.