// Standard patterns for GitHub CLI operations and repository protection
| name | github-cli |
| description | Standard patterns for GitHub CLI operations and repository protection |
| type | integration |
| enforcement | guide |
| priority | high |
Before ANY GitHub write operation:
remote_url=$(git remote get-url origin 2>/dev/null || echo "")
if [[ "$remote_url" == *"willbots/orchestrator"* ]]; then
echo "❌ ERROR: Cannot modify orchestrator template repository!"
exit 1
fi
Don't pre-check. Just run and handle failure:
gh {command} || echo "❌ GitHub CLI failed. Run: gh auth login"
gh issue view {number} --json state,title,labels,body
REPO=$(git remote get-url origin | sed 's|.*github.com[:/]||' | sed 's|\.git$||')
gh issue create --repo "$REPO" --title "{title}" --body-file {file}
gh issue edit {number} --add-label "{label}" --add-assignee @me
gh issue comment {number} --body-file {file}