Skip to content

Fix release workflow: broken regex and fragile multiline handling for bump detection#6

Merged
nilsandrey merged 3 commits into
mainfrom
copilot/fix-release-action-bump-version
Mar 8, 2026
Merged

Fix release workflow: broken regex and fragile multiline handling for bump detection#6
nilsandrey merged 3 commits into
mainfrom
copilot/fix-release-action-bump-version

Conversation

Copilot AI commented Mar 8, 2026

Copy link
Copy Markdown
Contributor

Description

Fix release workflow bump detection: correct broken regex (\[xX\]\[[xX]\]), use temp file + awk markers for reliable multiline PR body handling, replace echo | grep with here-strings, and fall back to full-body scan when markers are missing.

Type of Change

  • Major – Breaking change (requires a new major version bump)
  • Minor – New feature, backward-compatible (requires a new minor version bump)
  • Patch – Bug fix or internal improvement, backward-compatible (requires a new patch version bump)

Details

Release workflow fails to detect checked version-bump checkbox (run #22827290539), even when - [x] **Patch** is clearly present in the PR body.

Broken regex

\[xX\] in ERE matches the literal 4-char string [xX], not [x] or [X]:

# Before — never matches
echo '- [x] **Patch**' | grep -qE '\[xX\] \*\*Patch\*\*'   # NO MATCH

# After — character class works correctly
echo '- [x] **Patch**' | grep -qE '\[[xX]\] \*\*Patch\*\*'  # MATCH

Fragile multiline handling

  • PR body is now written to a temp file via printf to reliably preserve newlines regardless of shell behavior
  • Checkbox lines are extracted between <!--changelog-type-start--> / <!--changelog-type-end--> markers with awk before grepping, avoiding false matches from other sections
  • When markers are missing (e.g., PR not created from the template), the workflow falls back to scanning the full PR body with a ::warning:: annotation instead of failing with a misleading error

Robust grep usage

  • Replaced echo "$VAR" | grep with here-strings (grep ... <<< "$VAR") to avoid echo's implementation-defined behavior with certain leading characters and escape sequences

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

…tection

The regex `\[xX\]` matched the literal string `[xX]` instead of `[x]` or
`[X]`. Changed to `\[[xX]\]` which uses a character class.

Additionally, PR body is now written to a temp file and checkbox lines are
extracted between <!--changelog-type-start--> / <!--changelog-type-end-->
markers with awk before grepping, ensuring multiline content is preserved.

Co-authored-by: nilsandrey <3579285+nilsandrey@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix release action to detect version bumps correctly Fix release workflow: broken regex and fragile multiline handling for bump detection Mar 8, 2026
@nilsandrey
nilsandrey marked this pull request as ready for review March 8, 2026 22:38
Copilot AI review requested due to automatic review settings March 8, 2026 22:39

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the release GitHub Actions workflow to correctly detect the selected version-bump checkbox in merged PR bodies, making bump detection more reliable for multiline PR descriptions.

Changes:

  • Fix the checkbox-regex so [x] / [X] are matched correctly in ERE.
  • Persist the PR body to a temp file and write it to GITHUB_OUTPUT via cat to preserve multiline content.
  • Restrict bump detection to the section between <!--changelog-type-start--> and <!--changelog-type-end--> markers.

Comment thread .github/workflows/release.yml
Comment thread .github/workflows/release.yml Outdated
…ssing

Replace `echo "$CHECKBOX_LINES" | grep` with `grep <<< "$CHECKBOX_LINES"`
to avoid implementation-defined echo behavior. Also fall back to scanning
the full PR body with a warning when changelog-type markers are absent.

Co-authored-by: nilsandrey <3579285+nilsandrey@users.noreply.github.com>
@nilsandrey

Copy link
Copy Markdown
Owner

@copilot Update this PR description to have the expected sections for the Release pipeline used to update changelog and release I think.

Description

Type of Change

  • Major – Breaking change (requires a new major version bump)
  • Minor – New feature, backward-compatible (requires a new minor version bump)
  • Patch – Bug fix or internal improvement, backward-compatible (requires a new patch version bump)

Copilot AI commented Mar 8, 2026

Copy link
Copy Markdown
Contributor Author

@copilot Update this PR description to have the expected sections for the Release pipeline used to update changelog and release I think.

Description

...

Updated the PR description with the expected ## Description (wrapped in <!--changelog-description-start--> / <!--changelog-description-end--> markers) and ## Type of Change sections (with <!--changelog-type-start--> / <!--changelog-type-end--> markers and Patch checked).

@nilsandrey
nilsandrey merged commit 8584a6a into main Mar 8, 2026
1 check passed
@nilsandrey
nilsandrey deleted the copilot/fix-release-action-bump-version branch March 8, 2026 23:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants