Skip to content

Commit 64fde3b

Browse files
committed
Split the inputs of next-image-tag-number for clarity
1 parent eefdda6 commit 64fde3b

File tree

2 files changed

+14
-13
lines changed

2 files changed

+14
-13
lines changed

next-image-tag-number/action.sh

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,19 @@
22

33
set -e
44

5-
if ! echo "$1" | grep -q "^http"; then
6-
IMAGE_REPOSITORY_URL="https://$1"
7-
else
8-
IMAGE_REPOSITORY_URL="$1"
9-
fi
10-
BEARER_TOKEN=$2
11-
INITIAL_NUMBER=${3}
12-
TAG_PREFIX=${4}
5+
REPOSITORY_API_URL=$1
6+
IMAGE_NAME=$2
7+
BEARER_TOKEN=$3
8+
INITIAL_NUMBER=$4
9+
TAG_PREFIX=$5
1310

1411
if [ -n "$BEARER_TOKEN" ]; then
1512
AUTH_HEADER="-H \"Authorization: Bearer ${BEARER_TOKEN}\""
1613
else
1714
AUTH_HEADER=""
1815
fi
1916

20-
TAGS_LIST_JSON=$(curl -fs $AUTH_HEADER "${IMAGE_REPOSITORY_URL}/tags/list")
17+
TAGS_LIST_JSON=$(curl -fs $AUTH_HEADER "${REPOSITORY_API_URL}/${IMAGE_NAME}/tags/list")
2118
TAGS=$(echo "$TAGS_LIST_JSON" | jq -r '.tags[]' || echo "")
2219

2320
if [ -z "$TAGS" ]; then

next-image-tag-number/action.yml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,14 @@ name: Next Image Tag Number
22
description: Get the next tag number for an image in an OCI repository.
33

44
inputs:
5-
image_repository_url:
6-
description: The URL of the OCI-compatible image repository.
5+
repository_api_url:
6+
description: The full URL of the OCI-compatible repository API.
7+
required: true
8+
image:
9+
description: The name of the image within the specified repository.
710
required: true
811
bearer_token:
9-
description: Optional bearer token for repository authentication.
12+
description: Optional bearer token for authentication.
1013
required: false
1114
initial_number:
1215
description: Starting tag number if no tags exist.
@@ -27,7 +30,8 @@ runs:
2730
using: docker
2831
image: Dockerfile
2932
args:
30-
- ${{ inputs.image_repository_url }}
33+
- ${{ inputs.repository_api_url }}
34+
- ${{ inputs.image }}
3135
- ${{ inputs.bearer_token }}
3236
- ${{ inputs.initial_number }}
3337
- ${{ inputs.tag_prefix }}

0 commit comments

Comments
 (0)