Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use built-in getExecOutput #61

Merged
merged 2 commits into from Oct 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
27 changes: 8 additions & 19 deletions README.md
Expand Up @@ -13,7 +13,7 @@ ___
* [Usage](#usage)
* [Customizing](#customizing)
* [inputs](#inputs)
* [Keep up-to-date with GitHub Dependabot](#keep-up-to-date-with-github-dependabot)
* [Contributing](#contributing)

## Usage

Expand All @@ -38,10 +38,10 @@ jobs:

Following inputs can be used as `step.with` keys

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

### outputs

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

## Keep up-to-date with GitHub Dependabot
## Contributing

Since [Dependabot](https://docs.github.com/en/github/administering-a-repository/keeping-your-actions-up-to-date-with-github-dependabot)
has [native GitHub Actions support](https://docs.github.com/en/github/administering-a-repository/configuration-options-for-dependency-updates#package-ecosystem),
to enable it on your GitHub repo all you need to do is add the `.github/dependabot.yml` file:

```yaml
version: 2
updates:
# Maintain dependencies for GitHub Actions
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
```
Want to contribute? Awesome! You can find information about contributing to
this project in the [CONTRIBUTING.md](/.github/CONTRIBUTING.md)
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
@@ -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