-
Notifications
You must be signed in to change notification settings - Fork 10.8k
Improve the release-compile-changelog.yml
workflow
#59786
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
Conversation
Testing GuidelinesHi @kalessil @woocommerce/flux, Apart from reviewing the code changes, please make sure to review the testing instructions (Guide) and verify that relevant tests (E2E, Unit, Integration, etc.) have been added or updated as needed. Reminder: PR reviewers are required to document testing performed. This includes:
|
📝 WalkthroughWalkthroughThe GitHub Actions workflow for release compilation and changelog generation was updated to require an explicit version input, enforce stricter validation for version and release date formats, and verify the existence of the corresponding release branch before proceeding. Workflow steps were streamlined to use these validated inputs directly. Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant GitHub Actions Workflow
participant Remote Repo
User->>GitHub Actions Workflow: Trigger workflow with version and optional release_date
GitHub Actions Workflow->>GitHub Actions Workflow: Validate version format (X.Y or X.Y.Z)
GitHub Actions Workflow->>GitHub Actions Workflow: Validate release_date (if provided, YYYY-MM-DD)
GitHub Actions Workflow->>Remote Repo: Check if release/{version} branch exists
alt Branch exists
GitHub Actions Workflow->>GitHub Actions Workflow: Use release/{version}
else Branch does not exist
GitHub Actions Workflow->>Remote Repo: Check if release/{minor_version} branch exists
alt Minor branch exists
GitHub Actions Workflow->>GitHub Actions Workflow: Use release/{minor_version}
else Neither branch exists
GitHub Actions Workflow->>User: Fail workflow with error
end
end
GitHub Actions Workflow->>GitHub Actions Workflow: Generate changelog with validated inputs
Estimated code review effort1 (<30 minutes) Possibly related PRs
📜 Recent review detailsConfiguration used: .coderabbit.yml 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
Documentation and Community
|
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.
Actionable comments posted: 1
🧹 Nitpick comments (4)
.github/workflows/release-compile-changelog.yml (4)
6-8
:default: ''
is redundant (and potentially confusing) whenrequired: true
.Because the input is now mandatory, the empty‐string default can never be used. Dropping it makes the intent clearer and avoids questions about whether an empty value is still allowed.
- required: true - default: '' + required: true
33-56
: Minor: eliminate the extraprocess.exit(1)
calls aftercore.setFailed
.
core.setFailed()
already marks the step as failed and terminates execution; the explicitprocess.exit(1)
is unnecessary noise.- core.setFailed('Invalid version format. The version must be in the format X.Y or X.Y.Z'); - process.exit(1); + core.setFailed('Invalid version format. The version must be in the format X.Y or X.Y.Z');
57-83
: Consistent pattern: passrelease_date
viaenv
instead of inlining into the script.Embedding the expression
${{ github.event.inputs.release_date }}
directly into the script string risks YAML-quoting issues if the date ever contains unusual characters. Follow the same pattern as the version-validation step for consistency and robustness.- with: - script: | - const releaseDate = '${{ github.event.inputs.release_date }}'; + env: + RELEASE_DATE: ${{ github.event.inputs.release_date }} + with: + script: | + const releaseDate = process.env.RELEASE_DATE;
89-116
: Consider short-circuiting the remote look-ups to reduce latency.For large repos with many branches, two separate
git ls-remote
calls introduce ~2× network latency. You can fetch all heads once and test locally:refs=$(git ls-remote --heads origin) if echo "$refs" | grep -qE "refs/heads/${VERSION_BRANCH}$"; then ... elif echo "$refs" | grep -qE "refs/heads/${MINOR_BRANCH}$"; then ... fiNot critical, but it will shave a second or two off every run.
📜 Review details
Configuration used: .coderabbit.yml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
.github/workflows/release-compile-changelog.yml
(5 hunks)
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: CR
PR: woocommerce/woocommerce#0
File: .cursor/rules/generate-pr-description.mdc:0-0
Timestamp: 2025-06-30T09:26:55.361Z
Learning: Provide clear, step-by-step instructions for how to test the changes in the PR description.
Learnt from: prettyboymp
PR: woocommerce/woocommerce#59048
File: .github/workflows/cherry-pick-milestoned-prs.yml:118-131
Timestamp: 2025-07-11T13:05:08.440Z
Learning: In GitHub Actions workflows, when reviewing steps that access event data like `github.event.pull_request.milestone`, check the entire job dependency chain and conditional logic. If upstream jobs already validate the data exists (like checking `github.event.pull_request.milestone != null` in a prerequisite job), then downstream jobs don't need redundant null-checks since the data is guaranteed to exist by that point.
Learnt from: jorgeatorres
PR: woocommerce/woocommerce#59675
File: .github/workflows/release-bump-as-requirement.yml:48-65
Timestamp: 2025-07-15T15:39:21.856Z
Learning: In WooCommerce core repository, changelog entries for all PRs live in `plugins/woocommerce/changelog/` directory and are processed during releases, not at the repository root level.
Learnt from: CR
PR: woocommerce/woocommerce#0
File: .cursor/rules/generate-pr-description.mdc:0-0
Timestamp: 2025-06-30T09:26:55.361Z
Learning: Applies to .github/PULL_REQUEST_TEMPLATE.md : Do not remove or alter required markdown sections in the PR description, especially those used by automation (e.g., changelog entry details and comments).
Learnt from: CR
PR: woocommerce/woocommerce#0
File: .cursor/rules/generate-pr-description.mdc:0-0
Timestamp: 2025-06-30T09:26:55.361Z
Learning: Applies to .github/PULL_REQUEST_TEMPLATE.md : The changelog section in the PR description must keep the markdown structure from the PR template exactly as-is, including all checkboxes, comments, and headings. Only the appropriate checkbox may be checked, and the changelog message must be placed under the `#### Comment` heading and before the closing `</details>` tag. Do not add, remove, or reformat any part of the changelog section except for checking the box and adding the message in the correct place.
Learnt from: lysyjan
PR: woocommerce/woocommerce#59632
File: packages/js/email-editor/src/layouts/flex-email.tsx:116-122
Timestamp: 2025-07-14T10:41:46.200Z
Learning: In WooCommerce projects, formatting suggestions should respect the project's Prettier configuration and linting rules. Changes that would break the lint job should be avoided, even if they appear to improve readability.
Learnt from: jorgeatorres
PR: woocommerce/woocommerce#59675
File: .github/workflows/release-bump-as-requirement.yml:57-57
Timestamp: 2025-07-15T15:39:02.479Z
Learning: GitHub Actions ubuntu-latest runner image includes Composer by default as part of the preinstalled software, so no additional installation step is needed when using Composer commands in workflows.
Learnt from: jorgeatorres
PR: woocommerce/woocommerce#59675
File: .github/workflows/release-bump-as-requirement.yml:57-57
Timestamp: 2025-07-15T15:39:02.479Z
Learning: GitHub Actions ubuntu-latest runner image includes Composer by default as part of the PHP tools, so no additional installation step is needed when using Composer commands in workflows.
.github/workflows/release-compile-changelog.yml (4)
Learnt from: prettyboymp
PR: woocommerce/woocommerce#59048
File: .github/workflows/cherry-pick-milestoned-prs.yml:118-131
Timestamp: 2025-07-11T13:05:08.440Z
Learning: In GitHub Actions workflows, when reviewing steps that access event data like `github.event.pull_request.milestone`, check the entire job dependency chain and conditional logic. If upstream jobs already validate the data exists (like checking `github.event.pull_request.milestone != null` in a prerequisite job), then downstream jobs don't need redundant null-checks since the data is guaranteed to exist by that point.
Learnt from: CR
PR: woocommerce/woocommerce#0
File: .cursor/rules/generate-pr-description.mdc:0-0
Timestamp: 2025-06-30T09:26:55.361Z
Learning: Applies to .github/PULL_REQUEST_TEMPLATE.md : Do not remove or alter required markdown sections in the PR description, especially those used by automation (e.g., changelog entry details and comments).
Learnt from: CR
PR: woocommerce/woocommerce#0
File: .cursor/rules/generate-pr-description.mdc:0-0
Timestamp: 2025-06-30T09:26:55.361Z
Learning: Applies to .github/PULL_REQUEST_TEMPLATE.md : The changelog section in the PR description must keep the markdown structure from the PR template exactly as-is, including all checkboxes, comments, and headings. Only the appropriate checkbox may be checked, and the changelog message must be placed under the `#### Comment` heading and before the closing `</details>` tag. Do not add, remove, or reformat any part of the changelog section except for checking the box and adding the message in the correct place.
Learnt from: CR
PR: woocommerce/woocommerce#0
File: .cursor/rules/git.mdc:0-0
Timestamp: 2025-06-30T09:27:06.883Z
Learning: Branch names should follow the structure: 'release/{version}' for release branches.
🪛 actionlint (1.7.7)
.github/workflows/release-compile-changelog.yml
85-85: the runner of "actions/checkout@v3" action is too old to run on GitHub Actions. update the action's version to fix this issue
(action)
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.
Changes look good and worked as expected.
Submission Review Guidelines:
Changes proposed in this Pull Request:
release/X.Y.Z
) to minor version branches (release/X.Y
).Closes #59629
How to test the changes in this Pull Request:
Using the WooCommerce Testing Instructions Guide, include your detailed testing instructions:
woocommerce/woocommerce
repo with all branches into your GH account.59629/improve-compile-changelog
and merge it (to get this new workflow intotrunk
).Actions
,Release: Compile changelog
, click onRun workflow
, and test the following test cases:Test 1: Invalid date
Write a random string in the date input and make sure the workflow fails with the error:
Invalid release date format. The release date must be in the format YYYY-MM-DD
.Test 2: Invalid version
Write a random string in the version input and make sure the workflow fails with the error:
Invalid version format. The version must be in the format X.Y or X.Y.Z
.Test 3: No branch patch or minor branch exists
release/12.1.1
andrelease/12.1
don't exist on your fork.12.1.1
.Neither branch 'release/12.1.1' nor 'release/12.1' exists.
Test 4: No branch patch exists
release/12.1.1
doesn't exist, but therelease/12.1
does exist on your fork.12.1.1
Check the necessary branch exists
step printsUsing branch: release/12.1
.Test 5: Minor version
release/12.1
exists on your fork.12.1
Check the necessary branch exists
step printsUsing branch: release/12.1
.Testing that has already taken place:
All listed tests have been tested in my fork https://github.com/albarin/woocommerce/actions/workflows/release-compile-changelog.yml
Changelog entry
Changelog Entry Details
Significance
Type
Message
Changelog Entry Comment
Comment