[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7F5V3PM327W0WBFJWHGW6PZ":3,"skill-same:01M7F5V3PM327W0WBFJWHGW6PZ":82},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":42,"commitSha":43,"skillDirectory":44,"forksCount":14,"repositoryHtmlUrl":45,"repositoryHomepageUrl":6,"ownerHtmlUrl":46,"ownerBlogUrl":47,"ownerDescription":48,"updatedAt":49,"install":50,"resources":63},"01M7F5V3PM327W0WBFJWHGW6PZ","github-pr-workflow",null,"GitHub PR lifecycle: branch, commit, open, CI, merge.","chaorenex1\u002Fhermes-home-content","chaorenex1","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F23194925?v=4","01M7F5NA1D1D02R2MEMYQN2NZT","chan chan","01M7F5NA20KTHMTY2015CYM1TZ",0,"MIT","https:\u002F\u002Fgithub.com\u002Fchaorenex1\u002Fhermes-home-content\u002Fblob\u002Fmain\u002Fskills\u002F.archive\u002Fgithub-pr-workflow\u002FSKILL.md",[],[],"2026-11-16 10:05:34",false,"---\r\nname: github-pr-workflow\r\ndescription: \"GitHub PR lifecycle: branch, commit, open, CI, merge.\"\r\nversion: 1.1.0\r\nauthor: Hermes Agent\r\nlicense: MIT\r\nplatforms: [linux, macos, windows]\r\nmetadata:\r\n  hermes:\r\n    tags: [GitHub, Pull-Requests, CI\u002FCD, Git, Automation, Merge]\r\n    related_skills: [github-auth, github-code-review]\r\n---\r\n\r\n# GitHub Pull Request Workflow\r\n\r\nComplete guide for managing the PR lifecycle. Each section shows the `gh` way first, then the `git` + `curl` fallback for machines without `gh`.\r\n\r\n## Prerequisites\r\n\r\n- Authenticated with GitHub (see `github-auth` skill)\r\n- Inside a git repository with a GitHub remote\r\n\r\n### Quick Auth Detection\r\n\r\n```bash\r\n# Determine which method to use throughout this workflow\r\nif command -v gh &>\u002Fdev\u002Fnull && gh auth status &>\u002Fdev\u002Fnull; then\r\n  AUTH=\"gh\"\r\nelse\r\n  AUTH=\"git\"\r\n  # Ensure we have a token for API calls\r\n  if [ -z \"$GITHUB_TOKEN\" ]; then\r\n    if _hermes_env=\"${HERMES_HOME:-$HOME\u002F.hermes}\u002F.env\"; [ -f \"$_hermes_env\" ] && grep -q \"^GITHUB_TOKEN=\" \"$_hermes_env\"; then\r\n      GITHUB_TOKEN=$(grep \"^GITHUB_TOKEN=\" \"$_hermes_env\" | head -1 | cut -d= -f2 | tr -d '\\n\\r')\r\n    elif grep -q \"github.com\" ~\u002F.git-credentials 2>\u002Fdev\u002Fnull; then\r\n      GITHUB_TOKEN=$(grep \"github.com\" ~\u002F.git-credentials 2>\u002Fdev\u002Fnull | head -1 | sed 's|https:\u002F\u002F[^:]*:\\([^@]*\\)@.*|\\1|')\r\n    fi\r\n  fi\r\nfi\r\necho \"Using: $AUTH\"\r\n```\r\n\r\n### Extracting Owner\u002FRepo from the Git Remote\r\n\r\nMany `curl` commands need `owner\u002Frepo`. Extract it from the git remote:\r\n\r\n```bash\r\n# Works for both HTTPS and SSH remote URLs\r\nREMOTE_URL=$(git remote get-url origin)\r\nOWNER_REPO=$(echo \"$REMOTE_URL\" | sed -E 's|.*github\\.com[:\u002F]||; s|\\.git$||')\r\nOWNER=$(echo \"$OWNER_REPO\" | cut -d\u002F -f1)\r\nREPO=$(echo \"$OWNER_REPO\" | cut -d\u002F -f2)\r\necho \"Owner: $OWNER, Repo: $REPO\"\r\n```\r\n\r\n---\r\n\r\n## 1. Branch Creation\r\n\r\nThis part is pure `git` — identical either way:\r\n\r\n```bash\r\n# Make sure you're up to date\r\ngit fetch origin\r\ngit checkout main && git pull origin main\r\n\r\n# Create and switch to a new branch\r\ngit checkout -b feat\u002Fadd-user-authentication\r\n```\r\n\r\nBranch naming conventions:\r\n- `feat\u002Fdescription` — new features\r\n- `fix\u002Fdescription` — bug fixes\r\n- `refactor\u002Fdescription` — code restructuring\r\n- `docs\u002Fdescription` — documentation\r\n- `ci\u002Fdescription` — CI\u002FCD changes\r\n\r\n## 2. Making Commits\r\n\r\nUse the agent's file tools (`write_file`, `patch`) to make changes, then commit:\r\n\r\n```bash\r\n# Stage specific files\r\ngit add src\u002Fauth.py src\u002Fmodels\u002Fuser.py tests\u002Ftest_auth.py\r\n\r\n# Commit with a conventional commit message\r\ngit commit -m \"feat: add JWT-based user authentication\r\n\r\n- Add login\u002Fregister endpoints\r\n- Add User model with password hashing\r\n- Add auth middleware for protected routes\r\n- Add unit tests for auth flow\"\r\n```\r\n\r\nCommit message format (Conventional Commits):\r\n```\r\ntype(scope): short description\r\n\r\nLonger explanation if needed. Wrap at 72 characters.\r\n```\r\n\r\nTypes: `feat`, `fix`, `refactor`, `docs`, `test`, `ci`, `chore`, `perf`\r\n\r\n## 3. Pushing and Creating a PR\r\n\r\n### Push the Branch (same either way)\r\n\r\n```bash\r\ngit push -u origin HEAD\r\n```\r\n\r\n### Create the PR\r\n\r\n**With gh:**\r\n\r\n```bash\r\ngh pr create \\\r\n  --title \"feat: add JWT-based user authentication\" \\\r\n  --body \"## Summary\r\n- Adds login and register API endpoints\r\n- JWT token generation and validation\r\n\r\n## Test Plan\r\n- [ ] Unit tests pass\r\n\r\nCloses #42\"\r\n```\r\n\r\nOptions: `--draft`, `--reviewer user1,user2`, `--label \"enhancement\"`, `--base develop`\r\n\r\n**With git + curl:**\r\n\r\n```bash\r\nBRANCH=$(git branch --show-current)\r\n\r\ncurl -s -X POST \\\r\n  -H \"Authorization: token $GITHUB_TOKEN\" \\\r\n  -H \"Accept: application\u002Fvnd.github.v3+json\" \\\r\n  https:\u002F\u002Fapi.github.com\u002Frepos\u002F$OWNER\u002F$REPO\u002Fpulls \\\r\n  -d \"{\r\n    \\\"title\\\": \\\"feat: add JWT-based user authentication\\\",\r\n    \\\"body\\\": \\\"## Summary\\nAdds login and register API endpoints.\\n\\nCloses #42\\\",\r\n    \\\"head\\\": \\\"$BRANCH\\\",\r\n    \\\"base\\\": \\\"main\\\"\r\n  }\"\r\n```\r\n\r\nThe response JSON includes the PR `number` — save it for later commands.\r\n\r\nTo create as a draft, add `\"draft\": true` to the JSON body.\r\n\r\n## 4. Monitoring CI Status\r\n\r\n### Check CI Status\r\n\r\n**With gh:**\r\n\r\n```bash\r\n# One-shot check\r\ngh pr checks\r\n\r\n# Watch until all checks finish (polls every 10s)\r\ngh pr checks --watch\r\n```\r\n\r\n**With git + curl:**\r\n\r\n```bash\r\n# Get the latest commit SHA on the current branch\r\nSHA=$(git rev-parse HEAD)\r\n\r\n# Query the combined status\r\ncurl -s \\\r\n  -H \"Authorization: token $GITHUB_TOKEN\" \\\r\n  https:\u002F\u002Fapi.github.com\u002Frepos\u002F$OWNER\u002F$REPO\u002Fcommits\u002F$SHA\u002Fstatus \\\r\n  | python3 -c \"\r\nimport sys, json\r\ndata = json.load(sys.stdin)\r\nprint(f\\\"Overall: {data['state']}\\\")\r\nfor s in data.get('statuses', []):\r\n    print(f\\\"  {s['context']}: {s['state']} - {s.get('description', '')}\\\")\"\r\n\r\n# Also check GitHub Actions check runs (separate endpoint)\r\ncurl -s \\\r\n  -H \"Authorization: token $GITHUB_TOKEN\" \\\r\n  https:\u002F\u002Fapi.github.com\u002Frepos\u002F$OWNER\u002F$REPO\u002Fcommits\u002F$SHA\u002Fcheck-runs \\\r\n  | python3 -c \"\r\nimport sys, json\r\ndata = json.load(sys.stdin)\r\nfor cr in data.get('check_runs', []):\r\n    print(f\\\"  {cr['name']}: {cr['status']} \u002F {cr['conclusion'] or 'pending'}\\\")\"\r\n```\r\n\r\n### Poll Until Complete (git + curl)\r\n\r\n```bash\r\n# Simple polling loop — check every 30 seconds, up to 10 minutes\r\nSHA=$(git rev-parse HEAD)\r\nfor i in $(seq 1 20); do\r\n  STATUS=$(curl -s \\\r\n    -H \"Authorization: token $GITHUB_TOKEN\" \\\r\n    https:\u002F\u002Fapi.github.com\u002Frepos\u002F$OWNER\u002F$REPO\u002Fcommits\u002F$SHA\u002Fstatus \\\r\n    | python3 -c \"import sys,json; print(json.load(sys.stdin)['state'])\")\r\n  echo \"Check $i: $STATUS\"\r\n  if [ \"$STATUS\" = \"success\" ] || [ \"$STATUS\" = \"failure\" ] || [ \"$STATUS\" = \"error\" ]; then\r\n    break\r\n  fi\r\n  sleep 30\r\ndone\r\n```\r\n\r\n## 5. Auto-Fixing CI Failures\r\n\r\nWhen CI fails, diagnose and fix. This loop works with either auth method.\r\n\r\n### Step 1: Get Failure Details\r\n\r\n**With gh:**\r\n\r\n```bash\r\n# List recent workflow runs on this branch\r\ngh run list --branch $(git branch --show-current) --limit 5\r\n\r\n# View failed logs\r\ngh run view \u003CRUN_ID> --log-failed\r\n```\r\n\r\n**With git + curl:**\r\n\r\n```bash\r\nBRANCH=$(git branch --show-current)\r\n\r\n# List workflow runs on this branch\r\ncurl -s \\\r\n  -H \"Authorization: token $GITHUB_TOKEN\" \\\r\n  \"https:\u002F\u002Fapi.github.com\u002Frepos\u002F$OWNER\u002F$REPO\u002Factions\u002Fruns?branch=$BRANCH&per_page=5\" \\\r\n  | python3 -c \"\r\nimport sys, json\r\nruns = json.load(sys.stdin)['workflow_runs']\r\nfor r in runs:\r\n    print(f\\\"Run {r['id']}: {r['name']} - {r['conclusion'] or r['status']}\\\")\"\r\n\r\n# Get failed job logs (download as zip, extract, read)\r\nRUN_ID=\u003Crun_id>\r\ncurl -s -L \\\r\n  -H \"Authorization: token $GITHUB_TOKEN\" \\\r\n  https:\u002F\u002Fapi.github.com\u002Frepos\u002F$OWNER\u002F$REPO\u002Factions\u002Fruns\u002F$RUN_ID\u002Flogs \\\r\n  -o \u002Ftmp\u002Fci-logs.zip\r\ncd \u002Ftmp && unzip -o ci-logs.zip -d ci-logs && cat ci-logs\u002F*.txt\r\n```\r\n\r\n### Step 2: Fix and Push\r\n\r\nAfter identifying the issue, use file tools (`patch`, `write_file`) to fix it:\r\n\r\n```bash\r\ngit add \u003Cfixed_files>\r\ngit commit -m \"fix: resolve CI failure in \u003Ccheck_name>\"\r\ngit push\r\n```\r\n\r\n### Step 3: Verify\r\n\r\nRe-check CI status using the commands from Section 4 above.\r\n\r\n### Auto-Fix Loop Pattern\r\n\r\nWhen asked to auto-fix CI, follow this loop:\r\n\r\n1. Check CI status → identify failures\r\n2. Read failure logs → understand the error\r\n3. Use `read_file` + `patch`\u002F`write_file` → fix the code\r\n4. `git add . && git commit -m \"fix: ...\" && git push`\r\n5. Wait for CI → re-check status\r\n6. Repeat if still failing (up to 3 attempts, then ask the user)\r\n\r\n## 6. Merging\r\n\r\n**With gh:**\r\n\r\n```bash\r\n# Squash merge + delete branch (cleanest for feature branches)\r\ngh pr merge --squash --delete-branch\r\n\r\n# Enable auto-merge (merges when all checks pass)\r\ngh pr merge --auto --squash --delete-branch\r\n```\r\n\r\n**With git + curl:**\r\n\r\n```bash\r\nPR_NUMBER=\u003Cnumber>\r\n\r\n# Merge the PR via API (squash)\r\ncurl -s -X PUT \\\r\n  -H \"Authorization: token $GITHUB_TOKEN\" \\\r\n  https:\u002F\u002Fapi.github.com\u002Frepos\u002F$OWNER\u002F$REPO\u002Fpulls\u002F$PR_NUMBER\u002Fmerge \\\r\n  -d \"{\r\n    \\\"merge_method\\\": \\\"squash\\\",\r\n    \\\"commit_title\\\": \\\"feat: add user authentication (#$PR_NUMBER)\\\"\r\n  }\"\r\n\r\n# Delete the remote branch after merge\r\nBRANCH=$(git branch --show-current)\r\ngit push origin --delete $BRANCH\r\n\r\n# Switch back to main locally\r\ngit checkout main && git pull origin main\r\ngit branch -d $BRANCH\r\n```\r\n\r\nMerge methods: `\"merge\"` (merge commit), `\"squash\"`, `\"rebase\"`\r\n\r\n### Enable Auto-Merge (curl)\r\n\r\n```bash\r\n# Auto-merge requires the repo to have it enabled in settings.\r\n# This uses the GraphQL API since REST doesn't support auto-merge.\r\nPR_NODE_ID=$(curl -s \\\r\n  -H \"Authorization: token $GITHUB_TOKEN\" \\\r\n  https:\u002F\u002Fapi.github.com\u002Frepos\u002F$OWNER\u002F$REPO\u002Fpulls\u002F$PR_NUMBER \\\r\n  | python3 -c \"import sys,json; print(json.load(sys.stdin)['node_id'])\")\r\n\r\ncurl -s -X POST \\\r\n  -H \"Authorization: token $GITHUB_TOKEN\" \\\r\n  https:\u002F\u002Fapi.github.com\u002Fgraphql \\\r\n  -d \"{\\\"query\\\": \\\"mutation { enablePullRequestAutoMerge(input: {pullRequestId: \\\\\\\"$PR_NODE_ID\\\\\\\", mergeMethod: SQUASH}) { clientMutationId } }\\\"}\"\r\n```\r\n\r\n## 7. Complete Workflow Example\r\n\r\n```bash\r\n# 1. Start from clean main\r\ngit checkout main && git pull origin main\r\n\r\n# 2. Branch\r\ngit checkout -b fix\u002Flogin-redirect-bug\r\n\r\n# 3. (Agent makes code changes with file tools)\r\n\r\n# 4. Commit\r\ngit add src\u002Fauth\u002Flogin.py tests\u002Ftest_login.py\r\ngit commit -m \"fix: correct redirect URL after login\r\n\r\nPreserves the ?next= parameter instead of always redirecting to \u002Fdashboard.\"\r\n\r\n# 5. Push\r\ngit push -u origin HEAD\r\n\r\n# 6. Create PR (picks gh or curl based on what's available)\r\n# ... (see Section 3)\r\n\r\n# 7. Monitor CI (see Section 4)\r\n\r\n# 8. Merge when green (see Section 6)\r\n```\r\n\r\n## Useful PR Commands Reference\r\n\r\n| Action | gh | git + curl |\r\n|--------|-----|-----------|\r\n| List my PRs | `gh pr list --author @me` | `curl -s -H \"Authorization: token $GITHUB_TOKEN\" \"https:\u002F\u002Fapi.github.com\u002Frepos\u002F$OWNER\u002F$REPO\u002Fpulls?state=open\"` |\r\n| View PR diff | `gh pr diff` | `git diff main...HEAD` (local) or `curl -H \"Accept: application\u002Fvnd.github.diff\" ...` |\r\n| Add comment | `gh pr comment N --body \"...\"` | `curl -X POST ...\u002Fissues\u002FN\u002Fcomments -d '{\"body\":\"...\"}'` |\r\n| Request review | `gh pr edit N --add-reviewer user` | `curl -X POST ...\u002Fpulls\u002FN\u002Frequested_reviewers -d '{\"reviewers\":[\"user\"]}'` |\r\n| Close PR | `gh pr close N` | `curl -X PATCH ...\u002Fpulls\u002FN -d '{\"state\":\"closed\"}'` |\r\n| Check out someone's PR | `gh pr checkout N` | `git fetch origin pull\u002FN\u002Fhead:pr-N && git checkout pr-N` |\r\n","# GitHub Pull Request Workflow\r\n\r\nComplete guide for managing the PR lifecycle. Each section shows the `gh` way first, then the `git` + `curl` fallback for machines without `gh`.\r\n\r\n## Prerequisites\r\n\r\n- Authenticated with GitHub (see `github-auth` skill)\r\n- Inside a git repository with a GitHub remote\r\n\r\n### Quick Auth Detection\r\n\r\n```bash\r\n# Determine which method to use throughout this workflow\r\nif command -v gh &>\u002Fdev\u002Fnull && gh auth status &>\u002Fdev\u002Fnull; then\r\n  AUTH=\"gh\"\r\nelse\r\n  AUTH=\"git\"\r\n  # Ensure we have a token for API calls\r\n  if [ -z \"$GITHUB_TOKEN\" ]; then\r\n    if _hermes_env=\"${HERMES_HOME:-$HOME\u002F.hermes}\u002F.env\"; [ -f \"$_hermes_env\" ] && grep -q \"^GITHUB_TOKEN=\" \"$_hermes_env\"; then\r\n      GITHUB_TOKEN=$(grep \"^GITHUB_TOKEN=\" \"$_hermes_env\" | head -1 | cut -d= -f2 | tr -d '\\n\\r')\r\n    elif grep -q \"github.com\" ~\u002F.git-credentials 2>\u002Fdev\u002Fnull; then\r\n      GITHUB_TOKEN=$(grep \"github.com\" ~\u002F.git-credentials 2>\u002Fdev\u002Fnull | head -1 | sed 's|https:\u002F\u002F[^:]*:\\([^@]*\\)@.*|\\1|')\r\n    fi\r\n  fi\r\nfi\r\necho \"Using: $AUTH\"\r\n```\r\n\r\n### Extracting Owner\u002FRepo from the Git Remote\r\n\r\nMany `curl` commands need `owner\u002Frepo`. Extract it from the git remote:\r\n\r\n```bash\r\n# Works for both HTTPS and SSH remote URLs\r\nREMOTE_URL=$(git remote get-url origin)\r\nOWNER_REPO=$(echo \"$REMOTE_URL\" | sed -E 's|.*github\\.com[:\u002F]||; s|\\.git$||')\r\nOWNER=$(echo \"$OWNER_REPO\" | cut -d\u002F -f1)\r\nREPO=$(echo \"$OWNER_REPO\" | cut -d\u002F -f2)\r\necho \"Owner: $OWNER, Repo: $REPO\"\r\n```\r\n\r\n---\r\n\r\n## 1. Branch Creation\r\n\r\nThis part is pure `git` — identical either way:\r\n\r\n```bash\r\n# Make sure you're up to date\r\ngit fetch origin\r\ngit checkout main && git pull origin main\r\n\r\n# Create and switch to a new branch\r\ngit checkout -b feat\u002Fadd-user-authentication\r\n```\r\n\r\nBranch naming conventions:\r\n- `feat\u002Fdescription` — new features\r\n- `fix\u002Fdescription` — bug fixes\r\n- `refactor\u002Fdescription` — code restructuring\r\n- `docs\u002Fdescription` — documentation\r\n- `ci\u002Fdescription` — CI\u002FCD changes\r\n\r\n## 2. Making Commits\r\n\r\nUse the agent's file tools (`write_file`, `patch`) to make changes, then commit:\r\n\r\n```bash\r\n# Stage specific files\r\ngit add src\u002Fauth.py src\u002Fmodels\u002Fuser.py tests\u002Ftest_auth.py\r\n\r\n# Commit with a conventional commit message\r\ngit commit -m \"feat: add JWT-based user authentication\r\n\r\n- Add login\u002Fregister endpoints\r\n- Add User model with password hashing\r\n- Add auth middleware for protected routes\r\n- Add unit tests for auth flow\"\r\n```\r\n\r\nCommit message format (Conventional Commits):\r\n```\r\ntype(scope): short description\r\n\r\nLonger explanation if needed. Wrap at 72 characters.\r\n```\r\n\r\nTypes: `feat`, `fix`, `refactor`, `docs`, `test`, `ci`, `chore`, `perf`\r\n\r\n## 3. Pushing and Creating a PR\r\n\r\n### Push the Branch (same either way)\r\n\r\n```bash\r\ngit push -u origin HEAD\r\n```\r\n\r\n### Create the PR\r\n\r\n**With gh:**\r\n\r\n```bash\r\ngh pr create \\\r\n  --title \"feat: add JWT-based user authentication\" \\\r\n  --body \"## Summary\r\n- Adds login and register API endpoints\r\n- JWT token generation and validation\r\n\r\n## Test Plan\r\n- [ ] Unit tests pass\r\n\r\nCloses #42\"\r\n```\r\n\r\nOptions: `--draft`, `--reviewer user1,user2`, `--label \"enhancement\"`, `--base develop`\r\n\r\n**With git + curl:**\r\n\r\n```bash\r\nBRANCH=$(git branch --show-current)\r\n\r\ncurl -s -X POST \\\r\n  -H \"Authorization: token $GITHUB_TOKEN\" \\\r\n  -H \"Accept: application\u002Fvnd.github.v3+json\" \\\r\n  https:\u002F\u002Fapi.github.com\u002Frepos\u002F$OWNER\u002F$REPO\u002Fpulls \\\r\n  -d \"{\r\n    \\\"title\\\": \\\"feat: add JWT-based user authentication\\\",\r\n    \\\"body\\\": \\\"## Summary\\nAdds login and register API endpoints.\\n\\nCloses #42\\\",\r\n    \\\"head\\\": \\\"$BRANCH\\\",\r\n    \\\"base\\\": \\\"main\\\"\r\n  }\"\r\n```\r\n\r\nThe response JSON includes the PR `number` — save it for later commands.\r\n\r\nTo create as a draft, add `\"draft\": true` to the JSON body.\r\n\r\n## 4. Monitoring CI Status\r\n\r\n### Check CI Status\r\n\r\n**With gh:**\r\n\r\n```bash\r\n# One-shot check\r\ngh pr checks\r\n\r\n# Watch until all checks finish (polls every 10s)\r\ngh pr checks --watch\r\n```\r\n\r\n**With git + curl:**\r\n\r\n```bash\r\n# Get the latest commit SHA on the current branch\r\nSHA=$(git rev-parse HEAD)\r\n\r\n# Query the combined status\r\ncurl -s \\\r\n  -H \"Authorization: token $GITHUB_TOKEN\" \\\r\n  https:\u002F\u002Fapi.github.com\u002Frepos\u002F$OWNER\u002F$REPO\u002Fcommits\u002F$SHA\u002Fstatus \\\r\n  | python3 -c \"\r\nimport sys, json\r\ndata = json.load(sys.stdin)\r\nprint(f\\\"Overall: {data['state']}\\\")\r\nfor s in data.get('statuses', []):\r\n    print(f\\\"  {s['context']}: {s['state']} - {s.get('description', '')}\\\")\"\r\n\r\n# Also check GitHub Actions check runs (separate endpoint)\r\ncurl -s \\\r\n  -H \"Authorization: token $GITHUB_TOKEN\" \\\r\n  https:\u002F\u002Fapi.github.com\u002Frepos\u002F$OWNER\u002F$REPO\u002Fcommits\u002F$SHA\u002Fcheck-runs \\\r\n  | python3 -c \"\r\nimport sys, json\r\ndata = json.load(sys.stdin)\r\nfor cr in data.get('check_runs', []):\r\n    print(f\\\"  {cr['name']}: {cr['status']} \u002F {cr['conclusion'] or 'pending'}\\\")\"\r\n```\r\n\r\n### Poll Until Complete (git + curl)\r\n\r\n```bash\r\n# Simple polling loop — check every 30 seconds, up to 10 minutes\r\nSHA=$(git rev-parse HEAD)\r\nfor i in $(seq 1 20); do\r\n  STATUS=$(curl -s \\\r\n    -H \"Authorization: token $GITHUB_TOKEN\" \\\r\n    https:\u002F\u002Fapi.github.com\u002Frepos\u002F$OWNER\u002F$REPO\u002Fcommits\u002F$SHA\u002Fstatus \\\r\n    | python3 -c \"import sys,json; print(json.load(sys.stdin)['state'])\")\r\n  echo \"Check $i: $STATUS\"\r\n  if [ \"$STATUS\" = \"success\" ] || [ \"$STATUS\" = \"failure\" ] || [ \"$STATUS\" = \"error\" ]; then\r\n    break\r\n  fi\r\n  sleep 30\r\ndone\r\n```\r\n\r\n## 5. Auto-Fixing CI Failures\r\n\r\nWhen CI fails, diagnose and fix. This loop works with either auth method.\r\n\r\n### Step 1: Get Failure Details\r\n\r\n**With gh:**\r\n\r\n```bash\r\n# List recent workflow runs on this branch\r\ngh run list --branch $(git branch --show-current) --limit 5\r\n\r\n# View failed logs\r\ngh run view \u003CRUN_ID> --log-failed\r\n```\r\n\r\n**With git + curl:**\r\n\r\n```bash\r\nBRANCH=$(git branch --show-current)\r\n\r\n# List workflow runs on this branch\r\ncurl -s \\\r\n  -H \"Authorization: token $GITHUB_TOKEN\" \\\r\n  \"https:\u002F\u002Fapi.github.com\u002Frepos\u002F$OWNER\u002F$REPO\u002Factions\u002Fruns?branch=$BRANCH&per_page=5\" \\\r\n  | python3 -c \"\r\nimport sys, json\r\nruns = json.load(sys.stdin)['workflow_runs']\r\nfor r in runs:\r\n    print(f\\\"Run {r['id']}: {r['name']} - {r['conclusion'] or r['status']}\\\")\"\r\n\r\n# Get failed job logs (download as zip, extract, read)\r\nRUN_ID=\u003Crun_id>\r\ncurl -s -L \\\r\n  -H \"Authorization: token $GITHUB_TOKEN\" \\\r\n  https:\u002F\u002Fapi.github.com\u002Frepos\u002F$OWNER\u002F$REPO\u002Factions\u002Fruns\u002F$RUN_ID\u002Flogs \\\r\n  -o \u002Ftmp\u002Fci-logs.zip\r\ncd \u002Ftmp && unzip -o ci-logs.zip -d ci-logs && cat ci-logs\u002F*.txt\r\n```\r\n\r\n### Step 2: Fix and Push\r\n\r\nAfter identifying the issue, use file tools (`patch`, `write_file`) to fix it:\r\n\r\n```bash\r\ngit add \u003Cfixed_files>\r\ngit commit -m \"fix: resolve CI failure in \u003Ccheck_name>\"\r\ngit push\r\n```\r\n\r\n### Step 3: Verify\r\n\r\nRe-check CI status using the commands from Section 4 above.\r\n\r\n### Auto-Fix Loop Pattern\r\n\r\nWhen asked to auto-fix CI, follow this loop:\r\n\r\n1. Check CI status → identify failures\r\n2. Read failure logs → understand the error\r\n3. Use `read_file` + `patch`\u002F`write_file` → fix the code\r\n4. `git add . && git commit -m \"fix: ...\" && git push`\r\n5. Wait for CI → re-check status\r\n6. Repeat if still failing (up to 3 attempts, then ask the user)\r\n\r\n## 6. Merging\r\n\r\n**With gh:**\r\n\r\n```bash\r\n# Squash merge + delete branch (cleanest for feature branches)\r\ngh pr merge --squash --delete-branch\r\n\r\n# Enable auto-merge (merges when all checks pass)\r\ngh pr merge --auto --squash --delete-branch\r\n```\r\n\r\n**With git + curl:**\r\n\r\n```bash\r\nPR_NUMBER=\u003Cnumber>\r\n\r\n# Merge the PR via API (squash)\r\ncurl -s -X PUT \\\r\n  -H \"Authorization: token $GITHUB_TOKEN\" \\\r\n  https:\u002F\u002Fapi.github.com\u002Frepos\u002F$OWNER\u002F$REPO\u002Fpulls\u002F$PR_NUMBER\u002Fmerge \\\r\n  -d \"{\r\n    \\\"merge_method\\\": \\\"squash\\\",\r\n    \\\"commit_title\\\": \\\"feat: add user authentication (#$PR_NUMBER)\\\"\r\n  }\"\r\n\r\n# Delete the remote branch after merge\r\nBRANCH=$(git branch --show-current)\r\ngit push origin --delete $BRANCH\r\n\r\n# Switch back to main locally\r\ngit checkout main && git pull origin main\r\ngit branch -d $BRANCH\r\n```\r\n\r\nMerge methods: `\"merge\"` (merge commit), `\"squash\"`, `\"rebase\"`\r\n\r\n### Enable Auto-Merge (curl)\r\n\r\n```bash\r\n# Auto-merge requires the repo to have it enabled in settings.\r\n# This uses the GraphQL API since REST doesn't support auto-merge.\r\nPR_NODE_ID=$(curl -s \\\r\n  -H \"Authorization: token $GITHUB_TOKEN\" \\\r\n  https:\u002F\u002Fapi.github.com\u002Frepos\u002F$OWNER\u002F$REPO\u002Fpulls\u002F$PR_NUMBER \\\r\n  | python3 -c \"import sys,json; print(json.load(sys.stdin)['node_id'])\")\r\n\r\ncurl -s -X POST \\\r\n  -H \"Authorization: token $GITHUB_TOKEN\" \\\r\n  https:\u002F\u002Fapi.github.com\u002Fgraphql \\\r\n  -d \"{\\\"query\\\": \\\"mutation { enablePullRequestAutoMerge(input: {pullRequestId: \\\\\\\"$PR_NODE_ID\\\\\\\", mergeMethod: SQUASH}) { clientMutationId } }\\\"}\"\r\n```\r\n\r\n## 7. Complete Workflow Example\r\n\r\n```bash\r\n# 1. Start from clean main\r\ngit checkout main && git pull origin main\r\n\r\n# 2. Branch\r\ngit checkout -b fix\u002Flogin-redirect-bug\r\n\r\n# 3. (Agent makes code changes with file tools)\r\n\r\n# 4. Commit\r\ngit add src\u002Fauth\u002Flogin.py tests\u002Ftest_login.py\r\ngit commit -m \"fix: correct redirect URL after login\r\n\r\nPreserves the ?next= parameter instead of always redirecting to \u002Fdashboard.\"\r\n\r\n# 5. Push\r\ngit push -u origin HEAD\r\n\r\n# 6. Create PR (picks gh or curl based on what's available)\r\n# ... (see Section 3)\r\n\r\n# 7. Monitor CI (see Section 4)\r\n\r\n# 8. Merge when green (see Section 6)\r\n```\r\n\r\n## Useful PR Commands Reference\r\n\r\n| Action | gh | git + curl |\r\n|--------|-----|-----------|\r\n| List my PRs | `gh pr list --author @me` | `curl -s -H \"Authorization: token $GITHUB_TOKEN\" \"https:\u002F\u002Fapi.github.com\u002Frepos\u002F$OWNER\u002F$REPO\u002Fpulls?state=open\"` |\r\n| View PR diff | `gh pr diff` | `git diff main...HEAD` (local) or `curl -H \"Accept: application\u002Fvnd.github.diff\" ...` |\r\n| Add comment | `gh pr comment N --body \"...\"` | `curl -X POST ...\u002Fissues\u002FN\u002Fcomments -d '{\"body\":\"...\"}'` |\r\n| Request review | `gh pr edit N --add-reviewer user` | `curl -X POST ...\u002Fpulls\u002FN\u002Frequested_reviewers -d '{\"reviewers\":[\"user\"]}'` |\r\n| Close PR | `gh pr close N` | `curl -X PATCH ...\u002Fpulls\u002FN -d '{\"state\":\"closed\"}'` |\r\n| Check out someone's PR | `gh pr checkout N` | `git fetch origin pull\u002FN\u002Fhead:pr-N && git checkout pr-N` |\r\n",{"name":5,"author":24,"license":15,"version":25,"metadata":26,"platforms":38,"description":7},"Hermes Agent","1.1.0",{"hermes":27},{"tags":28,"related_skills":35},[29,30,31,32,33,34],"GitHub","Pull-Requests","CI\u002FCD","Git","Automation","Merge",[36,37],"github-auth","github-code-review",[39,40,41],"linux","macos","windows","main","a3f3199bb87ec3c91248f68a39d88527e1847ae9","skills\u002F.archive\u002Fgithub-pr-workflow","https:\u002F\u002Fgithub.com\u002Fchaorenex1\u002Fhermes-home-content","https:\u002F\u002Fgithub.com\u002Fchaorenex1","https:\u002F\u002Fblog.aduib.com","A programmer whose only hobby in life is coding","2026-10-20 00:34:32",{"source":8,"skillName":5,"commands":51,"prompt":61,"zipAvailable":62},[52,55,58],{"tool":53,"command":54},"npx","npx skills add chaorenex1\u002Fhermes-home-content --skill github-pr-workflow",{"tool":56,"command":57},"bunx","bunx skills add chaorenex1\u002Fhermes-home-content --skill github-pr-workflow",{"tool":59,"command":60},"pnpm","pnpm dlx skills add chaorenex1\u002Fhermes-home-content --skill github-pr-workflow","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fchaorenex1\u002Fhermes-home-content\u002Fblob\u002Fmain\u002Fskills\u002F.archive\u002Fgithub-pr-workflow\u002FSKILL.md",true,[64,70,74,78],{"path":65,"resourceType":66,"resourceTypeDesc":67,"sizeBytes":68,"sourceHtmlUrl":69},"references\u002Fci-troubleshooting.md","REFERENCE","参考文档",5062,"https:\u002F\u002Fgithub.com\u002Fchaorenex1\u002Fhermes-home-content\u002Fblob\u002Fmain\u002Fskills\u002F.archive\u002Fgithub-pr-workflow\u002Freferences\u002Fci-troubleshooting.md",{"path":71,"resourceType":66,"resourceTypeDesc":67,"sizeBytes":72,"sourceHtmlUrl":73},"references\u002Fconventional-commits.md",2488,"https:\u002F\u002Fgithub.com\u002Fchaorenex1\u002Fhermes-home-content\u002Fblob\u002Fmain\u002Fskills\u002F.archive\u002Fgithub-pr-workflow\u002Freferences\u002Fconventional-commits.md",{"path":75,"resourceType":66,"resourceTypeDesc":67,"sizeBytes":76,"sourceHtmlUrl":77},"templates\u002Fpr-body-bugfix.md",548,"https:\u002F\u002Fgithub.com\u002Fchaorenex1\u002Fhermes-home-content\u002Fblob\u002Fmain\u002Fskills\u002F.archive\u002Fgithub-pr-workflow\u002Ftemplates\u002Fpr-body-bugfix.md",{"path":79,"resourceType":66,"resourceTypeDesc":67,"sizeBytes":80,"sourceHtmlUrl":81},"templates\u002Fpr-body-feature.md",613,"https:\u002F\u002Fgithub.com\u002Fchaorenex1\u002Fhermes-home-content\u002Fblob\u002Fmain\u002Fskills\u002F.archive\u002Fgithub-pr-workflow\u002Ftemplates\u002Fpr-body-feature.md",[83,90,97,104,111,118],{"skillNo":84,"name":85,"nameZh":6,"description":86,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":87,"categories":88,"keywords":89,"publishedAt":19},"01M7F8GF32YD5MBQW2TGSRH1YP","web-retrieval-resilience","Web tools fail or search rules break: repair or fall back.","https:\u002F\u002Fgithub.com\u002Fchaorenex1\u002Fhermes-home-content\u002Fblob\u002Fmain\u002Fskills\u002Fweb\u002Fweb-retrieval-resilience\u002FSKILL.md",[],[],{"skillNo":91,"name":92,"nameZh":6,"description":93,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":94,"categories":95,"keywords":96,"publishedAt":19},"01M7F8FP46QESQMCZ1KBT3TW3R","blocked-page-recovery","Use when a fetch fails: 403\u002F429, paywall, WAF, bot wall.","https:\u002F\u002Fgithub.com\u002Fchaorenex1\u002Fhermes-home-content\u002Fblob\u002Fmain\u002Fskills\u002Fweb\u002Fblocked-page-recovery\u002FSKILL.md",[],[],{"skillNo":98,"name":99,"nameZh":6,"description":100,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":101,"categories":102,"keywords":103,"publishedAt":19},"01M7F8ER6VXHBNVRQBZS7X08SE","verification-loop","Run a six-phase verification of a Claude Code session's work — build, type check, lint, tests with coverage, security grep, and diff review — then produce a PASS\u002FFAIL verification report. Use when verifying work after completing a feature or refactor, before creating a PR, or when quality gates must pass.","https:\u002F\u002Fgithub.com\u002Fchaorenex1\u002Fhermes-home-content\u002Fblob\u002Fmain\u002Fskills\u002Fverification-loop\u002FSKILL.md",[],[],{"skillNo":105,"name":106,"nameZh":6,"description":107,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":108,"categories":109,"keywords":110,"publishedAt":19},"01M7F8E4BQJ38KVQVM3MT20PYV","unreal-world-builder","开放世界与环境专家——精通 UE5 World Partition、Landscape、程序化植被、HLOD 和大规模关卡流式加载，打造无缝开放世界体验","https:\u002F\u002Fgithub.com\u002Fchaorenex1\u002Fhermes-home-content\u002Fblob\u002Fmain\u002Fskills\u002Funreal-engine\u002Funreal-world-builder\u002FSKILL.md",[],[],{"skillNo":112,"name":113,"nameZh":6,"description":114,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":115,"categories":116,"keywords":117,"publishedAt":19},"01M7F8D747SQW2FTP7GBSX38BR","unreal-technical-artist","Unreal Engine 视觉管线专家——精通材质编辑器、Niagara 特效、程序化内容生成和 UE5 项目的美术到引擎管线","https:\u002F\u002Fgithub.com\u002Fchaorenex1\u002Fhermes-home-content\u002Fblob\u002Fmain\u002Fskills\u002Funreal-engine\u002Funreal-technical-artist\u002FSKILL.md",[],[],{"skillNo":119,"name":120,"nameZh":6,"description":121,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":122,"categories":123,"keywords":124,"publishedAt":19},"01M7F8CKHYJVZVBTN0321J88T2","unreal-systems-engineer","性能与混合架构专家——精通 C++\u002FBlueprint 边界、Nanite 几何体、Lumen GI 和 Gameplay Ability System，面向 AAA 级 Unreal Engine 项目","https:\u002F\u002Fgithub.com\u002Fchaorenex1\u002Fhermes-home-content\u002Fblob\u002Fmain\u002Fskills\u002Funreal-engine\u002Funreal-systems-engineer\u002FSKILL.md",[],[]]