Skip to content

Commit e2e648a

Browse files
authored
Add image_name parameter in case $org/$repo isn't acceptable (#27)
2 parents 2914a68 + b8caac4 commit e2e648a

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

action.yml

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ inputs:
2929
description: "Sets the target stage to build"
3030
required: false
3131
default: ''
32+
image_name:
33+
description: "Image name (excluding registry). Defaults to {{$organization/$repository}}."
34+
required: false
35+
default: ''
3236
login:
3337
description: 'Docker login'
3438
required: false
@@ -54,21 +58,30 @@ inputs:
5458
outputs:
5559
image:
5660
description: "Docker image name"
57-
value: ${{ inputs.registry }}/${{ inputs.organization }}/${{ inputs.repository }}
61+
value: ${{ inputs.registry }}/${{ steps.image_name.outputs.image_name }}
5862
tag:
5963
description: "Docker image tag"
6064
value: ${{ steps.tag.outputs.output }}
6165

6266
runs:
6367
using: "composite"
6468
steps:
69+
- name: Set image name
70+
id: image_name
71+
shell: bash
72+
run: |
73+
if [ "${{ inputs.image_name }}" = "" ]; then
74+
echo 'image_name=${{ inputs.organization }}/${{ inputs.repository }}' >> "$GITHUB_OUTPUT"
75+
else
76+
echo 'image_name=${{inputs.image_name}}' >> "$GITHUB_OUTPUT"
77+
fi
6578
- name: Docker meta
6679
id: meta
6780
uses: docker/metadata-action@v4
6881
with:
6982
# list of Docker images to use as base name for tags
7083
images: |
71-
${{ inputs.registry }}/${{ inputs.organization }}/${{ inputs.repository }}
84+
${{ inputs.registry }}/${{ steps.image_name.outputs.image_name }}
7285
# generate Docker tags based on the following events/attributes
7386
tags: |
7487
type=sha

0 commit comments

Comments
 (0)