-
Notifications
You must be signed in to change notification settings - Fork 23
Description
yor has a requirement on actions/checkout having a fetch-depth: 0 so it can obtain the git history it needs.
This is more expensive to fetch for large repositories.
It would be handy to be able to supply working-directory to the action so that it can happen within its own managed-specifically-for-the-action clone.
Currently, the action fails I think because the command's working-directory is the workspace path, and if a checkout is done into somewhere else (and then --directory is specified to aim there), the git switch done up-front in run() fails with no possibility to adjust where it's run from.
/usr/bin/git switch pete/yor
fatal: not a git repository (or any of the parent directories): .git
/home/runner/work/_actions/some-org/gcp-terraform-workflows/pete/yor/.github/actions/yor-action/node_modules/@actions/exec/lib/toolrunner.js:592
error = new Error(`The process '${this.toolPath}' failed with exit code ${this.processExitCode}`);
^
Error: The process '/usr/bin/git' failed with exit code 128
at ExecState._setResult (/home/runner/work/_actions/some-org/gcp-terraform-workflows/pete/yor/.github/actions/yor-action/node_modules/@actions/exec/lib/toolrunner.js:592:1)
at ExecState.CheckComplete (/home/runner/work/_actions/some-org/gcp-terraform-workflows/pete/yor/.github/actions/yor-action/node_modules/@actions/exec/lib/toolrunner.js:575:1)
at ChildProcess.<anonymous> (/home/runner/work/_actions/some-org/gcp-terraform-workflows/pete/yor/.github/actions/yor-action/node_modules/@actions/exec/lib/toolrunner.js:469:1)
at ChildProcess.emit (node:events:524:28)
at maybeClose (node:internal/child_process:1104:16)
at Socket.<anonymous> (node:internal/child_process:456:11)
at Socket.emit (node:events:524:28)
at Pipe.<anonymous> (node:net:343:12)If this
await exec.exec(`git switch ${githubRef}`)became
await exec.exec(`git -C "${workingDirectory}" switch ${githubRef}`)that could work.
However, I have not inspected the action's code to know whether that would be the only place necessary to touch for this. It might be more expedient to change the cwd once as the first thing.