To use graphQL API for github, first you need to have installed gh cli:
gh versionFollow 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-tokenMake sure you are connected via gh cli correctly, run:
gh auth statusRun this script to get authenticated user information:
./graphql-user-info.shQueries are structured like this:
query {
JSON-OBJECT-TO-RETURN
}The restrictsPushes input field only works for organization repositories.
Mutations are structured like this:
mutation {
MUTATION-NAME(input: {MUTATION-NAME-INPUT!}) {
MUTATION-NAME-PAYLOAD
}
}