Skip to content

Commit

Permalink
Use built-in getExecOutput (#102)
Browse files Browse the repository at this point in the history
Co-authored-by: CrazyMax <crazy-max@users.noreply.github.com>
  • Loading branch information
crazy-max and crazy-max committed Aug 10, 2021
1 parent 93f53be commit dd220e9
Show file tree
Hide file tree
Showing 5 changed files with 181 additions and 206 deletions.
137 changes: 55 additions & 82 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions jest.config.js
@@ -1,5 +1,6 @@
module.exports = {
clearMocks: true,
restoreMocks: true,
coverageDirectory: 'coverage',
moduleFileExtensions: ['js', 'ts'],
testEnvironment: 'node',
Expand Down
34 changes: 0 additions & 34 deletions src/exec.ts

This file was deleted.

19 changes: 12 additions & 7 deletions src/git.ts
@@ -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 setConfig(key: string, value: string): Promise<void> {
Expand Down

0 comments on commit dd220e9

Please sign in to comment.