2025-07-06 10:59:18 +02:00
> [!WARNING]
> `docker/bake-action/subaction/list-targets` is deprecated and will be removed
> in a future release. Please use [`docker/bake-action/subaction/matrix`](../matrix)
> instead.
2024-07-03 20:15:30 +02:00
## About
This subaction generates a list of Bake targets that can be used in a [GitHub matrix ](https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstrategymatrix ),
so you can distribute your builds across multiple runners.
2025-07-06 10:59:18 +02:00

2024-07-03 20:15:30 +02:00
___
* [Usage ](#usage )
* [Customizing ](#customizing )
* [inputs ](#inputs )
* [outputs ](#outputs )
## Usage
```hcl
# docker-bake.hcl
group "validate" {
targets = ["lint", "doctoc"]
}
target "lint" {
target = "lint"
}
target "doctoc" {
target = "doctoc"
}
```
```yaml
jobs:
prepare:
runs-on: ubuntu-latest
outputs:
targets: ${{ steps.generate.outputs.targets }}
steps:
-
name: Checkout
uses: actions/checkout@v4
-
name: List targets
id: generate
2025-01-08 11:07:02 +01:00
uses: docker/bake-action/subaction/list-targets@v6
2024-07-03 20:15:30 +02:00
with:
target: validate
validate:
runs-on: ubuntu-latest
needs:
- prepare
strategy:
fail-fast: false
matrix:
target: ${{ fromJson(needs.prepare.outputs.targets) }}
steps:
-
name: Validate
2025-01-08 11:07:02 +01:00
uses: docker/bake-action@v6
2024-07-03 20:15:30 +02:00
with:
targets: ${{ matrix.target }}
```
## Customizing
### inputs
| Name | Type | Description |
|--------------|-------------|---------------------------------------------------------------------------------------------------------------------------------------------|
| `workdir` | String | Working directory to use (defaults to `.` ) |
| `files` | List/CSV | List of [bake definition files ](https://docs.docker.com/build/customize/bake/file-definition/ ) |
| `target` | String | The target to use within the bake file |
### outputs
The following outputs are available
2025-07-06 10:59:18 +02:00
| Name | Type | Description |
|------------|----------|---------------------------|
| `targets` | List/CSV | List of extracted targets |