[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M71HBG4KFQ9CFV73CSK2QGCN":3,"skill-same:01M71HBG4KFQ9CFV73CSK2QGCN":101},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":15,"categories":16,"keywords":22,"publishedAt":43,"linkOnly":44,"markdownContent":45,"markdownBody":46,"frontMatter":47,"refName":62,"commitSha":63,"skillDirectory":64,"forksCount":65,"repositoryHtmlUrl":66,"repositoryHomepageUrl":6,"ownerHtmlUrl":67,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":68,"install":69,"resources":82},"01M71HBG4KFQ9CFV73CSK2QGCN","github-pr-workflow",null,"Full 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.","0xzgbot\u002Fforge-nps-v01","0xzgbot","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F271900281?v=4","01M71GXWAFRXXJSJE3HBCVDKZY","01M71GXWBFQYRJK7M8RM6BDP0X",6,"MIT","https:\u002F\u002Fgithub.com\u002F0xzgbot\u002Fforge-nps-v01\u002Fblob\u002Fmaster\u002Fhermes_home\u002Fprofiles\u002Flive\u002Fskills\u002Fgithub\u002Fgithub-pr-workflow\u002FSKILL.md",[17],{"categoryNo":18,"categoryName":19,"taxonomyType":20,"taxonomyTypeDesc":21},"01JBSEEDCAT000000000000023","Skill与智能体开发","SCENARIO","使用场景",[23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42],"github","workflow","pr","github pr","pr workflow","github pr workflow","auto-fix","review","branches","back","auto","fix","open","api","ci","code-review","pull-requests","code","commit","auth","2026-11-10 10:12:30",false,"---\nname: github-pr-workflow\ndescription: Full 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.\nversion: 1.1.0\nauthor: Hermes Agent\nlicense: MIT\nmetadata:\n  hermes:\n    tags: [GitHub, Pull-Requests, CI\u002FCD, Git, Automation, Merge]\n    related_skills: [github-auth, github-code-review]\n---\n\n# GitHub Pull Request Workflow\n\nComplete guide for managing the PR lifecycle. Each section shows the `gh` way first, then the `git` + `curl` fallback for machines without `gh`.\n\n## Prerequisites\n\n- Authenticated with GitHub (see `github-auth` skill)\n- Inside a git repository with a GitHub remote\n\n### Quick Auth Detection\n\n```bash\n# Determine which method to use throughout this workflow\nif command -v gh &>\u002Fdev\u002Fnull && gh auth status &>\u002Fdev\u002Fnull; then\n  AUTH=\"gh\"\nelse\n  AUTH=\"git\"\n  # Ensure we have a token for API calls\n  if [ -z \"$GITHUB_TOKEN\" ]; then\n    if [ -f ~\u002F.hermes\u002F.env ] && grep -q \"^GITHUB_TOKEN=\" ~\u002F.hermes\u002F.env; then\n      GITHUB_TOKEN=$(grep \"^GITHUB_TOKEN=\" ~\u002F.hermes\u002F.env | head -1 | cut -d= -f2 | tr -d '\\n\\r')\n    elif grep -q \"github.com\" ~\u002F.git-credentials 2>\u002Fdev\u002Fnull; then\n      GITHUB_TOKEN=$(grep \"github.com\" ~\u002F.git-credentials 2>\u002Fdev\u002Fnull | head -1 | sed 's|https:\u002F\u002F[^:]*:\\([^@]*\\)@.*|\\1|')\n    fi\n  fi\nfi\necho \"Using: $AUTH\"\n```\n\n### Extracting Owner\u002FRepo from the Git Remote\n\nMany `curl` commands need `owner\u002Frepo`. Extract it from the git remote:\n\n```bash\n# Works for both HTTPS and SSH remote URLs\nREMOTE_URL=$(git remote get-url origin)\nOWNER_REPO=$(echo \"$REMOTE_URL\" | sed -E 's|.*github\\.com[:\u002F]||; s|\\.git$||')\nOWNER=$(echo \"$OWNER_REPO\" | cut -d\u002F -f1)\nREPO=$(echo \"$OWNER_REPO\" | cut -d\u002F -f2)\necho \"Owner: $OWNER, Repo: $REPO\"\n```\n\n---\n\n## 1. Branch Creation\n\nThis part is pure `git` — identical either way:\n\n```bash\n# Make sure you're up to date\ngit fetch origin\ngit checkout main && git pull origin main\n\n# Create and switch to a new branch\ngit checkout -b feat\u002Fadd-user-authentication\n```\n\nBranch naming conventions:\n- `feat\u002Fdescription` — new features\n- `fix\u002Fdescription` — bug fixes\n- `refactor\u002Fdescription` — code restructuring\n- `docs\u002Fdescription` — documentation\n- `ci\u002Fdescription` — CI\u002FCD changes\n\n## 2. Making Commits\n\nUse the agent's file tools (`write_file`, `patch`) to make changes, then commit:\n\n```bash\n# Stage specific files\ngit add src\u002Fauth.py src\u002Fmodels\u002Fuser.py tests\u002Ftest_auth.py\n\n# Commit with a conventional commit message\ngit commit -m \"feat: add JWT-based user authentication\n\n- Add login\u002Fregister endpoints\n- Add User model with password hashing\n- Add auth middleware for protected routes\n- Add unit tests for auth flow\"\n```\n\nCommit message format (Conventional Commits):\n```\ntype(scope): short description\n\nLonger explanation if needed. Wrap at 72 characters.\n```\n\nTypes: `feat`, `fix`, `refactor`, `docs`, `test`, `ci`, `chore`, `perf`\n\n## 3. Pushing and Creating a PR\n\n### Push the Branch (same either way)\n\n```bash\ngit push -u origin HEAD\n```\n\n### Create the PR\n\n**With gh:**\n\n```bash\ngh pr create \\\n  --title \"feat: add JWT-based user authentication\" \\\n  --body \"## Summary\n- Adds login and register API endpoints\n- JWT token generation and validation\n\n## Test Plan\n- [ ] Unit tests pass\n\nCloses #42\"\n```\n\nOptions: `--draft`, `--reviewer user1,user2`, `--label \"enhancement\"`, `--base develop`\n\n**With git + curl:**\n\n```bash\nBRANCH=$(git branch --show-current)\n\ncurl -s -X POST \\\n  -H \"Authorization: token $GITHUB_TOKEN\" \\\n  -H \"Accept: application\u002Fvnd.github.v3+json\" \\\n  https:\u002F\u002Fapi.github.com\u002Frepos\u002F$OWNER\u002F$REPO\u002Fpulls \\\n  -d \"{\n    \\\"title\\\": \\\"feat: add JWT-based user authentication\\\",\n    \\\"body\\\": \\\"## Summary\\nAdds login and register API endpoints.\\n\\nCloses #42\\\",\n    \\\"head\\\": \\\"$BRANCH\\\",\n    \\\"base\\\": \\\"main\\\"\n  }\"\n```\n\nThe response JSON includes the PR `number` — save it for later commands.\n\nTo create as a draft, add `\"draft\": true` to the JSON body.\n\n## 4. Monitoring CI Status\n\n### Check CI Status\n\n**With gh:**\n\n```bash\n# One-shot check\ngh pr checks\n\n# Watch until all checks finish (polls every 10s)\ngh pr checks --watch\n```\n\n**With git + curl:**\n\n```bash\n# Get the latest commit SHA on the current branch\nSHA=$(git rev-parse HEAD)\n\n# Query the combined status\ncurl -s \\\n  -H \"Authorization: token $GITHUB_TOKEN\" \\\n  https:\u002F\u002Fapi.github.com\u002Frepos\u002F$OWNER\u002F$REPO\u002Fcommits\u002F$SHA\u002Fstatus \\\n  | python3 -c \"\nimport sys, json\ndata = json.load(sys.stdin)\nprint(f\\\"Overall: {data['state']}\\\")\nfor s in data.get('statuses', []):\n    print(f\\\"  {s['context']}: {s['state']} - {s.get('description', '')}\\\")\"\n\n# Also check GitHub Actions check runs (separate endpoint)\ncurl -s \\\n  -H \"Authorization: token $GITHUB_TOKEN\" \\\n  https:\u002F\u002Fapi.github.com\u002Frepos\u002F$OWNER\u002F$REPO\u002Fcommits\u002F$SHA\u002Fcheck-runs \\\n  | python3 -c \"\nimport sys, json\ndata = json.load(sys.stdin)\nfor cr in data.get('check_runs', []):\n    print(f\\\"  {cr['name']}: {cr['status']} \u002F {cr['conclusion'] or 'pending'}\\\")\"\n```\n\n### Poll Until Complete (git + curl)\n\n```bash\n# Simple polling loop — check every 30 seconds, up to 10 minutes\nSHA=$(git rev-parse HEAD)\nfor i in $(seq 1 20); do\n  STATUS=$(curl -s \\\n    -H \"Authorization: token $GITHUB_TOKEN\" \\\n    https:\u002F\u002Fapi.github.com\u002Frepos\u002F$OWNER\u002F$REPO\u002Fcommits\u002F$SHA\u002Fstatus \\\n    | python3 -c \"import sys,json; print(json.load(sys.stdin)['state'])\")\n  echo \"Check $i: $STATUS\"\n  if [ \"$STATUS\" = \"success\" ] || [ \"$STATUS\" = \"failure\" ] || [ \"$STATUS\" = \"error\" ]; then\n    break\n  fi\n  sleep 30\ndone\n```\n\n## 5. Auto-Fixing CI Failures\n\nWhen CI fails, diagnose and fix. This loop works with either auth method.\n\n### Step 1: Get Failure Details\n\n**With gh:**\n\n```bash\n# List recent workflow runs on this branch\ngh run list --branch $(git branch --show-current) --limit 5\n\n# View failed logs\ngh run view \u003CRUN_ID> --log-failed\n```\n\n**With git + curl:**\n\n```bash\nBRANCH=$(git branch --show-current)\n\n# List workflow runs on this branch\ncurl -s \\\n  -H \"Authorization: token $GITHUB_TOKEN\" \\\n  \"https:\u002F\u002Fapi.github.com\u002Frepos\u002F$OWNER\u002F$REPO\u002Factions\u002Fruns?branch=$BRANCH&per_page=5\" \\\n  | python3 -c \"\nimport sys, json\nruns = json.load(sys.stdin)['workflow_runs']\nfor r in runs:\n    print(f\\\"Run {r['id']}: {r['name']} - {r['conclusion'] or r['status']}\\\")\"\n\n# Get failed job logs (download as zip, extract, read)\nRUN_ID=\u003Crun_id>\ncurl -s -L \\\n  -H \"Authorization: token $GITHUB_TOKEN\" \\\n  https:\u002F\u002Fapi.github.com\u002Frepos\u002F$OWNER\u002F$REPO\u002Factions\u002Fruns\u002F$RUN_ID\u002Flogs \\\n  -o \u002Ftmp\u002Fci-logs.zip\ncd \u002Ftmp && unzip -o ci-logs.zip -d ci-logs && cat ci-logs\u002F*.txt\n```\n\n### Step 2: Fix and Push\n\nAfter identifying the issue, use file tools (`patch`, `write_file`) to fix it:\n\n```bash\ngit add \u003Cfixed_files>\ngit commit -m \"fix: resolve CI failure in \u003Ccheck_name>\"\ngit push\n```\n\n### Step 3: Verify\n\nRe-check CI status using the commands from Section 4 above.\n\n### Auto-Fix Loop Pattern\n\nWhen asked to auto-fix CI, follow this loop:\n\n1. Check CI status → identify failures\n2. Read failure logs → understand the error\n3. Use `read_file` + `patch`\u002F`write_file` → fix the code\n4. `git add . && git commit -m \"fix: ...\" && git push`\n5. Wait for CI → re-check status\n6. Repeat if still failing (up to 3 attempts, then ask the user)\n\n## 6. Merging\n\n**With gh:**\n\n```bash\n# Squash merge + delete branch (cleanest for feature branches)\ngh pr merge --squash --delete-branch\n\n# Enable auto-merge (merges when all checks pass)\ngh pr merge --auto --squash --delete-branch\n```\n\n**With git + curl:**\n\n```bash\nPR_NUMBER=\u003Cnumber>\n\n# Merge the PR via API (squash)\ncurl -s -X PUT \\\n  -H \"Authorization: token $GITHUB_TOKEN\" \\\n  https:\u002F\u002Fapi.github.com\u002Frepos\u002F$OWNER\u002F$REPO\u002Fpulls\u002F$PR_NUMBER\u002Fmerge \\\n  -d \"{\n    \\\"merge_method\\\": \\\"squash\\\",\n    \\\"commit_title\\\": \\\"feat: add user authentication (#$PR_NUMBER)\\\"\n  }\"\n\n# Delete the remote branch after merge\nBRANCH=$(git branch --show-current)\ngit push origin --delete $BRANCH\n\n# Switch back to main locally\ngit checkout main && git pull origin main\ngit branch -d $BRANCH\n```\n\nMerge methods: `\"merge\"` (merge commit), `\"squash\"`, `\"rebase\"`\n\n### Enable Auto-Merge (curl)\n\n```bash\n# Auto-merge requires the repo to have it enabled in settings.\n# This uses the GraphQL API since REST doesn't support auto-merge.\nPR_NODE_ID=$(curl -s \\\n  -H \"Authorization: token $GITHUB_TOKEN\" \\\n  https:\u002F\u002Fapi.github.com\u002Frepos\u002F$OWNER\u002F$REPO\u002Fpulls\u002F$PR_NUMBER \\\n  | python3 -c \"import sys,json; print(json.load(sys.stdin)['node_id'])\")\n\ncurl -s -X POST \\\n  -H \"Authorization: token $GITHUB_TOKEN\" \\\n  https:\u002F\u002Fapi.github.com\u002Fgraphql \\\n  -d \"{\\\"query\\\": \\\"mutation { enablePullRequestAutoMerge(input: {pullRequestId: \\\\\\\"$PR_NODE_ID\\\\\\\", mergeMethod: SQUASH}) { clientMutationId } }\\\"}\"\n```\n\n## 7. Complete Workflow Example\n\n```bash\n# 1. Start from clean main\ngit checkout main && git pull origin main\n\n# 2. Branch\ngit checkout -b fix\u002Flogin-redirect-bug\n\n# 3. (Agent makes code changes with file tools)\n\n# 4. Commit\ngit add src\u002Fauth\u002Flogin.py tests\u002Ftest_login.py\ngit commit -m \"fix: correct redirect URL after login\n\nPreserves the ?next= parameter instead of always redirecting to \u002Fdashboard.\"\n\n# 5. Push\ngit push -u origin HEAD\n\n# 6. Create PR (picks gh or curl based on what's available)\n# ... (see Section 3)\n\n# 7. Monitor CI (see Section 4)\n\n# 8. Merge when green (see Section 6)\n```\n\n## Useful PR Commands Reference\n\n| Action | gh | git + curl |\n|--------|-----|-----------|\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\"` |\n| View PR diff | `gh pr diff` | `git diff main...HEAD` (local) or `curl -H \"Accept: application\u002Fvnd.github.diff\" ...` |\n| Add comment | `gh pr comment N --body \"...\"` | `curl -X POST ...\u002Fissues\u002FN\u002Fcomments -d '{\"body\":\"...\"}'` |\n| Request review | `gh pr edit N --add-reviewer user` | `curl -X POST ...\u002Fpulls\u002FN\u002Frequested_reviewers -d '{\"reviewers\":[\"user\"]}'` |\n| Close PR | `gh pr close N` | `curl -X PATCH ...\u002Fpulls\u002FN -d '{\"state\":\"closed\"}'` |\n| Check out someone's PR | `gh pr checkout N` | `git fetch origin pull\u002FN\u002Fhead:pr-N && git checkout pr-N` |\n","# GitHub Pull Request Workflow\n\nComplete guide for managing the PR lifecycle. Each section shows the `gh` way first, then the `git` + `curl` fallback for machines without `gh`.\n\n## Prerequisites\n\n- Authenticated with GitHub (see `github-auth` skill)\n- Inside a git repository with a GitHub remote\n\n### Quick Auth Detection\n\n```bash\n# Determine which method to use throughout this workflow\nif command -v gh &>\u002Fdev\u002Fnull && gh auth status &>\u002Fdev\u002Fnull; then\n  AUTH=\"gh\"\nelse\n  AUTH=\"git\"\n  # Ensure we have a token for API calls\n  if [ -z \"$GITHUB_TOKEN\" ]; then\n    if [ -f ~\u002F.hermes\u002F.env ] && grep -q \"^GITHUB_TOKEN=\" ~\u002F.hermes\u002F.env; then\n      GITHUB_TOKEN=$(grep \"^GITHUB_TOKEN=\" ~\u002F.hermes\u002F.env | head -1 | cut -d= -f2 | tr -d '\\n\\r')\n    elif grep -q \"github.com\" ~\u002F.git-credentials 2>\u002Fdev\u002Fnull; then\n      GITHUB_TOKEN=$(grep \"github.com\" ~\u002F.git-credentials 2>\u002Fdev\u002Fnull | head -1 | sed 's|https:\u002F\u002F[^:]*:\\([^@]*\\)@.*|\\1|')\n    fi\n  fi\nfi\necho \"Using: $AUTH\"\n```\n\n### Extracting Owner\u002FRepo from the Git Remote\n\nMany `curl` commands need `owner\u002Frepo`. Extract it from the git remote:\n\n```bash\n# Works for both HTTPS and SSH remote URLs\nREMOTE_URL=$(git remote get-url origin)\nOWNER_REPO=$(echo \"$REMOTE_URL\" | sed -E 's|.*github\\.com[:\u002F]||; s|\\.git$||')\nOWNER=$(echo \"$OWNER_REPO\" | cut -d\u002F -f1)\nREPO=$(echo \"$OWNER_REPO\" | cut -d\u002F -f2)\necho \"Owner: $OWNER, Repo: $REPO\"\n```\n\n---\n\n## 1. Branch Creation\n\nThis part is pure `git` — identical either way:\n\n```bash\n# Make sure you're up to date\ngit fetch origin\ngit checkout main && git pull origin main\n\n# Create and switch to a new branch\ngit checkout -b feat\u002Fadd-user-authentication\n```\n\nBranch naming conventions:\n- `feat\u002Fdescription` — new features\n- `fix\u002Fdescription` — bug fixes\n- `refactor\u002Fdescription` — code restructuring\n- `docs\u002Fdescription` — documentation\n- `ci\u002Fdescription` — CI\u002FCD changes\n\n## 2. Making Commits\n\nUse the agent's file tools (`write_file`, `patch`) to make changes, then commit:\n\n```bash\n# Stage specific files\ngit add src\u002Fauth.py src\u002Fmodels\u002Fuser.py tests\u002Ftest_auth.py\n\n# Commit with a conventional commit message\ngit commit -m \"feat: add JWT-based user authentication\n\n- Add login\u002Fregister endpoints\n- Add User model with password hashing\n- Add auth middleware for protected routes\n- Add unit tests for auth flow\"\n```\n\nCommit message format (Conventional Commits):\n```\ntype(scope): short description\n\nLonger explanation if needed. Wrap at 72 characters.\n```\n\nTypes: `feat`, `fix`, `refactor`, `docs`, `test`, `ci`, `chore`, `perf`\n\n## 3. Pushing and Creating a PR\n\n### Push the Branch (same either way)\n\n```bash\ngit push -u origin HEAD\n```\n\n### Create the PR\n\n**With gh:**\n\n```bash\ngh pr create \\\n  --title \"feat: add JWT-based user authentication\" \\\n  --body \"## Summary\n- Adds login and register API endpoints\n- JWT token generation and validation\n\n## Test Plan\n- [ ] Unit tests pass\n\nCloses #42\"\n```\n\nOptions: `--draft`, `--reviewer user1,user2`, `--label \"enhancement\"`, `--base develop`\n\n**With git + curl:**\n\n```bash\nBRANCH=$(git branch --show-current)\n\ncurl -s -X POST \\\n  -H \"Authorization: token $GITHUB_TOKEN\" \\\n  -H \"Accept: application\u002Fvnd.github.v3+json\" \\\n  https:\u002F\u002Fapi.github.com\u002Frepos\u002F$OWNER\u002F$REPO\u002Fpulls \\\n  -d \"{\n    \\\"title\\\": \\\"feat: add JWT-based user authentication\\\",\n    \\\"body\\\": \\\"## Summary\\nAdds login and register API endpoints.\\n\\nCloses #42\\\",\n    \\\"head\\\": \\\"$BRANCH\\\",\n    \\\"base\\\": \\\"main\\\"\n  }\"\n```\n\nThe response JSON includes the PR `number` — save it for later commands.\n\nTo create as a draft, add `\"draft\": true` to the JSON body.\n\n## 4. Monitoring CI Status\n\n### Check CI Status\n\n**With gh:**\n\n```bash\n# One-shot check\ngh pr checks\n\n# Watch until all checks finish (polls every 10s)\ngh pr checks --watch\n```\n\n**With git + curl:**\n\n```bash\n# Get the latest commit SHA on the current branch\nSHA=$(git rev-parse HEAD)\n\n# Query the combined status\ncurl -s \\\n  -H \"Authorization: token $GITHUB_TOKEN\" \\\n  https:\u002F\u002Fapi.github.com\u002Frepos\u002F$OWNER\u002F$REPO\u002Fcommits\u002F$SHA\u002Fstatus \\\n  | python3 -c \"\nimport sys, json\ndata = json.load(sys.stdin)\nprint(f\\\"Overall: {data['state']}\\\")\nfor s in data.get('statuses', []):\n    print(f\\\"  {s['context']}: {s['state']} - {s.get('description', '')}\\\")\"\n\n# Also check GitHub Actions check runs (separate endpoint)\ncurl -s \\\n  -H \"Authorization: token $GITHUB_TOKEN\" \\\n  https:\u002F\u002Fapi.github.com\u002Frepos\u002F$OWNER\u002F$REPO\u002Fcommits\u002F$SHA\u002Fcheck-runs \\\n  | python3 -c \"\nimport sys, json\ndata = json.load(sys.stdin)\nfor cr in data.get('check_runs', []):\n    print(f\\\"  {cr['name']}: {cr['status']} \u002F {cr['conclusion'] or 'pending'}\\\")\"\n```\n\n### Poll Until Complete (git + curl)\n\n```bash\n# Simple polling loop — check every 30 seconds, up to 10 minutes\nSHA=$(git rev-parse HEAD)\nfor i in $(seq 1 20); do\n  STATUS=$(curl -s \\\n    -H \"Authorization: token $GITHUB_TOKEN\" \\\n    https:\u002F\u002Fapi.github.com\u002Frepos\u002F$OWNER\u002F$REPO\u002Fcommits\u002F$SHA\u002Fstatus \\\n    | python3 -c \"import sys,json; print(json.load(sys.stdin)['state'])\")\n  echo \"Check $i: $STATUS\"\n  if [ \"$STATUS\" = \"success\" ] || [ \"$STATUS\" = \"failure\" ] || [ \"$STATUS\" = \"error\" ]; then\n    break\n  fi\n  sleep 30\ndone\n```\n\n## 5. Auto-Fixing CI Failures\n\nWhen CI fails, diagnose and fix. This loop works with either auth method.\n\n### Step 1: Get Failure Details\n\n**With gh:**\n\n```bash\n# List recent workflow runs on this branch\ngh run list --branch $(git branch --show-current) --limit 5\n\n# View failed logs\ngh run view \u003CRUN_ID> --log-failed\n```\n\n**With git + curl:**\n\n```bash\nBRANCH=$(git branch --show-current)\n\n# List workflow runs on this branch\ncurl -s \\\n  -H \"Authorization: token $GITHUB_TOKEN\" \\\n  \"https:\u002F\u002Fapi.github.com\u002Frepos\u002F$OWNER\u002F$REPO\u002Factions\u002Fruns?branch=$BRANCH&per_page=5\" \\\n  | python3 -c \"\nimport sys, json\nruns = json.load(sys.stdin)['workflow_runs']\nfor r in runs:\n    print(f\\\"Run {r['id']}: {r['name']} - {r['conclusion'] or r['status']}\\\")\"\n\n# Get failed job logs (download as zip, extract, read)\nRUN_ID=\u003Crun_id>\ncurl -s -L \\\n  -H \"Authorization: token $GITHUB_TOKEN\" \\\n  https:\u002F\u002Fapi.github.com\u002Frepos\u002F$OWNER\u002F$REPO\u002Factions\u002Fruns\u002F$RUN_ID\u002Flogs \\\n  -o \u002Ftmp\u002Fci-logs.zip\ncd \u002Ftmp && unzip -o ci-logs.zip -d ci-logs && cat ci-logs\u002F*.txt\n```\n\n### Step 2: Fix and Push\n\nAfter identifying the issue, use file tools (`patch`, `write_file`) to fix it:\n\n```bash\ngit add \u003Cfixed_files>\ngit commit -m \"fix: resolve CI failure in \u003Ccheck_name>\"\ngit push\n```\n\n### Step 3: Verify\n\nRe-check CI status using the commands from Section 4 above.\n\n### Auto-Fix Loop Pattern\n\nWhen asked to auto-fix CI, follow this loop:\n\n1. Check CI status → identify failures\n2. Read failure logs → understand the error\n3. Use `read_file` + `patch`\u002F`write_file` → fix the code\n4. `git add . && git commit -m \"fix: ...\" && git push`\n5. Wait for CI → re-check status\n6. Repeat if still failing (up to 3 attempts, then ask the user)\n\n## 6. Merging\n\n**With gh:**\n\n```bash\n# Squash merge + delete branch (cleanest for feature branches)\ngh pr merge --squash --delete-branch\n\n# Enable auto-merge (merges when all checks pass)\ngh pr merge --auto --squash --delete-branch\n```\n\n**With git + curl:**\n\n```bash\nPR_NUMBER=\u003Cnumber>\n\n# Merge the PR via API (squash)\ncurl -s -X PUT \\\n  -H \"Authorization: token $GITHUB_TOKEN\" \\\n  https:\u002F\u002Fapi.github.com\u002Frepos\u002F$OWNER\u002F$REPO\u002Fpulls\u002F$PR_NUMBER\u002Fmerge \\\n  -d \"{\n    \\\"merge_method\\\": \\\"squash\\\",\n    \\\"commit_title\\\": \\\"feat: add user authentication (#$PR_NUMBER)\\\"\n  }\"\n\n# Delete the remote branch after merge\nBRANCH=$(git branch --show-current)\ngit push origin --delete $BRANCH\n\n# Switch back to main locally\ngit checkout main && git pull origin main\ngit branch -d $BRANCH\n```\n\nMerge methods: `\"merge\"` (merge commit), `\"squash\"`, `\"rebase\"`\n\n### Enable Auto-Merge (curl)\n\n```bash\n# Auto-merge requires the repo to have it enabled in settings.\n# This uses the GraphQL API since REST doesn't support auto-merge.\nPR_NODE_ID=$(curl -s \\\n  -H \"Authorization: token $GITHUB_TOKEN\" \\\n  https:\u002F\u002Fapi.github.com\u002Frepos\u002F$OWNER\u002F$REPO\u002Fpulls\u002F$PR_NUMBER \\\n  | python3 -c \"import sys,json; print(json.load(sys.stdin)['node_id'])\")\n\ncurl -s -X POST \\\n  -H \"Authorization: token $GITHUB_TOKEN\" \\\n  https:\u002F\u002Fapi.github.com\u002Fgraphql \\\n  -d \"{\\\"query\\\": \\\"mutation { enablePullRequestAutoMerge(input: {pullRequestId: \\\\\\\"$PR_NODE_ID\\\\\\\", mergeMethod: SQUASH}) { clientMutationId } }\\\"}\"\n```\n\n## 7. Complete Workflow Example\n\n```bash\n# 1. Start from clean main\ngit checkout main && git pull origin main\n\n# 2. Branch\ngit checkout -b fix\u002Flogin-redirect-bug\n\n# 3. (Agent makes code changes with file tools)\n\n# 4. Commit\ngit add src\u002Fauth\u002Flogin.py tests\u002Ftest_login.py\ngit commit -m \"fix: correct redirect URL after login\n\nPreserves the ?next= parameter instead of always redirecting to \u002Fdashboard.\"\n\n# 5. Push\ngit push -u origin HEAD\n\n# 6. Create PR (picks gh or curl based on what's available)\n# ... (see Section 3)\n\n# 7. Monitor CI (see Section 4)\n\n# 8. Merge when green (see Section 6)\n```\n\n## Useful PR Commands Reference\n\n| Action | gh | git + curl |\n|--------|-----|-----------|\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\"` |\n| View PR diff | `gh pr diff` | `git diff main...HEAD` (local) or `curl -H \"Accept: application\u002Fvnd.github.diff\" ...` |\n| Add comment | `gh pr comment N --body \"...\"` | `curl -X POST ...\u002Fissues\u002FN\u002Fcomments -d '{\"body\":\"...\"}'` |\n| Request review | `gh pr edit N --add-reviewer user` | `curl -X POST ...\u002Fpulls\u002FN\u002Frequested_reviewers -d '{\"reviewers\":[\"user\"]}'` |\n| Close PR | `gh pr close N` | `curl -X PATCH ...\u002Fpulls\u002FN -d '{\"state\":\"closed\"}'` |\n| Check out someone's PR | `gh pr checkout N` | `git fetch origin pull\u002FN\u002Fhead:pr-N && git checkout pr-N` |\n",{"name":5,"author":48,"license":14,"version":49,"metadata":50,"description":7},"Hermes Agent","1.1.0",{"hermes":51},{"tags":52,"related_skills":59},[53,54,55,56,57,58],"GitHub","Pull-Requests","CI\u002FCD","Git","Automation","Merge",[60,61],"github-auth","github-code-review","master","a76a61826887171cb38ce217ae85643d5d7685d1","hermes_home\u002Fprofiles\u002Flive\u002Fskills\u002Fgithub\u002Fgithub-pr-workflow",2,"https:\u002F\u002Fgithub.com\u002F0xzgbot\u002Fforge-nps-v01","https:\u002F\u002Fgithub.com\u002F0xzgbot","2026-08-31 09:13:28",{"source":8,"skillName":5,"commands":70,"prompt":80,"zipAvailable":81},[71,74,77],{"tool":72,"command":73},"npx","npx skills add 0xzgbot\u002Fforge-nps-v01 --skill github-pr-workflow",{"tool":75,"command":76},"bunx","bunx skills add 0xzgbot\u002Fforge-nps-v01 --skill github-pr-workflow",{"tool":78,"command":79},"pnpm","pnpm dlx skills add 0xzgbot\u002Fforge-nps-v01 --skill github-pr-workflow","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002F0xzgbot\u002Fforge-nps-v01\u002Fblob\u002Fmaster\u002Fhermes_home\u002Fprofiles\u002Flive\u002Fskills\u002Fgithub\u002Fgithub-pr-workflow\u002FSKILL.md",true,[83,89,93,97],{"path":84,"resourceType":85,"resourceTypeDesc":86,"sizeBytes":87,"sourceHtmlUrl":88},"references\u002Fci-troubleshooting.md","REFERENCE","参考文档",4879,"https:\u002F\u002Fgithub.com\u002F0xzgbot\u002Fforge-nps-v01\u002Fblob\u002Fmaster\u002Fhermes_home\u002Fprofiles\u002Flive\u002Fskills\u002Fgithub\u002Fgithub-pr-workflow\u002Freferences\u002Fci-troubleshooting.md",{"path":90,"resourceType":85,"resourceTypeDesc":86,"sizeBytes":91,"sourceHtmlUrl":92},"references\u002Fconventional-commits.md",2417,"https:\u002F\u002Fgithub.com\u002F0xzgbot\u002Fforge-nps-v01\u002Fblob\u002Fmaster\u002Fhermes_home\u002Fprofiles\u002Flive\u002Fskills\u002Fgithub\u002Fgithub-pr-workflow\u002Freferences\u002Fconventional-commits.md",{"path":94,"resourceType":85,"resourceTypeDesc":86,"sizeBytes":95,"sourceHtmlUrl":96},"templates\u002Fpr-body-bugfix.md",513,"https:\u002F\u002Fgithub.com\u002F0xzgbot\u002Fforge-nps-v01\u002Fblob\u002Fmaster\u002Fhermes_home\u002Fprofiles\u002Flive\u002Fskills\u002Fgithub\u002Fgithub-pr-workflow\u002Ftemplates\u002Fpr-body-bugfix.md",{"path":98,"resourceType":85,"resourceTypeDesc":86,"sizeBytes":99,"sourceHtmlUrl":100},"templates\u002Fpr-body-feature.md",580,"https:\u002F\u002Fgithub.com\u002F0xzgbot\u002Fforge-nps-v01\u002Fblob\u002Fmaster\u002Fhermes_home\u002Fprofiles\u002Flive\u002Fskills\u002Fgithub\u002Fgithub-pr-workflow\u002Ftemplates\u002Fpr-body-feature.md",[102,115,132,146,157,169],{"skillNo":103,"name":104,"nameZh":6,"description":105,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":106,"categories":107,"keywords":108,"publishedAt":43},"01M71J5TFCV7K97773JYZE7ET8","yuanbao","Yuanbao (元宝) groups: @mention users, query info\u002Fmembers.","https:\u002F\u002Fgithub.com\u002F0xzgbot\u002Fforge-nps-v01\u002Fblob\u002Fmaster\u002Fhermes_home\u002Fskills\u002Fyuanbao\u002FSKILL.md",[],[104,109,110,111,112,113,114],"groups","at","info","users","query","group",{"skillNo":116,"name":117,"nameZh":6,"description":118,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":119,"categories":120,"keywords":125,"publishedAt":43},"01M71J5QR69MCT5J8P3B4Y9ZHA","workflow-ltx-i2v","Use when the task involves workflow ltx i2v. DESCRIPTION.","https:\u002F\u002Fgithub.com\u002F0xzgbot\u002Fforge-nps-v01\u002Fblob\u002Fmaster\u002Fhermes_home\u002Fskills\u002Fworkflow_ltx_i2v\u002FSKILL.md",[121,124],{"categoryNo":122,"categoryName":123,"taxonomyType":20,"taxonomyTypeDesc":21},"01JBSEEDCAT000000000000016","图像与多媒体",{"categoryNo":18,"categoryName":19,"taxonomyType":20,"taxonomyTypeDesc":21},[126,127,24,128,129,130,131],"ltx","workflow ltx i2v","Production","task","when","use",{"skillNo":133,"name":134,"nameZh":6,"description":135,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":136,"categories":137,"keywords":140,"publishedAt":43},"01M71J5NYW853AAPB17VR0F7ZX","workflow-flux2-text-to-image","Flux2 Text-to-Image Workflow Reference.","https:\u002F\u002Fgithub.com\u002F0xzgbot\u002Fforge-nps-v01\u002Fblob\u002Fmaster\u002Fhermes_home\u002Fskills\u002Fworkflow_flux2_text_to_image\u002FSKILL.md",[138,139],{"categoryNo":122,"categoryName":123,"taxonomyType":20,"taxonomyTypeDesc":21},{"categoryNo":18,"categoryName":19,"taxonomyType":20,"taxonomyTypeDesc":21},[141,142,24,143,144,128,145],"workflow flux2 text to image","image","text","reference","Text-to-Image",{"skillNo":147,"name":148,"nameZh":6,"description":149,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":150,"categories":151,"keywords":153,"publishedAt":43},"01M71J5KWY96MD6B6YC2XP6NXB","wide-angle-environmental","Use when the task involves wide angle environmental. DESCRIPTION.","https:\u002F\u002Fgithub.com\u002F0xzgbot\u002Fforge-nps-v01\u002Fblob\u002Fmaster\u002Fhermes_home\u002Fskills\u002Fwide_angle_environmental\u002FSKILL.md",[152],{"categoryNo":18,"categoryName":19,"taxonomyType":20,"taxonomyTypeDesc":21},[154,155,156,128,129,130,131],"environmental","wide","wide angle environmental",{"skillNo":158,"name":159,"nameZh":6,"description":160,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":161,"categories":162,"keywords":164,"publishedAt":43},"01M71J5DXHECTDVDF8HRP81YFY","wes-anderson-specialist","Use when the task involves wes anderson specialist. 1. EXECUTIVE SUMMARY.","https:\u002F\u002Fgithub.com\u002F0xzgbot\u002Fforge-nps-v01\u002Fblob\u002Fmaster\u002Fhermes_home\u002Fskills\u002Fwes_anderson_specialist\u002FSKILL.md",[163],{"categoryNo":18,"categoryName":19,"taxonomyType":20,"taxonomyTypeDesc":21},[165,166,167,168,130,131,129,128],"specialist","wes anderson specialist","summary","executive summary",{"skillNo":170,"name":171,"nameZh":6,"description":172,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":173,"categories":174,"keywords":176,"publishedAt":43},"01M71J5BRHX2N4BRG2VQMWJK3E","volumetric-god-rays-lighting","Use when the task involves volumetric god rays lighting. DESCRIPTION.","https:\u002F\u002Fgithub.com\u002F0xzgbot\u002Fforge-nps-v01\u002Fblob\u002Fmaster\u002Fhermes_home\u002Fskills\u002Fvolumetric_god_rays_lighting\u002FSKILL.md",[175],{"categoryNo":18,"categoryName":19,"taxonomyType":20,"taxonomyTypeDesc":21},[177,178,131,130,129,128],"volumetric god rays lighting","lighting"]