Skip to content

chore(ci): 🤖 improve changelog parsing#947

Open
punkbit wants to merge 4 commits intomainfrom
chore/gh-release-changelog-output-parsing
Open

chore(ci): 🤖 improve changelog parsing#947
punkbit wants to merge 4 commits intomainfrom
chore/gh-release-changelog-output-parsing

Conversation

@punkbit
Copy link
Collaborator

@punkbit punkbit commented Mar 25, 2026

Why?

The changelog extraction logic was previously embedded directly in the release workflow. This made it difficult to test locally and debug issues without triggering the full CI pipeline, e.g. ops runtime requires going through the pull request review/feedback cycle that can be quite long making it hard to iterate/TIAS. Recently, noticed that changelog descriptionm wasn't properly included in the github release notes. Also, when changelog entries contained contributor mentions like @username, GitHub would tag the user, e.g. @deprecated which @<term> are now escaped.

How?

  • Extracts changelog parsing logic from the release workflow into a script
  • Adds @username mention escaping to prevent unintended GitHub notifications
  • Improves error handling with clear fallback messages when changelog content is unavailable

Preview?

⚠️ Tested in a separate playground environment due to pull request feedback/review loop which is too long for this type of work. While the playground environment tries to be as close as Click UI's repository, there might be differences and further iterations may be required to be addressed separately.

Expected flow

demo-gh-release-changelogs-output--enc.mp4

Expected output A

Screenshot 2026-03-25 at 11 23 43

Expected output B

Screenshot 2026-03-25 at 11 27 06

@changeset-bot
Copy link

changeset-bot bot commented Mar 25, 2026

⚠️ No Changeset found

Latest commit: 79bb73b

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@github-actions
Copy link

github-actions bot commented Mar 25, 2026

Claude finished @punkbit's task in 1m 2s —— View job


PR Review

Nice refactor overall — extracting the changelog logic into a standalone script makes it much easier to test locally. The @mention escaping is a great catch. One functional bug to address before merging.


🚨 Must Fix

  • extract-changelog + workflow: Error messages from the script are written to stdout and exit with code 1, but the workflow captures stdout via $() and ignores the exit code (line 167). This means when a version isn't found, CHANGELOG is set to "No changelog content found for version X.X.X" — a non-empty string — so the if [[ -n "$CHANGELOG" ]] check passes and that error string gets written to the release notes. The fallback block is never reached.

    Fix either by checking the exit code in the workflow:

    if CHANGELOG=$(.scripts/bash/extract-changelog "$VERSION" "$CHANGELOG_PATH"); then
      echo "$CHANGELOG" > "$CHANGELOG_OUTPUT_TEMP_PATH"
    else
      echo "No changelog available for version $VERSION." > "$CHANGELOG_OUTPUT_TEMP_PATH"
      echo "" >> "$CHANGELOG_OUTPUT_TEMP_PATH"
      echo "$FALLBACK_MSG" >> "$CHANGELOG_OUTPUT_TEMP_PATH"
    fi

    Or by redirecting error messages to stderr in the script (echo "..." >&2), so stdout remains clean.

    Fix this →


💡 Suggestions (non-blocking)

  • .scripts/bash/extract-changelog line 41–42: The grep -v '^## [0-9]' is dead code — the while loop already breaks on any ^## [0-9] line, so version headers can never be in $CHANGELOG at that point. Safe to remove.

@github-actions
Copy link

github-actions bot commented Mar 25, 2026

Claude finished @punkbit's task in 54s —— View job


PR Review

  • Read changed files
  • Analyze the implementation
  • Post review findings

Nice work! The refactor is clean and the @mention escaping is a smart catch. The previously flagged stdout/stderr bug has been addressed in commit df6900eb — all error paths in the script now correctly use >&2, so CHANGELOG is empty on failure and the workflow fallback kicks in as intended.

💡 Suggestion (non-blocking)

  • .scripts/bash/extract-changelog line 41–42: The grep -v '^## [0-9]' filter is dead code — the while loop already breaks on any ^## [0-9] line, so version headers can never appear in $CHANGELOG by the time this runs. Safe to remove.

    Fix this →


Otherwise looks good to merge! 🙌

@github-actions
Copy link

github-actions bot commented Mar 25, 2026

Claude finished @punkbit's task in 52s —— View job


PR Review

  • Read changed files
  • Analyze the implementation
  • Post review findings

All previously flagged issues have been resolved. The stderr fix from df6900eb is correct — error messages go to >&2, leaving stdout clean so CHANGELOG is empty on failure and the workflow fallback kicks in properly. The dead code (grep -v '^## [0-9]') was removed in 79bb73ba.

Looks great! No issues found — nice work! The refactor is clean, the @mention escaping regex is correct, and the error handling flows as intended. Ready to merge.

@workflow-authentication-public
Copy link
Contributor

📚 Storybook Preview Deployed

✅ Preview URL: https://click-m8oomfrk9-clickhouse.vercel.app

Built from commit: 53b92d7f02600a6131f7c27cad4052d3648fa6c7

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.

1 participant