
Gha PR merge ref shows upstream changes
Diagnoses CI failures caused by GitHub's merge-ref checkout on pull requests
Gha PR merge ref shows upstream changes is an open-source agent skill for developer tools. It is available on Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf and Goose.
- Scripts
- None
- Platforms
- Claude Code, Codex, Cursor
- GitHub stars
- 5
- Last commit
- License
- MIT
- Listing updated
Similar skills
About Gha PR merge ref shows upstream changes
This skill helps an agent work out why a pull request check fails on a file the author never touched, even though the same commit passes locally. It explains that GitHub Actions on pull_request events checks out a synthetic merge of the PR head and the current base branch, so a fast-moving main can make the run see another PR's changes.
The workflow walks the agent through confirming the CI run's head SHA against the local HEAD, checking whether the base branch has moved ahead, and searching the flagged identifiers on main versus the working branch. It then lays out fix paths: rebasing onto main and force-pushing, waiting for a burst of merges to settle, or pinning the checkout to the head SHA for specific checks. It also notes how to read a DIRTY merge state as a stronger signal of real conflicts.
The guidance uses git, the GitHub CLI and a GitHub Actions workflow file with actions/checkout. No scripts are bundled; the skill is instructions only.
When your agent uses it
Diagnose "my CI failed on a file I didn't change — the test passes locally but CI insists there's a duplicate / conflict / lint violation that isn't in my branch." Caused by GitHub Actions checking out `refs/pull/N/merge` (the auto-computed merge of PR head + base) on `pull_request` events. Use when: (1) CI fails on a `git`/lint/whole-tree check (duplicate IDs, schema drift, file-content audit) that PASSES on the same SHA locally, (2) you're working in a dense parallel-PR window where main is moving faster than your CI runs, (3) `gh run view N --json headSha` matches your latest force-push but `git fetch origin main && git rev-list --left-right --count origin/main...HEAD` shows main is ahead by N commits, (4) the failure references symbols / IDs / values that are present in MAIN but absent from your branch. Root cause: GitHub re-computes the merge ref every time the base moves, so CI on `pull_request` sees `main-at-CI-start + your-branch`, NOT just `your-branch`. Sister concept to `gha-billing-failure-fast-fa
From the skill's SKILL.md. Your agent reads this description to decide when to load the skill.
What it can access
From a static check of its 1 file (9 KB) on GitHub on 4 December 2026. Nothing was run. Read the files before you install a skill: it can tell your agent to run anything its tools allow.
Check another skill before you install it.
Install
This skill ships in the agent-traffic-control plugin. In Claude Code, add the marketplace and install the plugin (it may include other skills too):
/plugin marketplace add wan-huiyan/agent-traffic-control
/plugin install agent-traffic-control@wan-huiyan-agent-traffic-controlOr copy only this skill to ~/.claude/skills/gha-pr-merge-ref-shows-upstream-changes:
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/wan-huiyan/agent-traffic-control.git "$tmp" &&
mkdir -p ~/.claude/skills &&
rm -rf ~/.claude/skills/gha-pr-merge-ref-shows-upstream-changes &&
cp -R "$tmp/plugins/agent-traffic-control/skills/gha-pr-merge-ref-shows-upstream-changes" ~/.claude/skills/gha-pr-merge-ref-shows-upstream-changes &&
rm -rf "$tmp"For one project only, put the folder in .claude/skills/gha-pr-merge-ref-shows-upstream-changes inside it instead.
Copy the skill folder to ~/.agents/skills/gha-pr-merge-ref-shows-upstream-changes to use it in every repository:
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/wan-huiyan/agent-traffic-control.git "$tmp" &&
mkdir -p ~/.agents/skills &&
rm -rf ~/.agents/skills/gha-pr-merge-ref-shows-upstream-changes &&
cp -R "$tmp/plugins/agent-traffic-control/skills/gha-pr-merge-ref-shows-upstream-changes" ~/.agents/skills/gha-pr-merge-ref-shows-upstream-changes &&
rm -rf "$tmp"For one repository only, put the folder in .agents/skills/gha-pr-merge-ref-shows-upstream-changes inside it instead.
Copy the skill folder to ~/.cursor/skills/gha-pr-merge-ref-shows-upstream-changes to use it in every project:
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/wan-huiyan/agent-traffic-control.git "$tmp" &&
mkdir -p ~/.cursor/skills &&
rm -rf ~/.cursor/skills/gha-pr-merge-ref-shows-upstream-changes &&
cp -R "$tmp/plugins/agent-traffic-control/skills/gha-pr-merge-ref-shows-upstream-changes" ~/.cursor/skills/gha-pr-merge-ref-shows-upstream-changes &&
rm -rf "$tmp"For one project only, put the folder in .cursor/skills/gha-pr-merge-ref-shows-upstream-changes inside it instead.
Run in a terminal (add --scope workspace to install it for the current workspace only):
gemini skills install https://github.com/wan-huiyan/agent-traffic-control.git --path plugins/agent-traffic-control/skills/gha-pr-merge-ref-shows-upstream-changesOr copy the folder to ~/.gemini/skills/gha-pr-merge-ref-shows-upstream-changes yourself.
For GitHub Copilot in VS Code, copy the skill folder to ~/.copilot/skills/gha-pr-merge-ref-shows-upstream-changes:
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/wan-huiyan/agent-traffic-control.git "$tmp" &&
mkdir -p ~/.copilot/skills &&
rm -rf ~/.copilot/skills/gha-pr-merge-ref-shows-upstream-changes &&
cp -R "$tmp/plugins/agent-traffic-control/skills/gha-pr-merge-ref-shows-upstream-changes" ~/.copilot/skills/gha-pr-merge-ref-shows-upstream-changes &&
rm -rf "$tmp"For one project only, put the folder in .github/skills/gha-pr-merge-ref-shows-upstream-changes inside it instead.
Get the folder:
git clone --depth 1 https://github.com/wan-huiyan/agent-traffic-control.gitThen copy agent-traffic-control/plugins/agent-traffic-control/skills/gha-pr-merge-ref-shows-upstream-changes into your agent's skills folder as gha-pr-merge-ref-shows-upstream-changes. Agents that support SKILL.md read one folder per skill.
What it does
- Merge-ref root cause
- Explains why pull_request runs test a combined main-plus-branch state rather than the branch alone.
- Diagnostic commands
- Provides git and gh commands to compare run SHAs and detect whether main has moved ahead.
- Rebase and force-push fix
- Describes bringing the branch up to date with main and resolving the real conflicts.
- Head-SHA checkout option
- Covers pinning a workflow checkout to the PR head for checks that should run in isolation.
- Conflict state check
- Shows how a DIRTY merge state from gh distinguishes true content conflicts from spurious CI failures.
Good for
- Why does CI fail on a lint check for a file I never edited?
- Check whether my PR's CI run is testing stale main changes
- Fix a duplicate ID failure that appears only in the merge preview
- Decide whether to rebase or pin the checkout ref in my workflow
Gha PR merge ref shows upstream changes FAQ
When does Gha PR merge ref shows upstream changes apply?
When a pull_request CI check fails on a file the branch did not change, the same commit passes locally, and the base branch has moved ahead since the push.
Does Gha PR merge ref shows upstream changes change any workflow files automatically?
No. It describes a manual diagnosis and offers an optional checkout change for specific checks, which the user applies themselves.
What tools does Gha PR merge ref shows upstream changes need?
Git, the GitHub CLI (gh) and access to the repository's GitHub Actions runs. The skill does not bundle scripts.
How do I install Gha PR merge ref shows upstream changes in Claude Code?
Copy the skill folder from GitHub to ~/.claude/skills/gha-pr-merge-ref-shows-upstream-changes to use it in all your projects, or to .claude/skills/gha-pr-merge-ref-shows-upstream-changes in one project. Or install the agent-traffic-control plugin, which includes it: /plugin marketplace add wan-huiyan/agent-traffic-control, then /plugin install agent-traffic-control@wan-huiyan-agent-traffic-control.
Does Gha PR merge ref shows upstream changes run scripts?
No. It is instructions only, with no scripts. This comes from a static check of the files on GitHub; nothing was run. Read the files before you install it.
Which AI agents can use Gha PR merge ref shows upstream changes?
Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf and Goose. Each reads skills in the SKILL.md format from its own folder; the install steps on this page list them.
What are the best alternatives to Gha PR merge ref shows upstream changes?
The closest alternatives to Gha PR merge ref shows upstream changes are Gh PR merge worktree checkout trap, Fix ci, Conflicted PR starts no ci run push resolution first, Gh fix ci and Merge PR.
Where this comes from
- Description: from the skill's own SKILL.md.
More from wan-huiyan/agent-traffic-control

Teaches agents to refuse a flawed instruction only with measured evidence attached
- Open source
- 5 GitHub stars
- Developer tools

Catches silent deletions when a subagent edits large files with repeated blocks
- Open source
- 5 GitHub stars
- Developer tools

Holds a pull request from merging by stopping its agent, disarming auto-merge, then
- Open source
- 5 GitHub stars
- Developer tools

Checks that a batch of pull requests does not cite file paths that will never exist
- Open source
- 5 GitHub stars
- Developer tools

Checks whether a pull request truly landed by comparing file content, not commit subjects
- Open source
- 5 GitHub stars
- Developer tools

Checks a branch for stale-base changes that would silently undo newer main work
- Open source
- 5 GitHub stars
- Developer tools



