Skip to content

mvb fails on fork PRs: branch doesn't exist in upstream repo #93

@AaronFeledy

Description

@AaronFeledy

Problem

When running mvb in a GitHub Actions workflow triggered by a PR from a fork, the build fails because mvb tries to checkout the PR's branch name in the upstream repo.

Error

@lando/mvb running command 'git' [ 'checkout', '53-ruby-4.0', '--force' ] from '/tmp/...'
@lando/mvb stderr error: pathspec '53-ruby-4.0' did not match any file(s) known to git

Cause

mvb clones the upstream repo to a temp directory, then tries to checkout the branch by name. For fork PRs, the branch (e.g., 53-ruby-4.0) only exists in the contributor's fork, not in the upstream repo.

Reproduction

  1. Contributor opens PR from their fork (e.g., contributor/repolando/repo)
  2. GHA workflow runs npx mvb docs
  3. mvb clones lando/repo and tries git checkout <fork-branch-name>
  4. Fails because that branch doesn't exist in lando/repo

Example

Suggested Fix

For fork PRs, mvb should either:

  1. Clone the fork's repo URL instead of upstream
  2. Use the PR merge ref (refs/pull/N/merge) instead of branch name
  3. Detect fork PRs and skip the dev branch checkout

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions