From bc52022ce2df7d964b121bd09b7a4b114ce55605 Mon Sep 17 00:00:00 2001 From: Aleksandr Cupacenko Date: Sat, 8 Aug 2026 22:18:35 +0300 Subject: [PATCH 1/2] Update tag workflow to support optional pull request suffix in commit subject --- .github/workflows/tag.yml | 4 ++-- docs/PROJECT.md | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/tag.yml b/.github/workflows/tag.yml index de961f9..d43d768 100644 --- a/.github/workflows/tag.yml +++ b/.github/workflows/tag.yml @@ -51,11 +51,11 @@ jobs: if [[ -n "$MANUAL_TAG" ]]; then tag="$MANUAL_TAG" echo "Using manual tag override: $tag" - elif [[ "$subject" =~ ^Update[[:space:]]+([a-z0-9][a-z0-9-]*)[[:space:]]+to[[:space:]]+([0-9]+\.[0-9]+\.[0-9]+)$ ]]; then + elif [[ "$subject" =~ ^Update[[:space:]]+([a-z0-9][a-z0-9-]*)[[:space:]]+to[[:space:]]+([0-9]+\.[0-9]+\.[0-9]+)([[:space:]]+\(#[0-9]+\))?$ ]]; then tag="${BASH_REMATCH[1]}/v${BASH_REMATCH[2]}" echo "Derived tag from commit subject: $tag" else - echo "Commit subject does not match 'Update to '; no tag will be created: $subject" + echo "Commit subject does not match 'Update to [(#PR)]'; no tag will be created: $subject" echo "create=false" >> "$GITHUB_OUTPUT" exit 0 fi diff --git a/docs/PROJECT.md b/docs/PROJECT.md index c31ab8f..59b1aee 100644 --- a/docs/PROJECT.md +++ b/docs/PROJECT.md @@ -141,9 +141,9 @@ Images are released independently from tags in this form: /v ``` -A push to `main` whose commit subject exactly matches -`Update to ` creates the corresponding release tag. For -example: +A push to `main` whose commit subject matches `Update to `, +optionally followed by GitHub's squash-merge suffix ` (#)`, +creates the corresponding release tag. For example: From ddc33e0800a332dea05b2849bb95f2a191fea3eb Mon Sep 17 00:00:00 2001 From: Aleksandr Cupacenko Date: Sat, 8 Aug 2026 22:27:30 +0300 Subject: [PATCH 2/2] Fix missing-tag handling in tag workflow --- .github/workflows/tag.yml | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/.github/workflows/tag.yml b/.github/workflows/tag.yml index d43d768..07ac63f 100644 --- a/.github/workflows/tag.yml +++ b/.github/workflows/tag.yml @@ -98,14 +98,12 @@ jobs: run: | set -euo pipefail - existing_sha="$( + if existing_sha="$( gh api \ "repos/${GITHUB_REPOSITORY}/git/ref/tags/${TAG}" \ --jq '.object.sha' \ - 2>/dev/null || true - )" - - if [[ -n "$existing_sha" ]]; then + 2>/dev/null + )"; then if [[ "$existing_sha" == "$GITHUB_SHA" ]]; then echo "Tag $TAG already points to $GITHUB_SHA; nothing to do" exit 0