GitHub CLI 2 cheatsheet

GitHub CLI 2: Actions and releases

9 common GitHub CLI 2 tasks.

List workflow runs

Show recent runs of your workflows.

gh run list

Watch a run

Follow a run until it finishes. Choose the run from a list.

gh run watch

See why a run failed

Print the logs of the failed steps of a run.

gh run view 123456789 --log-failed

Re-run failed jobs

Re-run only the jobs that failed.

gh run rerun 123456789 --failed

Trigger a workflow

Start a workflow that has a workflow_dispatch trigger.

gh workflow run deploy.yml --ref main

Create a release

Create a release for a tag with generated notes.

gh release create v1.0.0 --generate-notes

Set a repository secret

Store a secret for GitHub Actions. You are prompted for the value.

gh secret set API_KEY

Call the GitHub API

Make an authenticated API request. {owner} and {repo} are filled in from the current repository.

gh api repos/{owner}/{repo}/issues

Create a shortcut

Define an alias, here for listing your open PRs.

gh alias set mine 'pr list --author @me'

Was this page helpful?