Skip to content

Commit 988bd06

Browse files
feat(build-push-to-dockerhub): add labels input (#1471)
* feat(build-push-to-dockerhub): add labels input Allow custom labels to be added to container images. * fix(build-push-to-dockerhub): remove required `labels` shouldn't be required. * feat(build-push-to-dockerhub): copilot feedback Address suggestions from Copilot.
1 parent adf96be commit 988bd06

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

actions/build-push-to-dockerhub/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ jobs:
5353
| `push` | Bool | Push the generated image (default: `false`) |
5454
| `repository` | String | Docker repository name (**required**) |
5555
| `tags` | List | Tags that should be used for the image (see the [metadata-action][mda] for details) |
56+
| `labels` | List | Labels that should be used for the image (see the [metadata-action][mda] for details) |
5657
| `file` | String | Path and filename of the dockerfile to build from. (Default: `{context}/Dockerfile`) |
5758
| `build-args` | String | List of arguments necessary for the Docker image to be built. |
5859
| `target` | String | Sets the target stage to build |

actions/build-push-to-dockerhub/action.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ inputs:
99
description: |
1010
List of Docker images to be pushed.
1111
required: true
12+
labels:
13+
description: |
14+
List of custom labels to be added to the image.
15+
required: false
1216
context:
1317
description: |
1418
Path to the Docker build context.
@@ -106,6 +110,7 @@ runs:
106110
uses: docker/metadata-action@c1e51972afc2121e065aed6d45c65596fe445f3f # v5.8.0
107111
with:
108112
images: ${{ inputs.repository }}
113+
labels: ${{ inputs.labels }}
109114
tags: ${{ inputs.tags }}
110115

111116
# The `context` input is flagged by Zizmor as a [sink]. This means that with

0 commit comments

Comments
 (0)