GitHub

From Dogtag
Jump to: navigation, search

Installation

$ dnf config-manager --add-repo https://cli.github.com/packages/rpm/gh-cli.repo
$ dnf install gh

Authentication

To authenticate, get a personal access token, then execute:

$ echo <token> | gh auth login --with-token

To verify the authentication:

$ gh auth status
github.com
  ✓ Logged in to github.com as <username> (<home>/.config/gh/hosts.yml)
  ✓ Git operations for github.com configured to use https protocol.
  ✓ Token: *******************

Workflows

To list workflows and their IDs:

$ gh api -X GET /repos/<owner>/<repo>/actions/workflows | jq '.workflows[] | .name,.id'

To list workflow runs:

$ gh api -X GET /repos/<owner>/<repo>/actions/workflows/<id>/runs | jq '.workflow_runs[] | .id'

To delete workflow runs:

$ gh api -X GET /repos/<owner>/<repo>/actions/workflows/<id>/runs | jq '.workflow_runs[] | .id' | xargs -I{} gh api -X DELETE /repos/<owner>/<repo>/actions/runs/{}

REST API

Creating a release

POST /repos/:owner/:repo/releases

Uploading an asset

POST https://<upload_url>/repos/:owner/:repo/releases/:id/assets?name=foo.zip

Deleting an asset

DELETE /repos/:owner/:repo/releases/assets/:id

Java API

See:

Installation

$ dnf install eclipse-egit-github

CLI

Installation

$ dnf install rubygems rubygem-json
$ gem install github_cli

Authentication

$ gcli init
$ gcli config user.login '...'
$ gcli config user.password '...'

See Also