From 602b3da719ea3a0fe28c79cfd0b23b93ff6580b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=BCneyt=20=C5=9Eent=C3=BCrk?= Date: Sat, 7 Nov 2026 08:59:50 +0000 Subject: [PATCH] Fail the build when the Akaunting release tag cannot be resolved The scheduled run on 2026-11-01 failed for the main image. The anonymous GitHub API request for the latest Akaunting release was rate limited, and `jq -r` turned the error response into the string "null". The image was then tagged as `nullakaunting/akaunting:latest` and the push was denied, so `latest`, `3`, `3.3` and `3.3.0` were never published. Authenticate the request with the workflow token, retry it on transient errors, and stop the job when the response has no tag or the tag is not a plain x.y.z version, instead of pushing to a wrong tag. --- .github/workflows/docker-hub.yml | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/.github/workflows/docker-hub.yml b/.github/workflows/docker-hub.yml index c4bff9e..91e9a8f 100644 --- a/.github/workflows/docker-hub.yml +++ b/.github/workflows/docker-hub.yml @@ -36,11 +36,19 @@ jobs: uses: actions/checkout@v4 - name: Define tag name id: tag-name + env: + GH_TOKEN: ${{ github.token }} run: | if [ "${GITHUB_REF}" == "refs/heads/master" -a "${GITHUB_EVENT_NAME}" != "pull_request" ]; then - curl -s https://api.github.com/repos/akaunting/akaunting/releases/latest \ - | jq -r .tag_name | sed \ - -e 's/^/tag=/' >> "$GITHUB_OUTPUT" + # Authenticated request, so parallel matrix jobs don't hit the anonymous API rate limit + tag=$(curl -sf --retry 3 -H "Authorization: Bearer ${GH_TOKEN}" \ + https://api.github.com/repos/akaunting/akaunting/releases/latest \ + | jq -er .tag_name) + if ! [[ "$tag" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then + echo "::error::Unexpected Akaunting release tag: '${tag}'" + exit 1 + fi + echo "tag=${tag}" >> "$GITHUB_OUTPUT" else echo -n "tag=" >> "$GITHUB_OUTPUT" echo "$GITHUB_REF" | cut -d/ -f3- | tr '/' '_' >> "$GITHUB_OUTPUT"