Skip to content

Can not checkout a PR from an external GitHub repo #2140

Open
@mulkieran

Description

@mulkieran

Hi!

I've tried a bunch of things, and I think I've found a bug.

Take this example here: https://github.com/stratis-storage/stratis-cli/actions/runs/14359209055/job/40256004629 .

You can observe the configuration for the action, etc. in the logs.

This line is the interesting one:

/usr/bin/git -c protocol.version=2 fetch --prune --no-recurse-submodules --depth=1 origin +refs/heads/pull/3811/*:refs/remotes/origin/pull/3811/* +refs/tags/pull/3811/*:refs/tags/pull/3811/*

As far as I can tell, these are not good refs for GitHub. The command fails. I believe it is this bit, +refs/heads/pull/3811. I think it should be +refs/pull/3811, as that succeeded on my system.

In this PR (stratis-storage/stratis-cli#1151) rather than trying to use the ref arg for the action, I've just cobbled together my own set of git commands, thusly, executed right after the checkout action. These are definitely working.

        with:
          repository: stratis-storage/stratisd
          path: stratisd
          ref: master
      - name: Switch to PR branch
        run: |
          git fetch origin +refs/pull/3811/head:refs/remotes/origin/pull/3811/head
          git checkout origin/pull/3811/head
        working-directory: stratisd
      - name: Print head commit
        run: git log --oneline -1
        working-directory: stratisd

I think that there should be some way for me to specify the PR via the ref that ought to work, and I have found none so far. I believe that is due to the malformed ref spec, and so this is a bug.

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