GitHub API PR creation without local git. Use when submitting file changes as a PR without local commits — quick fixes, typos, config updates, or bypassing local git state.
Installer avec Codex ou Claude Copiez ce prompt, collez-le dans Codex, Claude ou un autre assistant, puis laissez-le vérifier la page du skill et l'installer pour vous.
Une commande directe contourne le prompt de vérification. Examinez la source avant de l'exécuter.
GitHub API PR creation without local git. Use when submitting file changes as a PR without local commits — quick fixes, typos, config updates, or bypassing local git state.
One or more file paths to create/update in the repo
--title <text>
Yes
PR title — use conventional commit format
--base <branch>
No
Base branch (default: repo default branch from context)
--branch <name>
No
New branch name (auto-generated from title if omitted)
--body <text>
No
PR body/description
--draft
No
Create as draft PR
--delete
No
Delete the specified files instead of updating them
Execution
Execute this server-side PR creation workflow:
Step 1: Validate inputs
Parse file paths and flags from $ARGUMENTS
Verify --title is provided — error if missing
For each file path (unless --delete):
Verify the local file exists using Read tool
Resolve to a repo-relative path (strip leading ./ or working directory prefix)
Determine the repo from context ($REPO)
Determine base branch: use --base if provided, otherwise use default branch from context
Step 2: Resolve base branch state
# Get base branch SHA
BASE_SHA=$(gh api repos/$REPO/git/ref/heads/$BASE_BRANCH -q .object.sha)
# Get base tree SHA
BASE_TREE=$(gh api repos/$REPO/git/commits/$BASE_SHA -q .tree.sha)
If this fails, the base branch doesn't exist — report error and list available branches.
Step 3: Generate branch name (if --branch not provided)
Derive from the --title:
Take the subject part (after type(scope): )
Convert to kebab-case
Prefix with the commit type (e.g., fix/kebab-subject)
gh api repos/$REPO/git/refs \
-f ref="refs/heads/$BRANCH" \
-f sha="$COMMIT_SHA"
If this fails with "Reference already exists", report the error and suggest using a different branch name.
Step 8: Create PR
When --body is provided, write it to a tempfile with the Write tool and pass --body-file. This sidesteps shell quoting entirely so backticks and code fences in the body render correctly. See the Body content rule in github-issue-writing for the canonical guidance.