danger: ignore known git show error

This commit is contained in:
Jamie Kyle 2022-12-05 17:13:20 -08:00 committed by GitHub
parent 9348940ecf
commit 8fe51cc854
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -6,4 +6,19 @@ import { run } from 'endanger';
import migrateBackboneToRedux from './rules/migrateBackboneToRedux';
import packageJsonVersionsShouldBePinned from './rules/packageJsonVersionsShouldBePinned';
run(migrateBackboneToRedux(), packageJsonVersionsShouldBePinned());
function isGitDeletedError(error: unknown) {
return (
typeof error === 'object' &&
error != null &&
error['code'] === 128 &&
error['command']?.startsWith('git show ')
);
}
try {
run(migrateBackboneToRedux(), packageJsonVersionsShouldBePinned());
} catch (error: unknown) {
if (!isGitDeletedError(error)) {
throw error;
}
}