fix: should fix unshallow repo

This commit is contained in:
Simone Corsi 2021-01-16 13:03:36 +01:00
parent 9badeafda3
commit 17c5d8550a

View File

@ -23,6 +23,14 @@ export default new (class Git {
);
}
isShallow = async () => {
const isShallow: string = await this.exec(
'rev-parse --is-shallow-repository'
);
return isShallow.trim().replace('\n', '') === 'true';
};
exec = (command: string): Promise<string> => {
return new Promise(async (resolve, reject) => {
let execOutput = '';
@ -56,6 +64,11 @@ export default new (class Git {
pull = async () => {
const args = ['pull'];
// Check if the repo is unshallow
if (await this.isShallow()) {
args.push('--unshallow');
}
args.push('--tags');
args.push(core.getInput('git-pull-method'));