$npx -y skills add adityahimaone/hermes-agent-rtk-caveman --skill github-pr-workflowFull pull request lifecycle — create branches, commit changes, open PRs, monitor CI status, auto-fix failures, and merge. Works with gh CLI or falls back to git + GitHub REST API via curl.
| 1 | # GitHub Pull Request Workflow |
| 2 | |
| 3 | Complete guide for managing the PR lifecycle. Each section shows the `gh` way first, then the `git` + `curl` fallback for machines without `gh`. |
| 4 | |
| 5 | ## Prerequisites |
| 6 | |
| 7 | - Authenticated with GitHub (see `github-auth` skill) |
| 8 | - Inside a git repository with a GitHub remote |
| 9 | |
| 10 | ### Quick Auth Detection |
| 11 | |
| 12 | ```bash |
| 13 | # Determine which method to use throughout this workflow |
| 14 | if command -v gh &>/dev/null && gh auth status &>/dev/null; then |
| 15 | AUTH="gh" |
| 16 | else |
| 17 | AUTH="git" |
| 18 | # Ensure we have a token for API calls |
| 19 | if [ -z "$GITHUB_TOKEN" ]; then |
| 20 | if [ -f ~/.hermes/.env ] && grep -q "^GITHUB_TOKEN=" ~/.hermes/.env; then |
| 21 | GITHUB_TOKEN=$(grep "^GITHUB_TOKEN=" ~/.hermes/.env | head -1 | cut -d= -f2 | tr -d '\n\r') |
| 22 | elif grep -q "github.com" ~/.git-credentials 2>/dev/null; then |
| 23 | GITHUB_TOKEN=$(grep "github.com" ~/.git-credentials 2>/dev/null | head -1 | sed 's|https://[^:]*:\([^@]*\)@.*|\1|') |
| 24 | fi |
| 25 | fi |
| 26 | fi |
| 27 | echo "Using: $AUTH" |
| 28 | ``` |
| 29 | |
| 30 | ### Extracting Owner/Repo from the Git Remote |
| 31 | |
| 32 | Many `curl` commands need `owner/repo`. Extract it from the git remote: |
| 33 | |
| 34 | ```bash |
| 35 | # Works for both HTTPS and SSH remote URLs |
| 36 | REMOTE_URL=$(git remote get-url origin) |
| 37 | OWNER_REPO=$(echo "$REMOTE_URL" | sed -E 's|.*github\.com[:/]||; s|\.git$||') |
| 38 | OWNER=$(echo "$OWNER_REPO" | cut -d/ -f1) |
| 39 | REPO=$(echo "$OWNER_REPO" | cut -d/ -f2) |
| 40 | echo "Owner: $OWNER, Repo: $REPO" |
| 41 | ``` |
| 42 | |
| 43 | --- |
| 44 | |
| 45 | ## 1. Branch Creation |
| 46 | |
| 47 | This part is pure `git` — identical either way: |
| 48 | |
| 49 | ```bash |
| 50 | # Make sure you're up to date |
| 51 | git fetch origin |
| 52 | git checkout main && git pull origin main |
| 53 | |
| 54 | # Create and switch to a new branch |
| 55 | git checkout -b feat/add-user-authentication |
| 56 | ``` |
| 57 | |
| 58 | Branch naming conventions: |
| 59 | - `feat/description` — new features |
| 60 | - `fix/description` — bug fixes |
| 61 | - `refactor/description` — code restructuring |
| 62 | - `docs/description` — documentation |
| 63 | - `ci/description` — CI/CD changes |
| 64 | |
| 65 | ## 2. Making Commits |
| 66 | |
| 67 | Use the agent's file tools (`write_file`, `patch`) to make changes, then commit: |
| 68 | |
| 69 | ```bash |
| 70 | # Stage specific files |
| 71 | git add src/auth.py src/models/user.py tests/test_auth.py |
| 72 | |
| 73 | # Commit with a conventional commit message |
| 74 | git commit -m "feat: add JWT-based user authentication |
| 75 | |
| 76 | - Add login/register endpoints |
| 77 | - Add User model with password hashing |
| 78 | - Add auth middleware for protected routes |
| 79 | - Add unit tests for auth flow" |
| 80 | ``` |
| 81 | |
| 82 | Commit message format (Conventional Commits): |
| 83 | ``` |
| 84 | type(scope): short description |
| 85 | |
| 86 | Longer explanation if needed. Wrap at 72 characters. |
| 87 | ``` |
| 88 | |
| 89 | Types: `feat`, `fix`, `refactor`, `docs`, `test`, `ci`, `chore`, `perf` |
| 90 | |
| 91 | ## 3. Pushing and Creating a PR |
| 92 | |
| 93 | ### Push the Branch (same either way) |
| 94 | |
| 95 | ```bash |
| 96 | git push -u origin HEAD |
| 97 | ``` |
| 98 | |
| 99 | ### Create the PR |
| 100 | |
| 101 | **With gh:** |
| 102 | |
| 103 | ```bash |
| 104 | gh pr create \ |
| 105 | --title "feat: add JWT-based user authentication" \ |
| 106 | --body "## Summary |
| 107 | - Adds login and register API endpoints |
| 108 | - JWT token generation and validation |
| 109 | |
| 110 | ## Test Plan |
| 111 | - [ ] Unit tests pass |
| 112 | |
| 113 | Closes #42" |
| 114 | ``` |
| 115 | |
| 116 | Options: `--draft`, `--reviewer user1,user2`, `--label "enhancement"`, `--base develop` |
| 117 | |
| 118 | **With git + curl:** |
| 119 | |
| 120 | ```bash |
| 121 | BRANCH=$(git branch --show-current) |
| 122 | |
| 123 | curl -s -X POST \ |
| 124 | -H "Authorization: token $GITHUB_TOKEN" \ |
| 125 | -H "Accept: application/vnd.github.v3+json" \ |
| 126 | https://api.github.com/repos/$OWNER/$REPO/pulls \ |
| 127 | -d "{ |
| 128 | \"title\": \"feat: add JWT-based user authentication\", |
| 129 | \"body\": \"## Summary\nAdds login and register API endpoints.\n\nCloses #42\", |
| 130 | \"head\": \"$BRANCH\", |
| 131 | \"base\": \"main\" |
| 132 | }" |
| 133 | ``` |
| 134 | |
| 135 | The response JSON includes the PR `number` — save it for later commands. |
| 136 | |
| 137 | To create as a draft, add `"draft": true` to the JSON body. |
| 138 | |
| 139 | ## 4. Monitoring CI Status |
| 140 | |
| 141 | ### Check CI Status |
| 142 | |
| 143 | **With gh:** |
| 144 | |
| 145 | ```bash |
| 146 | # One-shot check |
| 147 | gh pr checks |
| 148 | |
| 149 | # Watch until all checks finish (polls every 10s) |
| 150 | gh pr checks --watch |
| 151 | ``` |
| 152 | |
| 153 | **With git + curl:** |
| 154 | |
| 155 | ```bash |
| 156 | # Get the latest commit SHA on the current branch |
| 157 | SHA=$(git rev-parse HEAD) |
| 158 | |
| 159 | # Query the combined status |
| 160 | curl -s \ |
| 161 | -H "Authorization: token $GITHUB_TOKEN" \ |
| 162 | https://api.github.com/repos/$OWNER/$REPO/commits/$SHA/status \ |
| 163 | | python3 -c " |
| 164 | import sys, json |
| 165 | data = json.load(sys.stdin) |
| 166 | print(f\"Overall: {data['state']}\") |
| 167 | for s in data.get('statuses', []): |
| 168 | print(f\" {s['context']}: {s['state']} - {s.get('description', '')}\")" |
| 169 | |
| 170 | # Also check GitHub Actions check runs (separate endpoint) |
| 171 | curl -s \ |
| 172 | -H "Authorization: token $GITHUB_TOKEN" \ |
| 173 | https://api.github.com/repos/$OWNER/$REPO/commits/$SHA/check-runs \ |
| 174 | | python3 -c " |
| 175 | import sys, json |
| 176 | data = json.load(sys.stdin) |
| 177 | for cr in data.get('check_runs', []): |
| 178 | print(f\" {cr['name']}: {cr['status']} / {cr['conclusion'] or 'pending'}\")" |
| 179 | ``` |
| 180 | |
| 181 | ### Poll Until Co |