From 81e11db719bc463217d0873345cf1246e2deb45e Mon Sep 17 00:00:00 2001 From: Hugo Valle Date: Tue, 23 Jun 2026 21:23:36 -0600 Subject: [PATCH] fix: publish workflow now recognizes custom PR merge subjects The check-release step only matched "Merge pull request ... from .../release/" and "Merge branch 'release/..." patterns. A custom --subject like "Release v0.4.2" was not detected. Add a third pattern that matches commit messages starting with "Release vX" or "Hotfix vX", and fall back to pyproject.toml for the branch name when no release/ path appears in the commit message. Co-Authored-By: Claude Sonnet 4.6 --- .github/workflows/publish.yml | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 885a670..32527b5 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -43,11 +43,23 @@ jobs: COMMIT_MSG=$(git log -1 --pretty=%B) echo "Commit message: $COMMIT_MSG" - # Check if this is a merge commit from a release or hotfix branch - if [[ $COMMIT_MSG =~ (from .*/(release|hotfix)/) ]] || [[ $COMMIT_MSG =~ "Merge branch '(release|hotfix)/" ]]; then + # Check if this is a merge commit from a release or hotfix branch. + # Matches: + # - Default GitHub PR merge: "Merge pull request #N from org/release/vX.Y.Z" + # - Local merge: "Merge branch 'release/vX.Y.Z'" + # - Custom PR subject: "Release vX.Y.Z" or "Hotfix vX.Y.Z" + if [[ $COMMIT_MSG =~ (from .*/(release|hotfix)/) ]] || \ + [[ $COMMIT_MSG =~ "Merge branch '"(release|hotfix)"/" ]] || \ + [[ $COMMIT_MSG =~ ^[Rr]elease\ v?[0-9] ]] || \ + [[ $COMMIT_MSG =~ ^[Hh]otfix\ v?[0-9] ]]; then echo "is-release=true" >> $GITHUB_OUTPUT - # Extract branch name from commit message - BRANCH_NAME=$(echo "$COMMIT_MSG" | grep -oE "(release|hotfix)/[^'\"]*" | head -1) + # Try to extract branch name from commit message + BRANCH_NAME=$(echo "$COMMIT_MSG" | grep -oE "(release|hotfix)/[^'\" ]+" | head -1) + if [[ -z "$BRANCH_NAME" ]]; then + # Fall back: derive branch name from pyproject.toml version + VERSION=$(grep -E '^version\s*=' pyproject.toml | grep -oE '[0-9]+\.[0-9]+\.[0-9]+[a-zA-Z0-9.]*' | head -1) + BRANCH_NAME="release/v$VERSION" + fi echo "branch-name=$BRANCH_NAME" >> $GITHUB_OUTPUT # Determine release type if [[ $BRANCH_NAME == release/* ]]; then