Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CI: Improve backport-changelog PR regex #68049

Open
wants to merge 3 commits into
base: trunk
Choose a base branch
from

Conversation

sirreal
Copy link
Member

@sirreal sirreal commented Dec 17, 2024

What?

The backport-changelog CI script searches for matching markdown files in the backport-changelog directory.

This relies on a regular expression matching some specific markdown syntax, specifically a list item with a given text. There are different ways of writing the same list that are identically in rendered markdown, this PR changes the regex to be more resilient to possible differences in the specific markdown used to obtain the same file result.

Markdown lists are interesting.

Part of #66235, where markdown autoformatting is applied.

Done

  • Allow one or more spaces after the list item mark (- and - are both allowed).
  • Anchor the regex to the end of the string. This prevents non-matching PR numbers from match (e.g. PR 6300 would match when searching for 63002).

Not done

  • It could also be anchored to the start of the string, but that may not be strictly correct (some number of spaces are allowed before the list item mark) so I avoided it here.
  • + is also a valid list item mark according to commonmark, but my experience is that it's an unusual choice in practice and I did not add it here. It was not necessary for Autoformat markdown files #66235.

Why?

Autoformatting in #66235 changes these markdown files in a consistent way that should have no semantic impact. Update our tooling appropriately.

How?

By adjusting the regex.

Testing Instructions

Try the different regexes on this PR, they should behave the same. If you try them on #66235, this regex should work while the previous one would not.

## Original regex !!! This would fail on #66235
grep -Erl "[-*] https://github.com/WordPress/gutenberg/pull/66302" backport-changelog
# backport-changelog/6.8/7604.md

## Updated regex
grep -Erl "[-*] +https://github.com/WordPress/gutenberg/pull/66302$" backport-changelog
# backport-changelog/6.8/7604.md

Ensure that valid markdown lists are correctly recognized
@sirreal sirreal added the [Type] Build Tooling Issues or PRs related to build tooling label Dec 17, 2024
sirreal added a commit that referenced this pull request Dec 17, 2024
@sirreal sirreal marked this pull request as ready for review December 17, 2024 12:46
@sirreal sirreal requested a review from desrosj as a code owner December 17, 2024 12:46
Copy link

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: sirreal <jonsurrell@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

Copy link

Flaky tests detected in a200fb1.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/12373247907
📝 Reported issues:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Type] Build Tooling Issues or PRs related to build tooling
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant