Learning HubACFS Academy
Progress
0%
0 of 2020 remaining
  • 1
    Welcome & Overview5 min
  • 2
    Linux Navigation8 min
  • 3
    SSH & Persistence6 min
  • 4
    tmux Basics7 min
  • 5
    Git Essentials10 min
  • 6
    GitHub CLI8 min
    NOW
  • 7
    Agent Commands10 min
  • 8
    NTM Command Center8 min
  • 9
    NTM Prompt Palette6 min
  • 10
    The Flywheel Loop10 min
  • 11
    Keeping Updated4 min
  • 12
    UBS: Code Quality Guardrails8 min
  • 13
    Agent Mail Coordination10 min
  • 14
    CASS: Learning from History8 min
  • 15
    The Memory System8 min
  • 16
    Beads: Issue Tracking8 min
  • 17
    Safety Tools: SLB & CAAM6 min
  • 18
    The Art of Agent Direction12 min
  • 19
    Case Study: cass-memory15 min
  • 20
    Case Study: SLB12 min
Back to Home
Back
6/20
Lesson 6
8 min

GitHub CLI

Manage issues, PRs, releases, and actions

New to ACFS?

Complete the setup wizard first to get the most from these lessons.

Go to Choose Your OS
Goal

Manage GitHub issues, PRs, releases, and actions from the command line.

What Is GitHub CLI?

GitHub CLI (gh) lets you interact with GitHub directly from your terminal. No more switching between your editor and browser for common tasks.

Issues

Create, view, and close issues

Pull Requests

Create, review, and merge PRs

Releases

Create tags and releases

Actions

View and manage workflows

Note
AI agents use gh extensively for GitHub operations. Understanding these commands helps you review what agents propose.

Authentication

First, authenticate with your GitHub account:

bash
# Interactive login (recommended)
$ gh auth login
# Check your auth status
$ gh auth status
# View current user
$ gh api user --jq '.login'
Pro Tip
The interactive login will guide you through browser-based OAuth. Choose HTTPS for the git protocol unless you have SSH keys set up.

Working with Issues

List open issues
List all issues (open and closed)
View issue #123 details
Create a new issue
Close issue #123
Add a comment to issue #123
bash
# Create an issue interactively
$ gh issue create
# Create with labels and assignee
$ gh issue create \
--title "Fix login bug" \
--body "Users can't login with email" \
--label bug \
--assignee @me

Pull Requests

Create and manage pull requests without leaving your terminal:

List open pull requests
View PR #456 details
Create a PR (interactive)
Check out PR #456 locally
Merge PR #456
View PR diff
bash
# Create a PR with title and body
$ gh pr create \
--title "Add user authentication" \
--body "## Summary
Implements OAuth2 login flow.
## Test plan
- [x] Unit tests pass
- [ ] Manual testing on staging"
# Create a draft PR
$ gh pr create --draft
# Request review
$ gh pr edit 456 --add-reviewer username
# View PR checks status
$ gh pr checks 456
Pro Tip
Agents often create PRs using heredocs for the body. This format is common: --body "$(cat <<'EOF' ... EOF)"

Releases & Tags

List releases
View release details
Create a release with tag
Auto-generate notes from commits
Download release assets
bash
# Create a release with assets
$ gh release create v2.0.0 \
--title "Version 2.0.0" \
--notes "Major update with new features" \
./dist/*.zip
# Create a pre-release
$ gh release create v2.1.0-beta --prerelease
# Delete a release (be careful!)
$ gh release delete v1.0.0-test --yes

GitHub Actions

Monitor and interact with your CI/CD workflows:

List all workflows
List recent workflow runs
View run details
View run logs
Watch a run in real-time
Re-run a failed workflow
bash
# View failed runs
$ gh run list --status failure
# Trigger a workflow manually
$ gh workflow run build.yml
# Trigger with inputs
$ gh workflow run deploy.yml -f environment=staging
# View job logs for a specific job
$ gh run view 123456 --job 789 --log

Repository Operations

View current repo info
Clone a repository
Fork current repo
Create a new repository
Open repo in browser
Open issues page in browser

Direct API Access

For advanced use cases, access the GitHub API directly:

bash
# Get repo info as JSON
$ gh api repos/owner/repo
# List PR comments
$ gh api repos/owner/repo/pulls/123/comments
# Use jq to extract specific fields
$ gh api user --jq '.login, .email'
# POST to create something
$ gh api repos/owner/repo/issues \
-f title="API created issue" \
-f body="Created via gh api"
Note
Agents use gh api for operations not covered by the standard commands. Review these carefully as they have full API access.

Best Practices

Always review PR details before merging

Use gh pr view and gh pr diff to understand changes.

Use --dry-run where available

Some commands support --dry-run to preview actions.

Check workflow status before deploying

Run gh run list to ensure CI passed before releasing.

Use labels and milestones

Organize issues with --label and --milestone flags.

Review agent-created PRs carefully

Agents may create PRs automatically. Always review before merging.

Try It Now

bash
1# Check if gh is installed and authenticated
2$ gh auth status
3
4# View the current repository
5$ gh repo view
6
7# List recent issues
8$ gh issue list --limit 5
9
10# List recent PRs
11$ gh pr list --limit 5
12
13# Check recent workflow runs
14$ gh run list --limit 5

Ready to level up?

Mark complete to track your learning progress.

Previous
Git Essentials
Next
Agent Commands