Skip to content

Commit

Permalink
feat: pull all bake targets by default
Browse files Browse the repository at this point in the history
Previously, it was tricky to pull multiple bake targets.
Now, the depot pull command will pull all bake targets by default.

If only a few targets should be pulled, the `targets` parameter
can be used as a filter.

Signed-off-by: Chris Goller <goller@gmail.com>
  • Loading branch information
goller committed Mar 7, 2024
1 parent 31ccb20 commit c1ec9eb
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 13 deletions.
7 changes: 2 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
org/repo:tag
```
Pull bake image targets:
Pull all bake image targets:
```yaml
jobs:
Expand All @@ -35,9 +35,6 @@ jobs:
- uses: depot/pull-action@v1
with:
build-id: ${{ steps.build.outputs.build-id }}
target: your-target
tags: |
org/repo:tag
```
## Inputs
Expand All @@ -47,7 +44,7 @@ jobs:
| `build-id` | string | **yes** | The build ID to pull images for. |
| `platform` | string | no | The image platform to pull (defaults to the current platform). |
| `tags` | list/CSV | no | A list of tags to apply to the pulled image. |
| `target` | string | no | For a bake build specifies the specific target to pull. |
| `targets` | list/CSV | no | Only pull specific bake targets rather than all. |
| `token` | string | no | The API token to use for authentication. This can be overridden by the `DEPOT_TOKEN` environment variable. |

## License
Expand Down
5 changes: 2 additions & 3 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ inputs:
description: If set, will populate the `DEPOT_TOKEN` environment variable.
default: ''
required: false
target:
description: Specific bake target to pull.
default: ''
targets:
description: Pull specific bake targets rather than all.
required: false
4 changes: 2 additions & 2 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -30521,7 +30521,7 @@ function getInputs() {
buildID: core.getInput("build-id"),
platform: core.getInput("platform"),
tags: parseCSV(core.getInput("tags")),
target: core.getInput("target"),
targets: parseCSV(core.getInput("targets")),
token: core.getInput("token") || process.env.DEPOT_TOKEN
};
}
Expand Down Expand Up @@ -32160,7 +32160,7 @@ async function pull(inputs) {
const args = [
...flag("--platform", inputs.platform),
...flag("--tag", inputs.tags),
...flag("--target", inputs.target)
...flag("--targets", inputs.targets)
];
let token = inputs.token ?? process.env.DEPOT_TOKEN;
const isOSSPullRequest = !token && github.context.eventName === "pull_request" && github.context.payload.repository?.private === false && github.context.payload.pull_request && github.context.payload.pull_request.head?.repo?.full_name !== github.context.payload.repository?.full_name;
Expand Down
4 changes: 2 additions & 2 deletions src/context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export interface Inputs {
buildID: string
platform?: string
tags: string[]
target?: string
targets: string[]
token?: string
}

Expand All @@ -14,7 +14,7 @@ export function getInputs(): Inputs {
buildID: core.getInput('build-id'),
platform: core.getInput('platform'),
tags: parseCSV(core.getInput('tags')),
target: core.getInput('target'),
targets: parseCSV(core.getInput('targets')),
token: core.getInput('token') || process.env.DEPOT_TOKEN,
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/depot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export async function pull(inputs: Inputs) {
const args = [
...flag('--platform', inputs.platform),
...flag('--tag', inputs.tags),
...flag('--target', inputs.target),
...flag('--targets', inputs.targets),
]

let token = inputs.token ?? process.env.DEPOT_TOKEN
Expand Down

0 comments on commit c1ec9eb

Please sign in to comment.