Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,12 @@ This action follows semantic versioning and supports multiple referencing patter
| `max-parallelism` | Maximum number of concurrent BuildKit RUN steps. Defaults to the number of vCPUs on the runner | No | |
| `max-cache-size-mb` | Amount of build cache to retain after pruning, in MB (e.g., 409600 for 400GB). If not set, pruning is skipped | No | |

## Outputs

| Name | Description |
| ------ | ------------ |
| `name` | Builder name |

## Example Workflows

### Basic usage with build-push-action
Expand Down
3 changes: 3 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ inputs:
max-cache-size-mb:
description: "Amount of build cache to retain after pruning, in MB (e.g., 409600 for 400GB). If not set, pruning is skipped."
required: false
outputs:
name:
description: "Builder name"
runs:
using: node24
main: dist/index.js
Expand Down
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.

1 change: 1 addition & 0 deletions src/main.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ vi.mock("@actions/core", () => ({
getInput: vi.fn(),
getBooleanInput: vi.fn(),
setFailed: vi.fn(),
setOutput: vi.fn(),
warning: vi.fn(),
info: vi.fn(),
debug: vi.fn(),
Expand Down
8 changes: 6 additions & 2 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -718,6 +718,8 @@ void actionsToolkit.run(
);
}
});

core.setOutput("name", name);
});

// Print builder info
Expand All @@ -738,13 +740,15 @@ void actionsToolkit.run(
core.info(
`Found configured builder: ${builder.name} (driver: ${builder.driver})`,
);
core.setOutput("name", builder.name);
} else {
// Create a local builder
const createLocalBuilderCmd =
"docker buildx create --name local --driver docker-container --use";
const localBuilderName = "local";
const createLocalBuilderCmd = `docker buildx create --name ${localBuilderName} --driver docker-container --use`;
try {
await Exec.exec(createLocalBuilderCmd);
core.info("Created and set a local builder for use");
core.setOutput("name", localBuilderName);
} catch (error) {
core.setFailed(
`Failed to create local builder: ${(error as Error).message}`,
Expand Down