Skip to content

Commit

Permalink
Split the inputs of next-image-tag-number for clarity
Browse files Browse the repository at this point in the history
  • Loading branch information
lnhrdt committed Nov 11, 2024
1 parent eefdda6 commit 64fde3b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 13 deletions.
15 changes: 6 additions & 9 deletions next-image-tag-number/action.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,19 @@

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}\""
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
Expand Down
12 changes: 8 additions & 4 deletions next-image-tag-number/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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 }}

0 comments on commit 64fde3b

Please sign in to comment.