push-to-forked-pr

Featured

Push the current working tree directly to a GitHub PR whose head lives on a **fork**, without creating a new branch and without pushing to `origin` (which is usually the upstream). Invoke when the user says things like "push straight to PR

Web & Frontend 931 stars 209 forks Updated today MIT

Install

View on GitHub

Quality Score: 93/100

Stars 20%
99
Recency 20%
100
Frontmatter 20%
70
Documentation 15%
100
Issue Health 10%
50
License 10%
100
Description 5%
100

Skill Content

# push-to-forked-pr The whole point of this skill: **`origin` is usually the upstream, but the PR's head is on someone else's fork.** Pushing to `origin` updates the upstream's branch, not the PR. You have to push to the fork. GitHub allows this in two situations: 1. You are the **fork owner** — straightforward, you own that branch. 2. You are an **upstream maintainer** and the PR has `maintainerCanModify: true` (the "Allow edits from maintainers" checkbox the PR author leaves on by default). GitHub then lets the upstream's auth push to the fork branch. If neither holds, abort and tell the user only the fork owner can push. --- ## Procedure ### 1. Read the PR's head metadata ```bash PR_NUMBER=<N> gh pr view "$PR_NUMBER" --json state,headRefName,headRefOid,headRepository,headRepositoryOwner,maintainerCanModify,url ``` Capture: - `state` — bail if not `"OPEN"`. - `headRepository.nameWithOwner` → the **fork** (e.g. `someone/Repo`). - `headRepositoryOwner.login` → the fork owner. - `headRefName` → the branch on the fork (usually matches local). - `headRefOid` → the PR's current head SHA. Your local HEAD must be a descendant. - `maintainerCanModify` → must be `true` if you are not the fork owner. If `headRepository.nameWithOwner` matches the upstream's `nameWithOwner`, this PR is **internal**: ```bash HEAD_BRANCH=$(gh pr view "$PR_NUMBER" --json headRefName --jq .headRefName) HEAD_REF_OID=$(gh pr view "$PR_NUMBER" --json headRefOid --jq .headRefOid) git merge-base --is...

Details

Author
hoangsonww
Repository
hoangsonww/Claude-Code-Agent-Monitor
Created
5 months ago
Last Updated
today
Language
TypeScript
License
MIT

Integrates with

Bundled in these plugins

Similar Skills

Semantically similar based on skill content — not just same category