Skip to content

Commit 8c1e35a

Browse files
authored
Merge pull request #61 from crazy-max/exec-output
Use built-in getExecOutput
2 parents aa08745 + f3c51a3 commit 8c1e35a

File tree

5 files changed

+23
-64
lines changed

5 files changed

+23
-64
lines changed

README.md

+8-19
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ ___
1313
* [Usage](#usage)
1414
* [Customizing](#customizing)
1515
* [inputs](#inputs)
16-
* [Keep up-to-date with GitHub Dependabot](#keep-up-to-date-with-github-dependabot)
16+
* [Contributing](#contributing)
1717

1818
## Usage
1919

@@ -38,10 +38,10 @@ jobs:
3838
3939
Following inputs can be used as `step.with` keys
4040

41-
| Name | Type | Description |
42-
|------------------|---------|------------------------------------|
43-
| `image` | String | QEMU static binaries Docker image (default [`tonistiigi/binfmt:latest`](https://hub.docker.com/r/tonistiigi/binfmt/tags)) |
44-
| `platforms` | String | Platforms to install (e.g. `arm64,riscv64,arm` ; default `all`) |
41+
| Name | Type | Description |
42+
|-------------|--------|---------------------------------------------------------------------------------------------------------------------------|
43+
| `image` | String | QEMU static binaries Docker image (default [`tonistiigi/binfmt:latest`](https://hub.docker.com/r/tonistiigi/binfmt/tags)) |
44+
| `platforms` | String | Platforms to install (e.g. `arm64,riscv64,arm` ; default `all`) |
4545

4646
### outputs
4747

@@ -51,18 +51,7 @@ Following outputs are available
5151
|---------------|---------|---------------------------------------|
5252
| `platforms` | String | Available platforms (comma separated) |
5353

54-
## Keep up-to-date with GitHub Dependabot
54+
## Contributing
5555

56-
Since [Dependabot](https://docs.github.com/en/github/administering-a-repository/keeping-your-actions-up-to-date-with-github-dependabot)
57-
has [native GitHub Actions support](https://docs.github.com/en/github/administering-a-repository/configuration-options-for-dependency-updates#package-ecosystem),
58-
to enable it on your GitHub repo all you need to do is add the `.github/dependabot.yml` file:
59-
60-
```yaml
61-
version: 2
62-
updates:
63-
# Maintain dependencies for GitHub Actions
64-
- package-ecosystem: "github-actions"
65-
directory: "/"
66-
schedule:
67-
interval: "daily"
68-
```
56+
Want to contribute? Awesome! You can find information about contributing to
57+
this project in the [CONTRIBUTING.md](/.github/CONTRIBUTING.md)

dist/index.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/exec.ts

-34
This file was deleted.

src/main.ts

+13-9
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import * as mexec from './exec';
21
import * as core from '@actions/core';
32
import * as exec from '@actions/exec';
43
import {issueCommand} from '@actions/core/lib/command';
@@ -31,14 +30,19 @@ async function run(): Promise<void> {
3130
core.endGroup();
3231

3332
core.startGroup(`Extracting available platforms`);
34-
await mexec.exec(`docker`, ['run', '--rm', '--privileged', image], true).then(res => {
35-
if (res.stderr != '' && !res.success) {
36-
throw new Error(res.stderr);
37-
}
38-
const platforms: Platforms = JSON.parse(res.stdout.trim());
39-
core.info(`${platforms.supported.join(',')}`);
40-
setOutput('platforms', platforms.supported.join(','));
41-
});
33+
await exec
34+
.getExecOutput('docker', ['run', '--rm', '--privileged', image], {
35+
ignoreReturnCode: true,
36+
silent: true
37+
})
38+
.then(res => {
39+
if (res.stderr.length > 0 && res.exitCode != 0) {
40+
throw new Error(res.stderr.trim());
41+
}
42+
const platforms: Platforms = JSON.parse(res.stdout.trim());
43+
core.info(`${platforms.supported.join(',')}`);
44+
setOutput('platforms', platforms.supported.join(','));
45+
});
4246
core.endGroup();
4347
} catch (error) {
4448
core.setFailed(error.message);

0 commit comments

Comments
 (0)