From 61609c69f982ff0980ea9f2f7a349a35abd370bd Mon Sep 17 00:00:00 2001 From: Marco Bambini Date: Mon, 16 Nov 2026 10:11:56 +0100 Subject: [PATCH] fix: read a version from a tag that carries no v Get version stripped "refs/tags/v" from GITHUB_REF in one go, which assumes every caller tags v1.4.3. sqlite-js tags with the bare version its Makefile reports, 1.4.3, and for such a tag the prefix does not match, so nothing was removed: VERSION became the whole refs/tags/1.4.3 and the format check in "Extract User-Facing Changelog and Generate JSON" rejected it. refs/tags/ now comes off first and a leading v after it, so 1.4.3 and v1.4.3 both read as 1.4.3. Callers that tag with a v get exactly what they got before. This was invisible until now because sqlite-js's own workflow listened for "v*.*.*" tags, which its tags never matched either, so the workflow had run once in its life, by hand. With that pattern fixed the next tag would have started this workflow and failed it here. Two things fall out of the same step: - VERSION is a shell variable now, so the URL output carries the version. It was read as a shell variable already, but only ever written to $GITHUB_OUTPUT, so the URL ended at releases/tag/ with nothing after it and the issue-closing comment linked to it. - test_version arrives through the env instead of being interpolated into the script, since the value belongs to whoever runs the dispatch. Checked against refs/tags/1.4.3, refs/tags/v1.4.3 and refs/tags/2.0.10: all three give the bare version and pass the format check. The YAML parses. Co-Authored-By: Claude Opus 5 --- .github/workflows/action.yml | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/.github/workflows/action.yml b/.github/workflows/action.yml index c139406..b95502f 100644 --- a/.github/workflows/action.yml +++ b/.github/workflows/action.yml @@ -62,12 +62,23 @@ jobs: - name: Get version id: get_version + env: + # Through the env rather than interpolated into the script: it is a dispatch input, + # so its value is chosen by whoever runs the workflow. + TEST_VERSION: ${{ github.event.inputs.test_version }} run: | if [[ "${{ github.event_name }}" == "push" ]]; then - echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT + # A caller's tag may or may not carry a v: sqlite-js tags 1.4.3, where others tag + # v1.4.3. Taking off refs/tags/ and then an optional v reads both as 1.4.3, where + # stripping "refs/tags/v" in one go left a bare tag as the whole refs/tags/1.4.3, + # which the version check further down then rejected. + VERSION=${GITHUB_REF#refs/tags/} + VERSION=${VERSION#v} else - echo "VERSION=${{ github.event.inputs.test_version }}" >> $GITHUB_OUTPUT + VERSION=$TEST_VERSION fi + echo "VERSION=$VERSION" >> $GITHUB_OUTPUT + # VERSION is a shell variable now, so this URL no longer comes out without it. echo "URL=${{ github.server_url }}/${{ github.repository }}/releases/tag/$VERSION" >> $GITHUB_OUTPUT - name: Extract Full Changelog for Release