Skip to content
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

[bug] scm capture fails during Github PR workflow #3868

Open
planetmarshall opened this issue Sep 13, 2024 · 3 comments
Open

[bug] scm capture fails during Github PR workflow #3868

planetmarshall opened this issue Sep 13, 2024 · 3 comments
Assignees
Milestone

Comments

@planetmarshall
Copy link

planetmarshall commented Sep 13, 2024

Describe the bug

Not strictly a conan bug, more of an oversight in the documentation but since the Documentation on SCM capture explicitly uses a github workflow as illustration, it's probably worth reporting.

Expected Result

A conanfile using the SCM capture feature should build during a workflow triggered by a Github PR event

Actual Result

Conanfile build fails with

fatal: unable to read tree (cf912fbe1bc5dee48e6117f9a34b60f59a51f578)

See Logs for failing action.

Workaround

Explicitly specify the pull request head ref when checking out the code

- name: Checkout
  uses: actions/checkout@v4
  with:
    ssh-key: ${{ secrets.SSH_PRIVATE_KEY }}
    ref: ${{ github.event.pull_request.head.sha }}

How to reproduce it

Clone the repository at https://github.com/planetmarshall/conan-scm-capture.git and create a pull request for the setup-ci branch

@memsharded memsharded self-assigned this Sep 13, 2024
@memsharded
Copy link
Member

Thanks for pointing this out @planetmarshall

I agree it would be good to at least add some note in the docs.

But I'd like to ask first, just in case. At the moment, the scm approach is doing internally:

commit = self.run(f'rev-list HEAD -n 1 --full-history {path}')

And this is the command that is failing in case of that PR checkout.
Is there any other way to get a "permanent" commit reference that could be used? Or is that PR checkout by default kind of a headless checkout and it is not possible to obtain a commit

@memsharded
Copy link
Member

Hi @planetmarshall

Any further feedback here? What do you think would be the best approach, just a note in the docs?

@memsharded
Copy link
Member

Moving this to the docs repo.

@memsharded memsharded transferred this issue from conan-io/conan Oct 17, 2024
@memsharded memsharded added this to the 2 milestone Oct 17, 2024
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