From 64fde3bc5d02c6829cb39d10c62e6e4d8e741b7c Mon Sep 17 00:00:00 2001 From: Leonhardt Koepsell Date: Sun, 10 Nov 2024 17:41:41 -0700 Subject: [PATCH] Split the inputs of next-image-tag-number for clarity --- next-image-tag-number/action.sh | 15 ++++++--------- next-image-tag-number/action.yml | 12 ++++++++---- 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/next-image-tag-number/action.sh b/next-image-tag-number/action.sh index f29fc7d..7512a5b 100755 --- a/next-image-tag-number/action.sh +++ b/next-image-tag-number/action.sh @@ -2,14 +2,11 @@ set -e -if ! echo "$1" | grep -q "^http"; then - IMAGE_REPOSITORY_URL="https://$1" -else - IMAGE_REPOSITORY_URL="$1" -fi -BEARER_TOKEN=$2 -INITIAL_NUMBER=${3} -TAG_PREFIX=${4} +REPOSITORY_API_URL=$1 +IMAGE_NAME=$2 +BEARER_TOKEN=$3 +INITIAL_NUMBER=$4 +TAG_PREFIX=$5 if [ -n "$BEARER_TOKEN" ]; then AUTH_HEADER="-H \"Authorization: Bearer ${BEARER_TOKEN}\"" @@ -17,7 +14,7 @@ else AUTH_HEADER="" fi -TAGS_LIST_JSON=$(curl -fs $AUTH_HEADER "${IMAGE_REPOSITORY_URL}/tags/list") +TAGS_LIST_JSON=$(curl -fs $AUTH_HEADER "${REPOSITORY_API_URL}/${IMAGE_NAME}/tags/list") TAGS=$(echo "$TAGS_LIST_JSON" | jq -r '.tags[]' || echo "") if [ -z "$TAGS" ]; then diff --git a/next-image-tag-number/action.yml b/next-image-tag-number/action.yml index a6e4a74..bc9d57d 100644 --- a/next-image-tag-number/action.yml +++ b/next-image-tag-number/action.yml @@ -2,11 +2,14 @@ name: Next Image Tag Number description: Get the next tag number for an image in an OCI repository. inputs: - image_repository_url: - description: The URL of the OCI-compatible image repository. + repository_api_url: + description: The full URL of the OCI-compatible repository API. + required: true + image: + description: The name of the image within the specified repository. required: true bearer_token: - description: Optional bearer token for repository authentication. + description: Optional bearer token for authentication. required: false initial_number: description: Starting tag number if no tags exist. @@ -27,7 +30,8 @@ runs: using: docker image: Dockerfile args: - - ${{ inputs.image_repository_url }} + - ${{ inputs.repository_api_url }} + - ${{ inputs.image }} - ${{ inputs.bearer_token }} - ${{ inputs.initial_number }} - ${{ inputs.tag_prefix }}