feat: using gh-star-fetch

This commit is contained in:
Simone Corsi
2022-05-09 15:57:03 +02:00
parent 459ca45678
commit 346ba5d4b7
10 changed files with 316 additions and 991 deletions

View File

@@ -34,28 +34,26 @@ class Git {
return isShallow.trim().replace('\n', '') === 'true';
};
exec = (command: string): Promise<string> => {
return new Promise(async (resolve, reject) => {
let execOutput = '';
async exec(command: string): Promise<string> {
let execOutput = '';
const options = {
listeners: {
stdout: (data: Buffer) => {
execOutput += data.toString();
},
const options = {
listeners: {
stdout: (data: Buffer) => {
execOutput += data.toString();
},
};
},
};
const exitCode = await exec.exec(`git ${command}`, undefined, options);
const exitCode = await exec.exec(`git ${command}`, undefined, options);
if (exitCode === 0) {
return resolve(execOutput);
} else {
core.error(`Command "git ${command}" exited with code ${exitCode}.`);
return reject(`Command "git ${command}" exited with code ${exitCode}.`);
}
});
};
if (exitCode === 0) {
return execOutput;
} else {
core.error(`Command "git ${command}" exited with code ${exitCode}.`);
throw new Error(`Command "git ${command}" exited with code ${exitCode}.`);
}
}
config = (prop: string, value: string) =>
this.exec(`config ${prop} "${value}"`);