Skip to content

Latest commit

 

History

History
56 lines (41 loc) · 1.21 KB

File metadata and controls

56 lines (41 loc) · 1.21 KB

GitHub GraphQL API

To use graphQL API for github, first you need to have installed gh cli:

gh version

Follow the instructions from that repository to install the Github CLI.

Once installed, authenticate against github, run the following command:

echo "$YOUR_GITHUB_PAT" | gh auth login --with-token

Make sure you are connected via gh cli correctly, run:

gh auth status

Run this script to get authenticated user information:

./graphql-user-info.sh

Queries

Queries are structured like this:

query {
  JSON-OBJECT-TO-RETURN
}

Notes

The restrictsPushes input field only works for organization repositories.

Mutations

Mutations are structured like this:

mutation {
  MUTATION-NAME(input: {MUTATION-NAME-INPUT!}) {
    MUTATION-NAME-PAYLOAD
  }
}

Related links