This PR cherry-picks the following commits:
- 06ffdd61c9
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
This commit is contained in:
parent
b2d6a0916e
commit
301f179735
|
|
@ -27,6 +27,18 @@ export async function detectChangedTestFiles(baseCommit: string, configDir: stri
|
||||||
).split('\n').filter(Boolean);
|
).split('\n').filter(Boolean);
|
||||||
} catch (_error) {
|
} catch (_error) {
|
||||||
const error = _error as childProcess.SpawnSyncReturns<string>;
|
const error = _error as childProcess.SpawnSyncReturns<string>;
|
||||||
|
|
||||||
|
const unknownRevision = error.output.some(line => line?.includes('unknown revision'));
|
||||||
|
if (unknownRevision) {
|
||||||
|
const isShallowClone = childProcess.execSync('git rev-parse --is-shallow-repository', { encoding: 'utf-8', stdio: 'pipe' }).trim() === 'true';
|
||||||
|
if (isShallowClone) {
|
||||||
|
throw new Error([
|
||||||
|
`The repository is a shallow clone and does not have '${baseCommit}' available locally.`,
|
||||||
|
`Note that GitHub Actions checkout is shallow by default: https://github.com/actions/checkout`
|
||||||
|
].join('\n'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
throw new Error([
|
throw new Error([
|
||||||
`Cannot detect changed files for --only-changed mode:`,
|
`Cannot detect changed files for --only-changed mode:`,
|
||||||
`git ${command}`,
|
`git ${command}`,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue