refactor: use built-in getExecOutput (#292)

Co-authored-by: CrazyMax <crazy-max@users.noreply.github.com>
This commit is contained in:
CrazyMax
2021-06-10 03:02:52 +02:00
committed by GitHub
co-authored by CrazyMax
parent b2263bd81e
commit b59bff5dc3
6 changed files with 36 additions and 124 deletions
+12 -7
View File
@@ -1,12 +1,17 @@
import * as exec from './exec';
import * as exec from '@actions/exec';
const git = async (args: string[] = []): Promise<string> => {
return await exec.exec(`git`, args, true).then(res => {
if (res.stderr != '' && !res.success) {
throw new Error(res.stderr);
}
return res.stdout.trim();
});
return await exec
.getExecOutput(`git`, args, {
ignoreReturnCode: true,
silent: true
})
.then(res => {
if (res.stderr.length > 0 && res.exitCode != 0) {
throw new Error(res.stderr);
}
return res.stdout.trim();
});
};
export async function getTag(): Promise<string> {