Skip to content

Commit

Permalink
Use built-in getExecOutput
Browse files Browse the repository at this point in the history
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
  • Loading branch information
crazy-max committed Oct 8, 2022
1 parent aa08745 commit c47ad32
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 45 deletions.
2 changes: 1 addition & 1 deletion dist/index.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

34 changes: 0 additions & 34 deletions src/exec.ts

This file was deleted.

22 changes: 13 additions & 9 deletions src/main.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import * as mexec from './exec';
import * as core from '@actions/core';
import * as exec from '@actions/exec';
import {issueCommand} from '@actions/core/lib/command';
Expand Down Expand Up @@ -31,14 +30,19 @@ async function run(): Promise<void> {
core.endGroup();

core.startGroup(`Extracting available platforms`);
await mexec.exec(`docker`, ['run', '--rm', '--privileged', image], true).then(res => {
if (res.stderr != '' && !res.success) {
throw new Error(res.stderr);
}
const platforms: Platforms = JSON.parse(res.stdout.trim());
core.info(`${platforms.supported.join(',')}`);
setOutput('platforms', platforms.supported.join(','));
});
await exec
.getExecOutput('docker', ['run', '--rm', '--privileged', image], {
ignoreReturnCode: true,
silent: true
})
.then(res => {
if (res.stderr.length > 0 && res.exitCode != 0) {
throw new Error(res.stderr.trim());
}
const platforms: Platforms = JSON.parse(res.stdout.trim());
core.info(`${platforms.supported.join(',')}`);
setOutput('platforms', platforms.supported.join(','));
});
core.endGroup();
} catch (error) {
core.setFailed(error.message);
Expand Down

0 comments on commit c47ad32

Please sign in to comment.