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"