Skip to content

Commit 6e8dd83

Browse files
committed
Refactor, update README examples
1 parent e60e1ae commit 6e8dd83

File tree

3 files changed

+10
-6
lines changed

3 files changed

+10
-6
lines changed

next-image-tag-number/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
FROM alpine:latest
22
RUN apk add --update --no-cache --no-progress curl jq
3-
COPY get-next-tag-number.sh /get-next-tag-number.sh
4-
ENTRYPOINT ["/get-next-tag-number.sh"]
3+
COPY action.sh /action.sh
4+
ENTRYPOINT ["/action.sh"]

next-image-tag-number/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
id: next-tag
1818
uses: codebandits/github-actions/next-image-tag-number@main
1919
with:
20-
image_repository_url: https://registry.example.com/v2/my-repo/my-image
20+
image_repository_url: registry.example.com/repository/image
2121
bearer_token: ${{ secrets.REPO_BEARER_TOKEN }}
2222
initial_number: 100
2323
tag_prefix: build-
@@ -27,7 +27,7 @@ jobs:
2727
2828
## Inputs
2929
30-
- `image_repository_url:` **Required.** The URL of the OCI-compatible image repository.
30+
- `image_repository_url:` **Required.** The URL of the OCI-compatible image repository. If the protocol is omitted, https is assumed.
3131
- `bearer_token:` Optional. The bearer token for repository authentication. Defaults to empty (no authentication).
3232
- `initial_number:` Optional. Starting tag number if no tags exist in the repository. Defaults to 1.
3333
- `tag_prefix:` Optional. Prefix for the tags. Defaults to build-.

next-image-tag-number/get-next-tag-number.sh renamed to next-image-tag-number/action.sh

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
#!/usr/bin/env sh
22

3-
REPOSITORY_URL=$1
3+
if ! echo "$1" | grep -q "^http"; then
4+
IMAGE_REPOSITORY_URL="https://$1"
5+
else
6+
IMAGE_REPOSITORY_URL="$1"
7+
fi
48
BEARER_TOKEN=$2
59
INITIAL_NUMBER=${3:-1}
610
TAG_PREFIX=${4:-"build-"}
@@ -11,7 +15,7 @@ else
1115
AUTH_HEADER=""
1216
fi
1317

14-
TAGS=$(curl -s $AUTH_HEADER "${REPOSITORY_URL}/tags/list" | jq -r '.tags[]' || echo "")
18+
TAGS=$(curl -s $AUTH_HEADER "${IMAGE_REPOSITORY_URL}/tags/list" | jq -r '.tags[]' || echo "")
1519

1620
if [ -z "$TAGS" ]; then
1721
echo "No existing tags were found. Using initial tag number ${INITIAL_NUMBER}."

0 commit comments

Comments
 (0)