Skip to content

Commit

Permalink
refactor: use getExecOutput() of @actions/exec (#50)
Browse files Browse the repository at this point in the history
See also:
- #45
- actions/toolkit#814
  • Loading branch information
ybiquitous committed Jul 1, 2021
1 parent e8f62cf commit 128ff25
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 19 deletions.
11 changes: 2 additions & 9 deletions dist/index.cjs

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

13 changes: 3 additions & 10 deletions lib/index.js
@@ -1,5 +1,5 @@
import * as core from "@actions/core";
import { exec } from "@actions/exec";
import { exec, getExecOutput } from "@actions/exec";
import { getOctokit } from "@actions/github";
import { RequestError } from "@octokit/request-error";

Expand Down Expand Up @@ -36,15 +36,8 @@ export const npmDiffCommand = ({ name, from, to }) => [
* @param {string[]} cmdArgs
*/
const runCommand = async (cmd, cmdArgs) => {
let out = "";
await exec(cmd, cmdArgs, {
listeners: {
stdout: (data) => {
out += data.toString();
},
},
});
return out;
const { stdout } = await getExecOutput(cmd, cmdArgs);
return stdout;
};

/**
Expand Down

0 comments on commit 128ff25

Please sign in to comment.