Error running git command in GitHub actions
wmonk opened this issue · 3 comments
wmonk commented
Just set this up and using in GitHub Actions, and this is the error returned.
Error: Command failed with exit code 128: git rev-parse HEAD^1
fatal: ambiguous argument 'HEAD^1': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
HEAD^1
at makeError (/home/runner/work/redacted/redacted/node_modules/create-check/node_modules/execa/lib/error.js:59:11)
at handlePromise (/home/runner/work/redacted/redacted/node_modules/create-check/node_modules/execa/index.js:114:26)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
Any ideas on this?
hipstersmoothie commented
Github actions does a shallow checkout. I recommend the following:
steps:
- uses: actions/checkout@v2
- name: Prepare repository
run: git fetch --unshallow --tags
wmonk commented
Brilliant, that's all working now! Thanks.
One other bit of config missing was appending --testLocationInResults
to the jest
command - probably useful to add this and the above to the README.
wmonk commented
Sorry to spam!
We have two jest
commands in our workflow. If both have a failing test, it only results in a single file annotation of which ever test run finishes last. I'm not familiar with actions/checks, but suppose it's to do with the same action writing twice.