github

Guide for GitHub operations using gh CLI. For mandatory rules, see rules/github.md .

Safety Notice

This listing is imported from skills.sh public index metadata. Review upstream SKILL.md and repository scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "github" with this command: npx skills add i9wa4/dotfiles/i9wa4-dotfiles-github

GitHub Skill

Guide for GitHub operations using gh CLI. For mandatory rules, see rules/github.md .

  1. Prerequisites
  • gh CLI installed and authenticated

  • jq installed (for JSON processing)

  1. Issue Operations

2.1. Get Issue Information

gh issue view NUMBER --repo OWNER/REPO --json title,body,comments

2.2. Create Issue

gh issue create --repo OWNER/REPO --title "Title" --body "Body"

With template:

Check templates first

ls .github/ISSUE_TEMPLATE/

Create with specific template

gh issue create --template "bug_report.md"

2.3. Sub-issues (Parent-Child Relationship)

Standard gh CLI does not support sub-issues. Use the gh sub-issue extension.

Install Extension

gh extension install agbiotech/gh-sub-issue

Commands

Add sub-issue

gh sub-issue add <parent> --sub-issue-number <child>

List sub-issues

gh sub-issue list <parent>

Remove sub-issue

gh sub-issue remove <parent> --sub-issue-number <child>

  1. Pull Request Operations

3.1. Get PR Information

Basic information:

gh pr view NUMBER --repo OWNER/REPO --json title,body,author,state,baseRefName,headRefName,url

Get current branch PR number:

gh pr view --json number -q '.number'

Get latest commit SHA (required for inline comments):

gh pr view NUMBER --repo OWNER/REPO --json commits --jq '.commits[-1].oid'

3.2. Check Diff

Diff with line numbers (for identifying inline comment positions):

gh pr diff NUMBER --repo OWNER/REPO | awk ' BEGIN { old_line=0; new_line=0; in_hunk=0 } /^diff --git/ { in_hunk=0; print; next } /^---/ || /^+++/ { print; next } /^@@/ { in_hunk=1 match($0, /-([0-9]+)/, old) match($0, /+([0-9]+)/, new) old_line = old[1] new_line = new[1] print next } in_hunk && /^-/ { printf "L%-4d | %s\n", old_line++, $0; next } in_hunk && /^+/ { printf " R%-4d| %s\n", new_line++, $0; next } in_hunk { printf "L%-4d R%-4d| %s\n", old_line++, new_line++, $0; next } { print } '

Output format:

  • L123 |

  • Deleted line (left side line number)

  • R456 |

  • Added line (right side line number)

  • L123 R456 |

  • Unchanged line (both line numbers)

3.3. Get Comments

Issue comments (PR-wide):

gh api repos/OWNER/REPO/issues/NUMBER/comments --jq '.[] | {id, user: .user.login, created_at, body}'

Review comments (inline):

gh api repos/OWNER/REPO/pulls/NUMBER/comments --jq '.[] | {id, user: .user.login, path, line, body, in_reply_to_id}'

Get all at once:

FILE1=$(mkoutput --dir tmp --label output) FILE2=$(mkoutput --dir tmp --label output) gh api repos/OWNER/REPO/issues/NUMBER/comments > "$FILE1" gh api repos/OWNER/REPO/pulls/NUMBER/comments > "$FILE2"

3.4. Post Comments

PR-wide comment:

gh pr comment NUMBER --repo OWNER/REPO --body "Comment body"

For multiple lines:

gh pr comment NUMBER --repo OWNER/REPO --body "$(cat <<'EOF'

Review Results

  • Issue 1
  • Issue 2 EOF )"

Inline comment:

Get latest commit SHA

COMMIT_SHA=$(gh pr view NUMBER --repo OWNER/REPO --json commits --jq '.commits[-1].oid')

Post inline comment

gh api repos/OWNER/REPO/pulls/NUMBER/comments
--method POST
-f body="Comment body"
-f commit_id="$COMMIT_SHA"
-f path="path/to/file.py"
-F line=15
-f side=RIGHT

Parameter Description

body Comment body

commit_id Target commit SHA

path File path (relative from repository root)

line Line number (use R number from diff right side)

side RIGHT (added line) or LEFT (deleted line)

Reply to comment:

gh api repos/OWNER/REPO/pulls/NUMBER/comments/COMMENT_ID/replies
--method POST
-f body="Reply body"

  1. Notes

4.1. Inline Comment Line Numbers

  • Use diff right side (R) line numbers

  • For comments on deleted lines, use side=LEFT and left side (L) line number

  • Line numbers are absolute positions in file, not positions within diff hunk

4.2. Permissions

  • Comment posting depends on GitHub permissions

  • Only executable on repositories you have access to

  1. Related Resources

Resource Purpose

rules/github Mandatory rules and permissions

skills/git Git-specific operations

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

Coding

codex-config-optimizer

No summary provided by upstream source.

Repository SourceNeeds Review
Coding

python

No summary provided by upstream source.

Repository SourceNeeds Review
Coding

github

No summary provided by upstream source.

Repository SourceNeeds Review