Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
mulkieran opened this issue Apr 9, 2025 · 2 comments
Open

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

mulkieran opened this issue Apr 9, 2025 · 2 comments

Comments

@mulkieran
Copy link

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.

@mulkieran
Copy link
Author

I was looking to see how I could possibly submit a fix, when, on reading the code, I inferred that this refs/pull/3811/head would work. So, I guess this is just a usability bug.

@jaegereren271
Copy link

I have similar issue as well see this run: jaegereren271/qmk_userspace/actions/runs/14474876695/job/40597949728. I think it affects any form of external repo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants