github-pr-workflow
Skill4 starsChanged 19 days agoMITView on GitHub
GitHub PR lifecycle: branch, commit, open, CI, merge.
- Reads credentials
- Sends data out
- Commits and pushes
28 other projects use a version of this, 21 of them edited.
Adopted by
Most recently taken up by
- openamer-max/max-scriptsedited, first seen Nov 29, 2026
- marcioaltoe/skillstheir own version, first seen Nov 29, 2026
- aboylabs/ai-agent-skillsedited, first seen Nov 22, 2026
- delorenj/skillsedited, first seen Nov 7, 2026
- ethosagent/ethostheir own version, first seen Nov 3, 2026
- drvoss/everything-copilot-clitheir own version, first seen Oct 26, 2026
Used with
Projects with it also use find-nearby, native-mcp and 10 more.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
math-incSkillfind-nearby
Find nearby places (restaurants, cafes, bars, pharmacies, etc.) using OpenStreetMap. Works with coordinates, addresses, cities, zip codes, or Telegram location pins. No API keys needed.
Also in 3 projects that use this
math-incSkillnative-mcp
Built-in MCP (Model Context Protocol) client that connects to external MCP servers, discovers their tools, and registers them as native Gauss Agent tools. Supports stdio and HTTP transports with automatic reconnection, security filtering, and zero-config tool injection.
Also in 6 projects that use this
Tommy-ywSkillwebhook-subscriptions
Create and manage webhook subscriptions for event-driven agent activation, or for direct push notifications (zero LLM cost). Use when the user wants external services to trigger agent runs OR push notifications to chats.
Also in 3 projects that use this
OmniJeffSkillascii-art
Generate ASCII art for software projects — text banners, decorative borders/boxes, icons, and logos. Supports themes, figlet fonts, ANSI colors, and inline code file insertion with auto-detected comment syntax. Use proactively when scaffolding projects or adding file headers, section dividers, or decorative comments.
Also in 5 projects that use this
- +8 more from math-inc
Other versions28 projects use a version of this.
Word for word · 0
None found.
Edited · 21
- math-inc/OpenGauss★ 1.3k93% same
- Tommy-yw/RunbookHermes★ 54693% same
- RedWoodOG/Hermes-Desktop★ 17793% same
- AtlasOmnia/donna-starter★ 13694% same
- AtlasOmnia/hermes-custom-pack★ 8794% same
- delorenj/skills★ 1796% same
- gquthier/CLAWG★ 1693% same
- aboylabs/ai-agent-skills★ 1594% same
- Samin12/skills★ 1095% same
- techysy/yangyu-hermes-skills★ 883% same
11 more not listed
Wrote their own version · 7
- HybridAIOne/hybridclaw★ 165same name
- drvoss/everything-copilot-cli★ 49same name
- YPares/agent-skills★ 31same name
- ethosagent/ethos★ 23same name
- Martin-Hausleitner/martins-awesome-skills★ 3same name
- microsoft/amplifier-app-paperclip★ 1same name
- marcioaltoe/skills★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository17 other files it gives its agents.
- AGENTS.mdAGENTS.md
- charts-in-postsSkill
- choreographySkill
- clean-writingSkill
- control-planeSkill
- councilSkill
- exo-busSkill
- exo-handoffSkill
- exo-introSkill
- git-authorship-identity-cleanupSkill
- github-draft-review-htmlSkill
- github-issuesSkill
- github-issue-to-prSkill
- github-pr-auditSkill
- jevgrepSkill
- operating-doctrineSkill
- sym-protocolSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
22 rules. 6 are common, 10 are distinctive, and 6 are very specific to this project.
6
Common
Most of the 28 edited versions we read keep these.
10
Distinctive
This author's own choices. Worth a look.
6
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 80
Use the agent's file tools (write_file, patch) to make changes, then commit:
- Common: line 95
Commit message format (Conventional Commits):
- Distinctive: line 112
Read the area's AGENTS.md and the user docs first, including any "do not fix this" list, and quote the line that settles intent.
- Distinctive: line 139
Write the body as an evidence register, not an investigation diary:
- Distinctive: line 143
Use one row per fix area. Count each area once at its highest impact.
- Distinctive: line 146
Keep the body short enough to scan.
- Distinctive: line 198
Every item this merge needs to close gets its own bare keyword line: Closes #N, Fixes #N, or Resolves #N.
- Distinctive: line 200
Before merge, open the Development sidebar on the PR.
- Common: line 268
When CI fails, diagnose and fix.
- Very specific: line 308
After identifying the issue, use file tools (patch, write_file) to fix it:
- Common: line 322
When asked to auto-fix CI, follow this loop:
- Common: line 324
Check CI status → identify failures
- Common: line 325
Read failure logs → understand the error
- Very specific: line 326
Use read_file + patch/write_file → fix the code
- Common: line 328
Wait for CI → re-check status
- Distinctive: line 333
Do not treat a PR that is not immediately mergeable as disposable.
- Distinctive: line 336
If the issue is mechanical and low-risk (rebase conflict, stale generated output, missing documentation link, formatting, a narrow test …
- Distinctive: line 337
If the issue is a small semantic mismatch that can be resolved without inventing product policy, propose and apply the narrowest compatible …
- Distinctive: line 340
Verify the updated head, checks, diff scope, and relevant live or generated artifact before reporting merge readiness.
- Very specific: line 346
When a --force push is forbidden (or history must stay append-only), update a stale PR branch by merging origin/main into the branch.
- Very specific: line 351
After the merge, restate the PR's scope as the three-dot diff git diff --stat origin/main...HEAD: it should equal the PR's original file …
- Very specific: line 377
Verify the posted body, not just the POST response: gh api repos/$OWNER/$REPO/pulls/$N/reviews/$ID --jq '.body' | head -3.
“Common” is measured: kept by at least 6 in 10 of the 28 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
GitHub Pull Request Workflow
Complete guide for managing the PR lifecycle. Each section shows the gh way first, then the git + curl fallback for machines without gh.
Prerequisites
- Authenticated with GitHub (see
github-authskill) - Inside a git repository with a GitHub remote
Quick Auth Detection
# Determine which method to use throughout this workflow
if command -v gh &>/dev/null && gh auth status &>/dev/null; then
AUTH="gh"
else
AUTH="git"
# Ensure we have a token for API calls
if [ -z "$GITHUB_TOKEN" ]; then
if _hermes_env="${HERMES_HOME:-$HOME/.hermes}/.env"; [ -f "$_hermes_env" ] && grep -q "^GITHUB_TOKEN=" "$_hermes_env"; then
GITHUB_TOKEN=$(grep "^GITHUB_TOKEN=" "$_hermes_env" | head -1 | cut -d= -f2 | tr -d '\n\r')
elif grep -q "github.com" ~/.git-credentials 2>/dev/null; then
GITHUB_TOKEN=$(uv run python "${HERMES_HOME:-$HOME/.hermes}/skills/github/github-auth/scripts/git-credential-token.py")
fi
fi
fi
echo "Using: $AUTH"Extracting Owner/Repo from the Git Remote
Many curl commands need owner/repo. Extract it from the git remote:
# Works for both HTTPS and SSH remote URLs
REMOTE_URL=$(git remote get-url origin)
OWNER_REPO=$(echo "$REMOTE_URL" | sed -E 's|.*github\.com[:/]||; s|\.git$||')
OWNER=$(echo "$OWNER_REPO" | cut -d/ -f1)
REPO=$(echo "$OWNER_REPO" | cut -d/ -f2)
echo "Owner: $OWNER, Repo: $REPO"1. Branch Creation
This part is pure git — identical either way:
# Make sure you're up to date
git fetch origin
git checkout main && git pull origin main
# Create and switch to a new branch
git checkout -b feat/add-user-authenticationBranch naming conventions:
feat/description— new featuresfix/description— bug fixesrefactor/description— code restructuringdocs/description— documentationci/description— CI/CD changes
2. Making Commits
Use the agent's file tools (write_file, patch) to make changes, then commit:
# Stage specific files
git add src/auth.py src/models/user.py tests/test_auth.py
# Commit with a conventional commit message
git commit -m "feat: add JWT-based user authentication
- Add login/register endpoints
- Add User model with password hashing
- Add auth middleware for protected routes
- Add unit tests for auth flow"Commit message format (Conventional Commits):
type(scope): short description
Longer explanation if needed. Wrap at 72 characters.Types: feat, fix, refactor, docs, test, ci, chore, perf
2a. Before the fix: prove the finding is a defect, not the design
A fix is worth writing only when the behaviour is actually wrong. Clear one bar and write down which:
- User-visible failure — duplicate execution, wrong or lost data, a crash, a hang.
- Written invariant violated — name the document and quote the line.
- Unintended behaviour proven — a surface requests a resource that nothing needs.
Read the area's AGENTS.md and the user docs first, including any "do not fix this" list, and quote
the line that settles intent. An extra process, an extra connection, or two holders of one file is
usually the documented architecture; the mechanism is not the harm, so state both the mechanism and
the failure it causes, plus the falsifier that would show the behaviour is intended. When the change
lands on a design decision rather than a defect, it is a feature proposal for the maintainers, not a
patch — say so instead of shipping code.
2b. Prove the fix on the live system before the PR exists
Unit tests prove the function is right on the inputs you handed it. They do not prove it is reached when the bug happens, or that its inputs are populated then. For any fix that changes runtime behavior — process spawn/reap, file writes, routing, resolution chains, lifecycle — prove it on the running system first, and open the PR only after that run:
- Load the artifact the real entry point loads. Rebuild the bundle/binary the app actually imports (a stale build silently exercises the old code) and confirm your change is present in it.
- Reproduce the original symptom, not a proxy for it. Capture the process tree with parent PIDs, the listening ports,
lsofon the contested file, and the record your decision reads. - Show the symptom is gone and nothing new appeared. A quiet log is not evidence that a process stopped spawning.
- Say in the PR body what the live run covered and what it did not.
- If the live run shows the fix does not work, do not open the PR. Fix it first, or file the reproduction as an issue and say so. Withdrawing a PR after a reviewer has already spent time on it costs far more trust than the live run costs time.
Problem/solution pairing (required for every issue and PR)
Treat the issue as the problem statement and the PR as its proposed/implemented solution. Before opening either, search the repository for its counterpart so the work is not split across duplicate records. Every PR must link the issue that defines the problem; every issue must link its proposed or implementing PR. If creating a PR and no suitable issue exists, create the issue first with the observed problem, impact, evidence, and proposed solution, then link it from the PR body (Fixes #N when merge should close the issue, otherwise Refs #N). If creating an issue and no solution PR exists yet, state a concrete proposed solution and create/link the PR when implementation is ready. Do not leave a completed issue/PR pair without reciprocal links.
Verify both links by reading back the issue and PR bodies. Put the issue reference in the PR body, not a new PR comment solely to add a link; a comment sends an unnecessary notification. Avoid duplicate issues when the PR body already points to the relevant tracker, and avoid duplicate PRs when an issue already has a proposed implementation.
3. Pushing and Creating a PR
PR body register
Write the body as an evidence register, not an investigation diary:
- Open with one plain sentence describing the changed behavior.
- Separate root cause, changed paths, validation, and follow-ups.
- Use one row per fix area. Count each area once at its highest impact.
- Tie every row to a commit or path and a real test result. Label the exact head, environment, and any unverified surface.
- Separate included fixes from new requests, overlaps, and unresolved findings.
- Keep the body short enough to scan. Preserve test counts and the evidence boundary; cut search narration and repeated conclusions.
A reviewer must be able to identify the scope, proof, and remaining limits without reconstructing the author's investigation.
Push the Branch (same either way)
git push -u origin HEADCreate the PR
With gh:
gh pr create \
--title "feat: add JWT-based user authentication" \
--body "## Summary
- Adds login and register API endpoints
- JWT token generation and validation
## Test Plan
- [ ] Unit tests pass
Closes #42"Options: --draft, --reviewer user1,user2, --label "enhancement", --base develop
With git + curl:
BRANCH=$(git branch --show-current)
curl -s -X POST \
-H "Authorization: token $GITHUB_TOKEN" \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/repos/$OWNER/$REPO/pulls \
-d "{
\"title\": \"feat: add JWT-based user authentication\",
\"body\": \"## Summary\nAdds login and register API endpoints.\n\nCloses #42\",
\"head\": \"$BRANCH\",
\"base\": \"main\"
}"The response JSON includes the PR number — save it for later commands.
To create as a draft, add "draft": true to the JSON body.
Close lines in the PR body.
Every item this merge needs to close gets its own bare keyword line: Closes #N, Fixes #N, or Resolves #N. Place the lines together near the end of the body, after the change list and before validation. Each number appears once in the whole body.
Before merge, open the Development sidebar on the PR. Each item the merge needs to close must show there as linked. A missing entry means a missing or mistyped line. Fix it before merge.
Some items are named in the body with no keyword line. An item that is already closed takes none. A live thread kept open on purpose takes none. A smaller fold covered by a larger one is named with no keyword line. The one exception: when the head commit fixes the smaller fold's symptom, it takes a keyword line like the rest.
The near-end placement follows the pattern in #119652.
4. Monitoring CI Status
Check CI Status
With gh:
# One-shot check
gh pr checks
# Watch until all checks finish (polls every 10s)
gh pr checks --watchWith git + curl:
# Get the latest commit SHA on the current branch
SHA=$(git rev-parse HEAD)
# Query the combined status
curl -s \
-H "Authorization: token $GITHUB_TOKEN" \
https://api.github.com/repos/$OWNER/$REPO/commits/$SHA/status \
| python -c "
import sys, json
data = json.load(sys.stdin)
print(f\"Overall: {data['state']}\")
for s in data.get('statuses', []):
print(f\" {s['context']}: {s['state']} - {s.get('description', '')}\")"
# Also check GitHub Actions check runs (separate endpoint)
curl -s \
-H "Authorization: token $GITHUB_TOKEN" \
https://api.github.com/repos/$OWNER/$REPO/commits/$SHA/check-runs \
| python -c "
import sys, json
data = json.load(sys.stdin)
for cr in data.get('check_runs', []):
print(f\" {cr['name']}: {cr['status']} / {cr['conclusion'] or 'pending'}\")"Poll Until Complete (git + curl)
# Simple polling loop — check every 30 seconds, up to 10 minutes
SHA=$(git rev-parse HEAD)
for i in $(seq 1 20); do
STATUS=$(curl -s \
-H "Authorization: token $GITHUB_TOKEN" \
https://api.github.com/repos/$OWNER/$REPO/commits/$SHA/status \
| python -c "import sys,json; print(json.load(sys.stdin)['state'])")
echo "Check $i: $STATUS"
if [ "$STATUS" = "success" ] || [ "$STATUS" = "failure" ] || [ "$STATUS" = "error" ]; then
break
fi
sleep 30
done5. Auto-Fixing CI Failures
When CI fails, diagnose and fix. This loop works with either auth method.
Step 1: Get Failure Details
With gh:
# List recent workflow runs on this branch
gh run list --branch $(git branch --show-current) --limit 5
# View failed logs
gh run view <RUN_ID> --log-failedWith git + curl:
BRANCH=$(git branch --show-current)
# List workflow runs on this branch
curl -s \
-H "Authorization: token $GITHUB_TOKEN" \
"https://api.github.com/repos/$OWNER/$REPO/actions/runs?branch=$BRANCH&per_page=5" \
| python -c "
import sys, json
runs = json.load(sys.stdin)['workflow_runs']
for r in runs:
print(f\"Run {r['id']}: {r['name']} - {r['conclusion'] or r['status']}\")"
# Get failed job logs (download as zip, extract, read)
RUN_ID=<run_id>
curl -s -L \
-H "Authorization: token $GITHUB_TOKEN" \
https://api.github.com/repos/$OWNER/$REPO/actions/runs/$RUN_ID/logs \
-o /tmp/ci-logs.zip
cd /tmp && unzip -o ci-logs.zip -d ci-logs && cat ci-logs/*.txtStep 2: Fix and Push
After identifying the issue, use file tools (patch, write_file) to fix it:
git add <fixed_files>
git commit -m "fix: resolve CI failure in <check_name>"
git pushStep 3: Verify
Re-check CI status using the commands from Section 4 above.
Auto-Fix Loop Pattern
When asked to auto-fix CI, follow this loop:
- Check CI status → identify failures
- Read failure logs → understand the error
- Use
read_file+patch/write_file→ fix the code git add . && git commit -m "fix: ..." && git push- Wait for CI → re-check status
- Repeat if still failing (up to 3 attempts, then ask the user)
6. Merge readiness: repair before rejection
Do not treat a PR that is not immediately mergeable as disposable. Separate the change from the branch state and the review findings:
- Inspect the current diff, intent, tests, provenance, and dependency boundaries.
- If the issue is mechanical and low-risk (rebase conflict, stale generated output, missing documentation link, formatting, a narrow test correction), repair it on the PR branch when authorized, then rerun the complete gates.
- If the issue is a small semantic mismatch that can be resolved without inventing product policy, propose and apply the narrowest compatible adjustment, and explain it in a PR comment.
- If the PR is deeply incompatible with current architecture, do not close or discard it silently. Leave a concrete maintainer comment identifying the conflicting current paths/invariants, the required rebase or redesign, the acceptance tests, and the next mergeable shape. Keep the PR open unless the project team closes it or it is genuinely superseded.
- Re-fetch
origin/mainbefore deciding. A branch can become conflicting because another PR merged while it was under review. - Verify the updated head, checks, diff scope, and relevant live or generated artifact before reporting merge readiness.
A clean check result is not sufficient when the branch is stale. A conflict is a repair task first, not an automatic rejection. Never force-merge a branch whose behavior or provenance remains unverified.
6a. Stale branch, no force push: merge main in, never rebase
When a --force push is forbidden (or history must stay append-only), update a stale PR branch by
merging origin/main into the branch. The merge commit has the old head as an ancestor, so the
push is a plain fast-forward (old..new, no forced marker) and the PR's own commits survive. A rebase
would rewrite them and require a force push — refuse that when the instruction says no force push.
After the merge, restate the PR's scope as the three-dot diff git diff --stat origin/main...HEAD: it
should equal the PR's original file set with 0 deletions. If it shrank or grew, the merge changed the
review surface — investigate before pushing. Note in your report that the branch's copy of files
changed by main (e.g. index.html) moves to main's version; that is inherent to the update and does
not put those files in the PR diff.
A branch that is textually mergeable can still be semantically broken: git merges cleanly when two
sides add the same heading/identifier number, key, or enum value in different places. Check the merged
tree, not just mergeable: MERGEABLE — grep the merged file for duplicate ^## [0-9]+\. headings,
duplicate keys, and duplicate enum members after the merge. Resolve by renumbering the newer side to
the next free value, and grep the whole tree for the old number (§N, Section N, #N, path#anchor)
to catch references that would become false. Run the repo gate on the merged tree after committing,
because fresh-clone/CI gates read committed refs and would otherwise validate the pre-fix tree.
6b. Posting a review body from a file: -F, never -f
gh api -f body=@file.md posts the LITERAL string @file.md — -f/--raw-field never expands a
file. Only -F/--field reads @path; --input takes a whole JSON body. A review posted with the
wrong flag is a contentless comment that cannot be deleted afterwards (the REST delete endpoint
rejects non-pending reviews with HTTP 422), so the repair is a second, correct review plus a permanent
blank entry on someone else's PR.
gh api -X POST repos/$OWNER/$REPO/pulls/$N/reviews -f event=COMMENT -F body=@review.mdVerify the posted body, not just the POST response:
gh api repos/$OWNER/$REPO/pulls/$N/reviews/$ID --jq '.body' | head -3.
7. Merging
With gh:
# Squash merge + delete branch (cleanest for feature branches)
gh pr merge --squash --delete-branch
# Enable auto-merge (merges when all checks pass)
gh pr merge --auto --squash --delete-branchWith git + curl:
PR_NUMBER=<number>
# Merge the PR via API (squash)
curl -s -X PUT \
-H "Authorization: token $GITHUB_TOKEN" \
https://api.github.com/repos/$OWNER/$REPO/pulls/$PR_NUMBER/merge \
-d "{
\"merge_method\": \"squash\",
\"commit_title\": \"feat: add user authentication (#$PR_NUMBER)\"
}"
# Delete the remote branch after merge
BRANCH=$(git branch --show-current)
git push origin --delete $BRANCH
# Switch back to main locally
git checkout main && git pull origin main
git branch -d $BRANCHMerge methods: "merge" (merge commit), "squash", "rebase"
Enable Auto-Merge (curl)
# Auto-merge requires the repo to have it enabled in settings.
# This uses the GraphQL API since REST doesn't support auto-merge.
PR_NODE_ID=$(curl -s \
-H "Authorization: token $GITHUB_TOKEN" \
https://api.github.com/repos/$OWNER/$REPO/pulls/$PR_NUMBER \
| python -c "import sys,json; print(json.load(sys.stdin)['node_id'])")
curl -s -X POST \
-H "Authorization: token $GITHUB_TOKEN" \
https://api.github.com/graphql \
-d "{\"query\": \"mutation { enablePullRequestAutoMerge(input: {pullRequestId: \\\"$PR_NODE_ID\\\", mergeMethod: SQUASH}) { clientMutationId } }\"}"7. Complete Workflow Example
# 1. Start from clean main
git checkout main && git pull origin main
# 2. Branch
git checkout -b fix/login-redirect-bug
# 3. (Agent makes code changes with file tools)
# 4. Commit
git add src/auth/login.py tests/test_login.py
git commit -m "fix: correct redirect URL after login
Preserves the ?next= parameter instead of always redirecting to /dashboard."
# 5. Push
git push -u origin HEAD
# 6. Create PR (picks gh or curl based on what's available)
# ... (see Section 3)
# 7. Monitor CI (see Section 4)
# 8. Merge when green (see Section 6)Useful PR Commands Reference
| Action | gh | git + curl |
| List my PRs | gh pr list --author @me | curl -s -H "Authorization: token $GITHUB_TOKEN" "https://api.github.com/repos/$OWNER/$REPO/pulls?state=open" |
| View PR diff | gh pr diff | git diff main...HEAD (local) or curl -H "Accept: application/vnd.github.diff" ... |
| Add comment | gh pr comment N --body "..." | curl -X POST .../issues/N/comments -d '{"body":"..."}' |
| Request review | gh pr edit N --add-reviewer user | curl -X POST .../pulls/N/requested_reviewers -d '{"reviewers":["user"]}' |
| Close PR | gh pr close N | curl -X PATCH .../pulls/N -d '{"state":"closed"}' |
| Check out someone's PR | gh pr checkout N | git fetch origin pull/N/head:pr-N && git checkout pr-N |
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

