Skip to content

fix(skill): pin the repo when fetching a pull request - #6036

Closed
lab1207 wants to merge 1 commit into
heygen-com:mainfrom
lab1207:fix/6027-fetch-pr-repo-context
Closed

lab1207 wants to merge 1 commit into
heygen-com:mainfrom
lab1207:fix/6027-fetch-pr-repo-context

Conversation

@lab1207

@lab1207 lab1207 commented Oct 21, 2026

Copy link
Copy Markdown

Closes #6027

The problem

skills/pr-to-video/scripts/fetch-pr.mjs passed the --pr value straight to
gh pr view, and gh resolves both the repository and the argument against
the local git context. Two things break:

  1. Outside a git repository the call dies before it reaches the API — and the
    directory the skill runs in is exactly that: step 0 runs hyperframes init
    into a fresh cache dir, and step 1 then runs this script with that
    directory as cwd.
  2. Even with a repo context, owner/repo#N is read as a branch name, so
    gh pr view "DataLinkDC/dinky#4584" reports "no pull requests found for
    branch" — the documented form of --pr never worked, and only a bare
    number did.

The fix

Parse the ref ourselves and pin the repository:

  • lib/pr-ref.mjs (new) exports parsePrRef, which understands a full PR
    url, owner/repo#N and a bare number.
  • fetch-pr.mjs builds its gh arguments from that: the number on its own, plus
    --repo owner/repo whenever the ref names a repository. A bare number keeps
    the old behaviour (gh resolves it from the git context).

Both gh calls are pinned, not just the first: gh pr diff had the same
problem, and the follow-up gh api repos/<owner>/<repo>/pulls/N/files call
was already repo-qualified, so it now works in the same directory.

Test

skills/pr-to-video/scripts/fetch-pr.test.mjs covers the parser: a PR url,
owner/repo#N, a bare number, and a value that names no pull request.

How I verified it

The repo's test runner is node --test on the *.test.mjs files, and node is
available here, so I ran the new test:

✔ parses owner/repo#N
✔ parses a full pull-request url
✔ parses a bare number
✔ gives up on anything that names no pull request
ℹ tests 4  ℹ pass 4  ℹ fail 0

And the end-to-end case from the issue, in a directory that is not a git
repository:

$ cd /tmp/hf_notgit            # not a git repo
$ gh pr view "DataLinkDC/dinky#4584" --json number
gh: failed to run git: fatal: not a git repository (or any of the parent directories): .git

$ gh pr view 4584 --repo DataLinkDC/dinky --json number
{"number":4584}

The script itself, run the same way:

$ node fetch-pr.mjs --pr "DataLinkDC/dinky#4584" --out-dir ./capture
✓ fetch-pr: DataLinkDC/dinky PR #4584 — "fix(postgresql): resolve boolean = integer operator error across all …"
  files: 15 (completed via gh api); diff: 15687 chars
  shipped_version: null
  wrote /tmp/hf_notgit/capture/pr.json + /tmp/hf_notgit/capture/diff.patch

Model Used

MiniMax M3.1 Flash Free via the opencode agent harness (minimax-m3.1-flash-free)

gh resolves both the repository and the argument against the local git
context, so \gh pr view owner/repo#N\ reads the whole thing as a branch
name and fails outright outside a git repository - which is the directory
the pr-to-video skill runs the fetch in.

Parse the ref ourselves and pass the number with --repo when the ref names
a repository. A bare number keeps the old behaviour.

@jrusso1020 jrusso1020 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed at de725685f9f1952d232a4409c7dc9e691680abd1.

Explicit --repo and numeric pull request arguments fix owner/repo references outside a repository. Please rebase because the skill fetch script conflicts with current main.

Read parser and view/diff/API call construction; no GitHub writes. No full integration run is claimed.

Need: yes · Size: ok · Reuse: existing helper and dispatch paths · Simpler: keep the focused fix · Structure: fine
Risk: medium - compatibility with current main.

Verdict: COMMENT
Reasoning: The branch currently conflicts with main; I will review the resolved delta after a rebase.

Reasoning: Explicit --repo and numeric pull request arguments fix owner/repo references outside a repository. Please rebase because the skill fetch script conflicts with current main.

@github-actions

Copy link
Copy Markdown
Contributor

This PR has had no activity for 14 days, so it is marked stale and will close in 7 days. Push a commit or leave a comment to keep it open. A maintainer can add keep-open to exempt it.

@github-actions github-actions Bot added the stale label Nov 14, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Closed after 21 days without activity. Reopen it, or open a new PR, whenever you pick it back up.

@github-actions github-actions Bot closed this Nov 21, 2026
@lab1207

lab1207 commented Nov 22, 2026

Copy link
Copy Markdown
Author

Closing the loop on this one rather than rebasing it.

The skills/pr-to-video skill this PR patches was retired upstream in #5651 (feat(skills)!: publish seven knowledge skills aligned with Studio and retire the workflow skills), which merged the same day this branch was cut. skills/pr-to-video no longer exists on main, and the fetch-pr / pr-ref scripts aren't anywhere in the current tree — so there is no rebase target. Rebasing would mean resurrecting a skill upstream deliberately deleted, and the GSAP and fetch scripts in this area now live in a different shape entirely (packages/core/src/gsapCdn.ts, packages/cli/src/server/gsapVendor.ts, scripts/ci/inline-gsap.mjs).

@jrusso1020 flagging this so the rebase request isn't left waiting on a branch that can't satisfy it. The underlying problem is still real in spirit — resolving an explicit --repo owner/name and a numeric PR argument instead of assuming the current repository — so if that script comes back in the new skill layout, or if the equivalent lives in packages/ now, the fix is worth re-proposing against the current layout.

Leaving this closed as obsolete unless that turns out to be the case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

pr-to-video: fetch-pr.mjs fails outside a git repo, and owner/repo#N is parsed as a branch name

2 participants