# Github Sync Upstream

> >-

- **Type:** Skill
- **Install:** `agentstack add skill-opendatahub-io-ai-helpers-github-sync-upstream`
- **Verified:** Yes — security-reviewed for prompt injection and unsafe behavior
- **Seller:** [opendatahub-io](https://agentstack.voostack.com/s/opendatahub-io)
- **Installs:** 0
- **Category:** [Developer Tools](https://agentstack.voostack.com/c/developer-tools)
- **Latest version:** 0.1.0
- **License:** Apache-2.0
- **Upstream author:** [opendatahub-io](https://github.com/opendatahub-io)
- **Source:** https://github.com/opendatahub-io/ai-helpers/tree/main/helpers/skills/github-sync-upstream
- **Website:** https://opendatahub-io.github.io/ai-helpers/

## Install

```sh
agentstack add skill-opendatahub-io-ai-helpers-github-sync-upstream
```

Requires the [AgentStack CLI](https://agentstack.voostack.com/docs/cli). Works with Claude Code, Cursor, and any MCP-compatible agent.

## About

# Sync Upstream

Merge upstream commits into a sync branch on the user's fork and open a
PR to the target repo. See `references/workflow.md` for exact script
invocations, exit-code handling, and the summary template.

**Commit SHA (optional):** `$ARGUMENTS`

## Step 1: Determine Working Context

```bash
REPO_ROOT=$(git rev-parse --show-toplevel 2>/dev/null) || REPO_ROOT=""
```

If `REPO_ROOT` is non-empty, run `scripts/detect-remotes.sh --repo "${REPO_ROOT}"`
and ask via `AskUserQuestion` whether this is the correct repo.
If yes → Step 2A. If no or not in a repo → Step 2B.

## Step 2A: In-Repo Setup

Pre-fill upstream/target from detect-remotes output. Ask via
`AskUserQuestion` to confirm: upstream repo, target repo, branches
(default `main`). Run `scripts/setup-remotes.sh`, parse `UPSTREAM_REMOTE` and
`TARGET_REMOTE`. Save `ORIGINAL_BRANCH` from current HEAD.

## Step 2B: Clone From Scratch

Ask for upstream repo, target repo, and branches. If the user has a
local clone, use its path and continue as Step 2A. If not, ask if they
have a GitHub fork — run `scripts/clone-fork.sh` then `scripts/setup-remotes.sh`. If
no fork exists, ask them to create one and re-run. **Stop.**

Save `ORIGINAL_BRANCH` from current HEAD.

## Step 3: Protected Files

Protected files keep the target version, discarding upstream changes.
Ask via `AskUserQuestion` for glob patterns to protect (or none).
Suggest common examples: `OWNERS*`, `.tekton/*.yaml`,
`Dockerfile*konflux`.

## Step 4: Pre-flight Check

Verify `origin` does not point to upstream or target. If it does, tell
the user to set origin to their personal fork and stop.

## Step 5: Merge

Run `scripts/sync-merge.sh`. Handle exit codes 0 (success), 1 (conflicts), and
3 (duplicate branch) as described in `references/workflow.md`.

## Step 6: Push and Open PR

Show PR summary and ask via `AskUserQuestion`: open a PR or just push?
If confirmed, run `scripts/open-pr.sh`.

## Step 7: Cleanup and Summary

Check out `ORIGINAL_BRANCH`. For Path B clones, inform the user of the
temp directory. Display the summary per `references/workflow.md`.

## Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

- **Author:** [opendatahub-io](https://github.com/opendatahub-io)
- **Source:** [opendatahub-io/ai-helpers](https://github.com/opendatahub-io/ai-helpers)
- **License:** Apache-2.0
- **Homepage:** https://opendatahub-io.github.io/ai-helpers/

Install and usage instructions live in the source repository linked above.

## Pricing

- **Free** — Free

## Security capabilities

Automated source analysis of v0.1.0 — what this tool can access:

- **Network access:** no
- **Filesystem access:** no
- **Shell / process execution:** no
- **Environment & secrets:** no
- **Dynamic code execution:** no

*"Yes" means the capability is present in the source — more access means more to trust, not that it is unsafe.*


## Versions

- **0.1.0** — security scan: passed — Imported from the upstream source.

## Links

- Listing page: https://agentstack.voostack.com/l/skill-opendatahub-io-ai-helpers-github-sync-upstream
- Seller: https://agentstack.voostack.com/s/opendatahub-io
- Browse the marketplace: https://agentstack.voostack.com/browse

---
Listed on AgentStack — the marketplace for AI agent skills and MCP servers. Every listing is security-reviewed. Creators keep 70%.
