Skip to content

Commit d0d6b12

Browse files
committed
feat: expose builder name output
1 parent 722e97d commit d0d6b12

6 files changed

Lines changed: 18 additions & 4 deletions

File tree

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,12 @@ This action follows semantic versioning and supports multiple referencing patter
6060
| `max-parallelism` | Maximum number of concurrent BuildKit RUN steps. Defaults to the number of vCPUs on the runner | No | |
6161
| `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 | |
6262

63+
## Outputs
64+
65+
| Name | Description |
66+
| ------ | ------------ |
67+
| `name` | Builder name |
68+
6369
## Example Workflows
6470

6571
### Basic usage with build-push-action

action.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ inputs:
3535
max-cache-size-mb:
3636
description: "Amount of build cache to retain after pruning, in MB (e.g., 409600 for 400GB). If not set, pruning is skipped."
3737
required: false
38+
outputs:
39+
name:
40+
description: "Builder name"
3841
runs:
3942
using: node24
4043
main: dist/index.js

dist/index.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/main.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ vi.mock("@actions/core", () => ({
77
getInput: vi.fn(),
88
getBooleanInput: vi.fn(),
99
setFailed: vi.fn(),
10+
setOutput: vi.fn(),
1011
warning: vi.fn(),
1112
info: vi.fn(),
1213
debug: vi.fn(),

src/main.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -718,6 +718,8 @@ void actionsToolkit.run(
718718
);
719719
}
720720
});
721+
722+
core.setOutput("name", name);
721723
});
722724

723725
// Print builder info
@@ -738,13 +740,15 @@ void actionsToolkit.run(
738740
core.info(
739741
`Found configured builder: ${builder.name} (driver: ${builder.driver})`,
740742
);
743+
core.setOutput("name", builder.name);
741744
} else {
742745
// Create a local builder
743-
const createLocalBuilderCmd =
744-
"docker buildx create --name local --driver docker-container --use";
746+
const localBuilderName = "local";
747+
const createLocalBuilderCmd = `docker buildx create --name ${localBuilderName} --driver docker-container --use`;
745748
try {
746749
await Exec.exec(createLocalBuilderCmd);
747750
core.info("Created and set a local builder for use");
751+
core.setOutput("name", localBuilderName);
748752
} catch (error) {
749753
core.setFailed(
750754
`Failed to create local builder: ${(error as Error).message}`,

0 commit comments

Comments
 (0)