# Gha PR merge ref shows upstream changes

> Gha PR merge ref shows upstream changes is an open-source agent skill for developer tools. Diagnoses CI failures caused by GitHub's merge-ref checkout on pull requests. It is available on Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf and Goose.

- **Kind:** Skill
- **Pricing:** Open source
- **Platforms:** Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf, Goose
- **Website:** https://github.com/wan-huiyan/agent-traffic-control/tree/main/plugins/agent-traffic-control/skills/gha-pr-merge-ref-shows-upstream-changes
- **Repository:** https://github.com/wan-huiyan/agent-traffic-control
- **GitHub stars:** 5
- **License:** MIT
- **Skill name:** gha-pr-merge-ref-shows-upstream-changes
- **Collection:** https://github.com/wan-huiyan/agent-traffic-control
- **Categories:** [developer tools](https://ai-powered.com/categories/developer-tools)
- **Listing updated:** 2026-12-04

## About

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

## What it can access

From a static check of the files on GitHub; nothing was run.

- [Instructions only, no scripts](https://github.com/wan-huiyan/agent-traffic-control/tree/HEAD/plugins/agent-traffic-control/skills/gha-pr-merge-ref-shows-upstream-changes)
- [License: MIT](https://github.com/wan-huiyan/agent-traffic-control/tree/HEAD/plugins/agent-traffic-control/skills/gha-pr-merge-ref-shows-upstream-changes)

## Features

- **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

## Install

### Claude Code

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):

```sh
/plugin marketplace add wan-huiyan/agent-traffic-control
/plugin install agent-traffic-control@wan-huiyan-agent-traffic-control
```

Or copy only this skill to `~/.claude/skills/gha-pr-merge-ref-shows-upstream-changes`:

```sh
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.

### Codex

Copy the skill folder to `~/.agents/skills/gha-pr-merge-ref-shows-upstream-changes` to use it in every repository:

```sh
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.

### Cursor

Copy the skill folder to `~/.cursor/skills/gha-pr-merge-ref-shows-upstream-changes` to use it in every project:

```sh
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.

### Gemini CLI

Run in a terminal (add `--scope workspace` to install it for the current workspace only):

```sh
gemini skills install https://github.com/wan-huiyan/agent-traffic-control.git --path plugins/agent-traffic-control/skills/gha-pr-merge-ref-shows-upstream-changes
```

Or copy the folder to `~/.gemini/skills/gha-pr-merge-ref-shows-upstream-changes` yourself.

### VS Code

For GitHub Copilot in VS Code, copy the skill folder to `~/.copilot/skills/gha-pr-merge-ref-shows-upstream-changes`:

```sh
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.

### Other agents

Get the folder:

```sh
git clone --depth 1 https://github.com/wan-huiyan/agent-traffic-control.git
```

Then 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.

## 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.

## Alternatives

- [Gh PR merge worktree checkout trap](https://ai-powered.com/skills/gh-pr-merge-worktree-checkout-trap): Gh PR merge worktree checkout trap is an open-source agent skill for developer tools.
- [Fix ci](https://ai-powered.com/skills/fix-ci): Fix ci is an open-source agent skill for developer tools.
- [Conflicted PR starts no ci run push resolution first](https://ai-powered.com/skills/conflicted-pr-starts-no-ci-run-push-resolution-first): Conflicted PR starts no ci run push resolution first is an open-source agent skill for developer tools.
- [Gh fix ci](https://ai-powered.com/skills/gh-fix-ci): Gh fix ci is a free agent skill for developer tools.
- [Merge PR](https://ai-powered.com/skills/merge-pr): Merge PR is an open-source agent skill for developer tools.
- [Resolve merge conflicts](https://ai-powered.com/skills/resolve-merge-conflicts): Resolve merge conflicts is an open-source agent skill for developer tools.
- [Fix PR](https://ai-powered.com/skills/fix-pr): Fix PR is an open-source agent skill for developer tools.
- [Gh PR merge unstable state needs auto and watch branch deletes](https://ai-powered.com/skills/gh-pr-merge-unstable-state-needs-auto-and-watch-branch-deletes): Gh PR merge unstable state needs auto and watch branch deletes is an open-source agent skill for developer tools.

---
Source: https://ai-powered.com/skills/gha-pr-merge-ref-shows-upstream-changes
