[bug] scm capture fails during Github PR workflow
- Dominant language
- C++
- Stars
- 125
- Forks
- 382
- Avg merge
- 22h 39m
- Merged PRs (30d)
- 21
Description
### Describe the bug
Not strictly a conan bug, more of an oversight in the documentation but since the [Documentation on SCM capture](https://docs.conan.io/2/examples/tools/scm/git/capture_scm/git_capture_scm.html) 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](https://github.com/planetmarshall/conan-scm-capture/actions/runs/10850669544/job/30112656886) for failing action.
Workaround
----------------
Explicitly specify the pull request head ref when checking out the code
```yml
- 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
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.