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

Fails When repo contains only single commit #95

Closed
k-paxian opened this issue Jul 10, 2023 · 1 comment
Closed

Fails When repo contains only single commit #95

k-paxian opened this issue Jul 10, 2023 · 1 comment

Comments

@k-paxian
Copy link

This command fails

BASE_SHA = execSync(`git rev-parse origin/${mainBranchName}~1`, { encoding: 'utf-8' });

When repo contains only single commit, so origin/master~1 can't be resolved correctly. This exceptional case must be handled
gracefully.

...
WARNING: Unable to find a successful workflow run on 'origin/master'
We are therefore defaulting to use HEAD~1 on 'origin/master'

NOTE: You can instead make this a hard error by setting 'error-on-no-successful-workflow' on the action in your workflow.
fatal: ambiguous argument 'origin/master~1': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
node:internal/errors:863
  const err = new Error(message);
              ^

Error: Command failed: git rev-parse origin/master~1
fatal: ambiguous argument 'origin/master~1': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'

    at checkExecSyncError (node:child_process:871:11)
    at execSync (node:child_process:943:15)
    at /runner/_work/_actions/nrwl/nx-set-shas/main/dist/index.js:1[37](https://github.com/newvoicemedia/omni-e2e-smoke-checker-test/actions/runs/5475685812/jobs/9972135144#step:8:39)58:20
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
  status: 128,
  signal: null,
  output: [
    null,
    'origin/master~1\n',
    "fatal: ambiguous argument 'origin/master~1': unknown revision or path not in the working tree.\n" +
      "Use '--' to separate paths from revisions, like this:\n" +
      "'git <command> [<revision>...] -- [<file>...]'\n"
  ],
  pid: 23709[48](https://github.com/newvoicemedia/omni-e2e-smoke-checker-test/actions/runs/5475685812/jobs/9972135144#step:8:50),
  stdout: 'origin/master~1\n',
  stderr: "fatal: ambiguous argument 'origin/master~1': unknown revision or path not in the working tree.\n" +
    "Use '--' to separate paths from revisions, like this:\n" +
    "'git <command> [<revision>...] -- [<file>...]'\n"
}
...
@k-paxian k-paxian changed the title Fails When repo contains **only single** commit Fails When repo contains only single commit Jul 10, 2023
@k-paxian
Copy link
Author

duplicates #84

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

1 participant