| name | gh-rest-api |
| description | Enforces using `gh api` REST endpoints instead of `gh` CLI subcommands for ALL GitHub interactions (reads and writes) in the east-guard repo. Use this skill whenever you're about to run any `gh pr`, `gh issue`, `gh release`, `gh repo`, or `gh label` command — even for listing or viewing. Also use when the user asks you to check PRs, create issues, update labels, post comments, or any other GitHub operation. This applies to the f-rustrated/EastGuard repository specifically. |
GitHub REST API Enforcement — east-guard
The rule
Use gh api for every GitHub interaction. Never use gh pr, gh issue, gh release, or other convenience subcommands.
The repo is f-rustrated/EastGuard.
CRITICAL: Case-sensitive repo name. The GitHub REST API requires exact casing: EastGuard, NOT east-guard, eastguard, or Eastguard. A wrong case returns 404. Always use f-rustrated/EastGuard exactly.
Common operations reference
Pull Requests
List PRs:
gh api repos/f-rustrated/EastGuard/pulls --method GET -f state=open
View a PR:
gh api repos/f-rustrated/EastGuard/pulls/NUMBER
Create a PR:
gh api repos/f-rustrated/EastGuard/pulls --method POST \
-f title='PR title' \
-f body='PR description' \
-f head='branch-name' \
-f base='main'
Update a PR (title, body, state):
gh api repos/f-rustrated/EastGuard/pulls/NUMBER --method PATCH \
-f body='Updated description'
List PR comments:
gh api repos/f-rustrated/EastGuard/pulls/NUMBER/comments
Add PR comment:
gh api repos/f-rustrated/EastGuard/pulls/NUMBER/comments --method POST \
-f body='Comment text'
List PR reviews:
gh api repos/f-rustrated/EastGuard/pulls/NUMBER/reviews
Merge a PR:
gh api repos/f-rustrated/EastGuard/pulls/NUMBER/merge --method PUT \
-f merge_method='squash'
PR diff:
gh api repos/f-rustrated/EastGuard/pulls/NUMBER -H "Accept: application/vnd.github.v3.diff"
PR files changed:
gh api repos/f-rustrated/EastGuard/pulls/NUMBER/files
Issues
List issues:
gh api repos/f-rustrated/EastGuard/issues --method GET -f state=open
View an issue:
gh api repos/f-rustrated/EastGuard/issues/NUMBER
Create an issue:
gh api repos/f-rustrated/EastGuard/issues --method POST \
-f title='Issue title' \
-f body='Issue description'
Create an issue with labels (or any array field):
gh api repos/f-rustrated/EastGuard/issues --method POST \
--input - <<< '{"title":"Issue title","body":"Issue description","labels":["bug","priority"]}'
-f sends strings only. Fields like labels and assignees require JSON arrays. Use --input - with a full JSON body whenever the payload includes array or non-string fields. Never use -f labels='["..."]' — GitHub rejects the string with HTTP 422.
Update an issue:
gh api repos/f-rustrated/EastGuard/issues/NUMBER --method PATCH \
-f body='Updated body'
Add issue comment:
gh api repos/f-rustrated/EastGuard/issues/NUMBER/comments --method POST \
-f body='Comment text'
Close an issue:
gh api repos/f-rustrated/EastGuard/issues/NUMBER --method PATCH \
-f state='closed'
Labels
List labels:
gh api repos/f-rustrated/EastGuard/labels
Add label to issue/PR:
gh api repos/f-rustrated/EastGuard/issues/NUMBER/labels --method POST \
--input - <<< '{"labels":["bug","priority"]}'
Releases
List releases:
gh api repos/f-rustrated/EastGuard/releases
Create release:
gh api repos/f-rustrated/EastGuard/releases --method POST \
-f tag_name='v1.0.0' \
-f name='Release 1.0.0' \
-f body='Release notes'
Branches & Refs
List branches:
gh api repos/f-rustrated/EastGuard/branches
Get branch protection:
gh api repos/f-rustrated/EastGuard/branches/main/protection
CI / Checks
List check runs for a ref:
gh api repos/f-rustrated/EastGuard/commits/REF/check-runs
List workflow runs:
gh api repos/f-rustrated/EastGuard/actions/runs
Pagination
REST API paginates by default (30 items). Use -f per_page=100 for larger result sets. For full pagination, use --paginate:
gh api repos/f-rustrated/EastGuard/pulls --paginate -f state=all -f per_page=100
JSON filtering
Use jq-style queries with --jq:
gh api repos/f-rustrated/EastGuard/pulls --jq '.[].title'
gh api repos/f-rustrated/EastGuard/pulls/42 --jq '.body'
Edge cases
- Array fields (
labels, assignees, etc.): -f always sends strings. Use --input - with a JSON body for any payload containing arrays or non-string types. Never do -f labels='["bug"]' — GitHub returns HTTP 422.
- Creating PRs with long bodies: Use
--input - with heredoc or pipe from file instead of -f body= to avoid shell escaping issues.
- Binary content / assets: Use
gh api with --input for upload endpoints.
- Rate limiting: REST API has separate rate limits from GraphQL. Check
X-RateLimit-Remaining header if doing bulk operations.