GitHub CLI
Ref¶
Usage 1: Get remote branch list¶
gh api -H "Accept: application/vnd.github.v3+json" repos/{owner}/{repo}/branches --jq ".[].name" --paginateOr, you can also set alias.
gh alias set branch 'api -H "Accept: application/vnd.github.v3+json" repos/{owner}/{repo}/branches --jq ".[].name" --paginate'
gh branchUsage 2: Get GitHub Actions workflow¶
gh api -H 'Accept: application/vnd.github.v3+json' /repos/{owner}/{repo}/actions/workflowsAnd erase the history..
gh api -H 'Accept: application/vnd.github.v3+json' /repos/{owner}/{repo}/actions/workflows | jq '.workflows[].id'
export REPOSITORY={workflow_id}
gh run list --workflow "${WORKFLOW}" --limit 50 --json databaseId,status \\n --jq '.[] | select(.status == "completed") | .databaseId' \\n | xargs -n 1 -I {} gh api -X DELETE repos/${REPOSITORY}/actions/runs/{}gh workflow view
gh workflow listor
gh workflow view --yaml
gh workflow list -aUsage 3: Other¶
gh run view