Open wolf99 opened 1 year ago
Added fetch-depth: 0
so in total:
- uses: actions/checkout
with:
ref: ${{ github.ref }}
fetch-depth: 0
Now the checkout gets slightly further but results in:
Determining the checkout info
/usr/bin/git branch --list --remote origin/prettier-lint-md-workflow
/usr/bin/git tag --list prettier-lint-md-workflow
Error: A branch or tag with the name 'prettier-lint-md-workflow' could not be found
https://github.com/google/osv-scanner/actions/runs/3914653689/jobs/6691959309
Tried ref: ${{ github.event.pull_request.head.sha }}
instead, but then the Prettier action is back to:
fatal: You are not currently on a branch.
To push the history leading to the current (detached HEAD)
state now, use
git push origin HEAD:<name-of-remote-branch>
😟
I think you need to use this: ref: ${{ github.head_ref }}
.
Just found your issue because I have the following error when someone makes a PR from a cloned repo.
A branch or tag with the name 'some_branch_name' could not be found
I'm actually also using Prettier. I have this config.
name: Pull Request Check
on:
pull_request:
branches:
- main
jobs:
prettier:
name: Format files using Prettier
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
ref: ${{ github.head_ref }}
fetch-depth: 0
- name: Prettify code
uses: creyD/prettier_action@v4.2
with:
dry: True
only_changed: True
prettier_options: --check **/*.{js,css,md} --end-of-line lf
Maybe our problem is related. This is the run which fails: https://github.com/0ptim/DeFiChainWiki/actions/runs/4108092834/jobs/7088370243
Just got it working! 🎉 Have a look here: https://github.com/actions/checkout/issues/455
I am trying to create a PR workflow that checkouts out the PR branch, lints the markdown, and then makes a commit with the changes (on PR: https://github.com/google/osv-scanner/pull/144).
This is running on the PR branch that is introducing this workflow, which is coming from my fork of this repo.
I am not understanding how to properly checkout the PR branch.
Looking at #20, and the docs for the Prettier action I am using for linting, it seems I should just
But using this causes checkout to fail, see job: https://github.com/google/osv-scanner/actions/runs/3914565858/jobs/6691777605
My git-fu 🥷 isn't strong enough to figure out what is wrong here