-
Notifications
You must be signed in to change notification settings - Fork 69
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
Update post-release-updates GitHub Actions workflow to delete all trailing newlines from Release-testing-instructions.md before adding new entries. #8719
Conversation
…iling newlines from Release-testing-instructions.md before adding new entries.
Test the buildOption 1. Jetpack Beta
Option 2. Jurassic Ninja - available for logged-in A12s🚀 Launch a JN site with this branch 🚀 ℹ️ Install this Tampermonkey script to get more options. Build info:
Note: the build is updated when a new commit is pushed to this PR. |
Size Change: 0 B Total Size: 1.25 MB ℹ️ View Unchanged
|
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.
Looks good. Tested the added command on an example file and it worked.
One nitpick below. Once addressed, feel free to
Pre-approving
@@ -155,8 +155,10 @@ jobs: | |||
echo ":warning: File "$NEXT_RELEASE_VERSION_INSTRUCTIONS_FILENAME.md" already exists. No action needed." >> $GITHUB_STEP_SUMMARY | |||
fi | |||
|
|||
# If an entry for the next version doesn't exist yet | |||
# Check if this release version exists in Release-testing-instructions.md | |||
# If not, remove all trailing newlines and add the new version for this release |
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.
Nitpick: let's move this comment closer to the perl command below.
Fixes #6816
Context of the issue
The Release Testing Instructions are automatically updated after every release thanks to the Handle post-release steps GitHub Actions workflow.
If we look at the document history, we can see some versions where the bullet list format looks wrong. Examples:
This happened when there was a line break between the list and the new item added:
[line break]
The initial thought was that the script that adds a new entry with the new release version to Release Testing Instructions had a bug that added a double line break somewhere, but after a deeper investigation, it seems the script works well - it doesn't add any double line break - but the line break was added as part of manual updates on the page.
If we take a closer look at the page history, we can see 2 different kinds of titles:
The format issue appeared inconsistently, but we can spot a pattern there: It appeared once the process was automated and only on the upcoming of certain manual updates. We can see a manual update in ba27137 and then the wrong format in the following automated update in 389d121. Therefore, we can confirm that this format issue appeared when a manual updated added a line break and then the script continue adding entries to the document. We can see this pattern repeated multiple times, and you can check that the line breaks are indeed in the document if you clone the wiki locally and check the history.
Changes proposed in this Pull Request
Even though the script is fine and the problem is caused by manual updates, there is a way to make the script more robust and avoid this problem from happening again.
This PR updates the
post-release-updates.yml
workflow to make sure theupdate-wiki
job trims any trailing line breaks at the bottom of theRelease-testing-instructions
document before adding an entry for the new release.Testing instructions
In order to improve the testability of this PR - as GitHub Actions can be tricky to test - I've created a Dockerfile that you can use locally to simulate the behaviour of these changes running on GitHub Actions. In order to be as similar as possible to the GitHub Actions set up, this Dockerfile runs on
ubuntu:latest
and usesbash
.Release-testing-instructions.md
.Dockerfile
and place it in the same path as the markdown above.docker build -t update-md .
.docker run --rm -v "$(pwd)":/app update-md
.Updated-Release-testing-instructions.md
.Release-testing-instructions.md
andUpdated-Release-testing-instructions.md
. Check thatUpdated-Release-testing-instructions.md
no longer has the trailing line breaks fromRelease-testing-instructions.md
at the bottom of the file and instead it has a new release entry:* [v9.9.9](https://github.com/Automattic/woocommerce-payments/wiki/Release-testing-instructions-for-WC-Payments-9.9.9)
npm run changelog
to add a changelog file, choosepatch
to leave it empty if the change is not significant. You can add multiple changelog files in one PR by running this command a few times.Post merge