Skip to content

Commit

Permalink
Merge pull request #67 from GMartinez-Sisti/config-input
Browse files Browse the repository at this point in the history
Add config input
  • Loading branch information
crazy-max authored Apr 22, 2021
2 parents 583a314 + 9b36596 commit abdb186
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 2 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ Following inputs can be used as `step.with` keys
| `install` | Bool | Sets up `docker build` command as an alias to `docker buildx` (default `false`) |
| `use` | Bool | Switch to this builder instance (default `true`) |
| `endpoint` | String | [Optional address for docker socket](https://github.com/docker/buildx/blob/master/docs/reference/buildx_create.md#description) or context from `docker context ls` |
| `config` | String | [Optional config file path](https://github.com/docker/buildx/blob/master/docs/reference/buildx_create.md#config) |

> `CSV` type must be a newline-delimited string
> ```yaml
Expand Down
3 changes: 3 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ inputs:
endpoint:
description: 'Optional address for docker socket or context from `docker context ls`'
required: false
config:
description: 'Optional config file path'
required: false

outputs:
name:
Expand Down
6 changes: 5 additions & 1 deletion dist/index.js

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

4 changes: 3 additions & 1 deletion src/context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export interface Inputs {
install: boolean;
use: boolean;
endpoint: string;
config: string;
}

export async function getInputs(): Promise<Inputs> {
Expand All @@ -24,7 +25,8 @@ export async function getInputs(): Promise<Inputs> {
'--allow-insecure-entitlement security.insecure --allow-insecure-entitlement network.host',
install: /true/i.test(core.getInput('install')),
use: /true/i.test(core.getInput('use')),
endpoint: core.getInput('endpoint')
endpoint: core.getInput('endpoint'),
config: core.getInput('config')
};
}

Expand Down
3 changes: 3 additions & 0 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ async function run(): Promise<void> {
if (inputs.endpoint) {
createArgs.push(inputs.endpoint);
}
if (inputs.config) {
createArgs.push('--config', inputs.config);
}
await exec.exec('docker', createArgs);
core.endGroup();

Expand Down

0 comments on commit abdb186

Please sign in to comment.