-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Components: Improve output of CHANGELOG CI check #49779
Conversation
Flaky tests detected in 136f9a8bbdefd3c1dc7399ac6864b8ab05d6cd4e. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/4735904901
|
2604e62
to
87929dc
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I really like the additional checks! 😍 However, I am hesistant to commit this to the repo as is, because I'm afraid the maintenance cost will be too high (relative to the value added) whenever something breaks. To be fair, the script is really well documented, but it makes me uneasy especially since it isn't already decoupled to the point where we can test just the script part locally against a given markdown file.
What do you think about scaling back the complexity a bit, so we can recalibrate the cost–benefit here? For example, just using the raw file text instead of the git diff. And then simply matching the text between ^## Unreleased
and the next ^##
, and see if the PR number pattern appears in that chunk. Something like that?
As much as I love a complex I've pulled out all the extra bits and greatly simplified things. Thanks for pointing out the over-complexity! The script now:
The expected errors from the various testing steps posted above don't change 🙂 |
While updating this PR I noticed a small bug in the first check the script runs, which is when it checks to confirm the current branch contains changes to the CHANGELOG. When we initially set this up @ciampo pointed out it made sense to run the diff against the merge-base of the PR's branch, and not the most recent updates to I made that change, but noticed today that if the PR branch is behind trunk, the first check can fail if trunk has CHANGELOG updates. I did some digging and it looks like this is an issue with the Github context variable we're using. Rather than returning the base commit, it returns the head of the base branch. I found a few different reports of this, so it's not just us. A workaround exists but looks like it involves some semi-complex git gymnastics. The good news is that with the new checks we're adding, the workflow still functions. The second check (which looks for the current PR's link in the CHANGELOG) will still get triggered. So basically, if the PR is behind trunk, there's a chance the error text will be slightly less specific, but the check will still do its job. TL;DR: for PRs that need a rebase, the author might not get exactly the right error, but it will still prompt them to add an entry. |
use dynamic PR number from Github context reorder conditionals fix wrong-section logic
b6a62cc
to
6059461
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested in #49924 ✅
The simplified script looks a lot better! It is much more approachable for any future maintainer 😄
What?
This PR introduces several changes to make the new Components package CI check's output more helpful (hat tip to @ciampo for the suggestions that inspired most of this)
Why?
It isn't immediately clear that this new check isn't a required check, and it shouldn't block a merge once the PR is approved.
In addition, the initial implementation only checked that the CHANGELOG had been modified by the PR in question. There were no checks in place to ensure it had been updated correctly.
How?
First, in the PR overview, the check's name now begins with the word
OPTIONAL
so it's more clear it won't block a merge. Second, if it does fail, the error output in thedetails
section will explicitly state that the PR can be merged if the change is too small to warrant an entry.Then, in addition to checking changes to the CHANGELOG, the script performs a few checks and outputs a relevant error if any of them don't pass:
Unreleased
section is present (it always should be, but better safe than sorry)Unreleased
section, which is helpful if a release happened while the PR was being reviewed.Testing Instructions
No entry
Wrong PR number, in the right section
Unreleased
section, with the wrong PR number in the link.Wrong PR number, in the wrong section
Unreleased
section. Leave the wrong PR number in place.Right PR number, in the wrong section
Unreleased
section.Right PR number, in the right section
Unreleased
section.