Skip to content

Improve validation in Release: Build ZIP file workflow #60262

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

Merged
merged 4 commits into from
Aug 8, 2025
Merged

Conversation

jorgeatorres
Copy link
Member

@jorgeatorres jorgeatorres commented Aug 7, 2025

Submission Review Guidelines:

Changes proposed in this Pull Request:

This PR simplifies and enhances pre-build validation in the Release: Build ZIP file. In particular:

  • Removes unnecessary Slack notification when ZIP can't be built due to GH actions generated PRs still being open. This step is instead moved to other pre-build validations.
  • Makes the release branch a required input so that the workflow isn't accidentally run from trunk or a release branch.
  • Enhances pre-build validation by ensuring that no PRs against the release branch or with the same milestone as the release are open.
  • Ensures validation is not optional when creating a GitHub release at the same time, as this is the process used when releasing to wporg.

Closes #60087.

How to test the changes in this Pull Request:

  1. Fork this repository, ensuring both release/10.1 and release/10.0 is included.

  2. Prepare your fork for testing by:

    1. Ensuring label Release exists in Issues > Labels or creating it as necessary.
    2. Ensuring milestone 10.1.0 exists in Issues > Milestones or creating it as necessary.
    3. Creating a draft release with tag 10.1.0-rc.2 in Code > Releases, with any target commit/branch. There's no need to upload a ZIP.
  3. Run Actions > Release: Build ZIP file and confirm that it fails with any of the following input combos:

    • Release branch: release/10.0, ☐ Skip verification steps, ☐ Create GitHub release.
      Fails because 10.0.4 is already tagged on wporg.
    • Release branch: release/10.1, ☐ Skip verification steps, ☐ Create GitHub release.
      Fails because 10.1.0-rc.2 is already tagged on GitHub.
    • Release branch: release/10.1, ☒ Skip verification steps, ☒ Create GitHub release.
      Fails because verification steps can't be skipped when creating a release.
  4. Use Actions > Release: Bump version number with release branch release/10.1 and bump type rc to generate a PR bumping versions in release/10.1 to 10.1.0-rc.3. Merge the resulting PR.

  5. Use the GH UI to create a PR with any change against branch release/10.1. Do not merge this PR.

  6. Run Actions > Release: Build ZIP file with release branch release/10.1 and confirm that it fails. It should complain about open PRs against release/10.1.

  7. Change the PR created in step 5 to have base branch trunk instead but apply the 10.1.0 milestone to it.

  8. Run Actions > Release: Build ZIP file with release branch release/10.1 and confirm that it fails. This time, it should complain about open PRs with milestone 10.1.0.

  9. Close the PR you opened in step 5.

  10. Run Actions > Release: Build ZIP file with release branch release/10.1 and ☒ Create GitHub release checked. Confirm that it succeeds and creates a draft release 10.1.0-rc.3 after it's done.

@github-actions github-actions bot added Documentation Issues and PRs related to improving documentation focus: monorepo infrastructure Issues and PRs related to monorepo tooling. labels Aug 7, 2025
@jorgeatorres jorgeatorres marked this pull request as ready for review August 7, 2025 17:55
@jorgeatorres jorgeatorres requested review from a team as code owners August 7, 2025 17:55
@jorgeatorres jorgeatorres requested review from albarin and removed request for a team August 7, 2025 17:55
@woocommercebot woocommercebot requested a review from a team August 7, 2025 17:55
Copy link
Contributor

github-actions bot commented Aug 7, 2025

Testing Guidelines

Hi @albarin @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:

  • 🖼️ Screenshots or screen recordings.
  • 📝 List of functionality tested / steps followed.
  • 🌐 Site details (environment attributes such as hosting type, plugins, theme, store size, store age, and relevant settings).
  • 🔍 Any analysis performed, such as assessing potential impacts on environment attributes and other plugins, conducting performance profiling, or using LLM/AI-based analysis.

⚠️ Within the testing details you provide, please ensure that no sensitive information (such as API keys, passwords, user data, etc.) is included in this public issue.

Copy link
Contributor

coderabbitai bot commented Aug 7, 2025

📝 Walkthrough

Walkthrough

The release workflow for building ZIP files was refactored: verification jobs were consolidated into a single job with simplified shell-based checks, stricter branch requirements, and additional validations. Documentation was updated to reflect the new process, and the release code freeze workflow was slightly modified to stop clearing release notes during editing.

Changes

Cohort / File(s) Change Summary
Release Build Workflow Refactor
.github/workflows/release-build-zip-file.yml
Consolidated verification jobs into one (verify), replaced JavaScript checks with shell scripts using gh, enforced running from trunk, added checks for open PRs and existing releases, updated job dependencies, and revised release creation notes. Input parameters branch and create_github_release were updated to be required and optional with default respectively.
Release Code Freeze Workflow
.github/workflows/release-code-freeze.yml
Removed explicit clearing of release notes (--notes='') during the release edit step in the publish-dev-release job.
Release Documentation Update
docs/contribution/releases/building-and-publishing.md
Updated instructions to match new workflow: run from trunk, specify release branch as input, and clarified release creation option.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant GitHub Actions
    participant GH CLI
    participant GitHub API

    User->>GitHub Actions: Trigger "Release: Build ZIP file" workflow (from trunk)
    GitHub Actions->>GH CLI: Run verification shell scripts
    GH CLI->>GitHub API: Check for open PRs by bot, against release branch, with milestone
    GH CLI->>GitHub API: Check if release already exists
    GitHub Actions-->>User: Fail workflow if any check fails
    GitHub Actions->>GitHub Actions: Build ZIP file (if verification passes)
    GitHub Actions->>GitHub API: Create GitHub release with version as notes
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~15–25 minutes

Possibly related PRs

Note

🔌 MCP (Model Context Protocol) integration is now available in Early Access!

Pro users can now connect to remote MCP servers under the Integrations page to get reviews and chat conversations that understand additional development context.

✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/60087

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.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🧹 Nitpick comments (1)
docs/contribution/releases/building-and-publishing.md (1)

33-35: Explicitly call out that verification must not be skipped

The workflow now blocks a run when create_github_release = true and skip_verify = true, but the docs omit this. Please add a bullet (e.g. “Leave ‘Skip verification steps’ unchecked”) so operators don’t hit a confusing, preventable failure.

📜 Review details

Configuration used: .coderabbit.yml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 8455e49 and 8f2bd03.

📒 Files selected for processing (3)
  • .github/workflows/release-build-zip-file.yml (7 hunks)
  • .github/workflows/release-code-freeze.yml (0 hunks)
  • docs/contribution/releases/building-and-publishing.md (1 hunks)
💤 Files with no reviewable changes (1)
  • .github/workflows/release-code-freeze.yml
🧰 Additional context used
🧠 Learnings (8)
📓 Common learnings
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-07-21T05:22:46.426Z
Learning: Provide clear, step-by-step instructions for how to test the changes in the PR description.
Learnt from: jorgeatorres
PR: woocommerce/woocommerce#60250
File: .github/workflows/release-compile-changelog.yml:165-166
Timestamp: 2025-08-07T10:34:27.702Z
Learning: In WooCommerce release workflows, the VERSION variable used in changelog generation comes from the `validate-selected-branch-version` step, which extracts the version from `plugins/woocommerce/woocommerce.php` using `grep -oP '(?<=Version: )(.+)'` and validates it matches the input version. This ensures the version is always in the correct format by the time it reaches the changelog generation step, making additional error handling for version format validation unnecessary.
Learnt from: CR
PR: woocommerce/woocommerce#0
File: .cursor/rules/generate-pr-description.mdc:0-0
Timestamp: 2025-07-21T05:22:46.426Z
Learning: Applies to .github/PULL_REQUEST_TEMPLATE.md : Preserve required markdown sections in the PR description, especially those used by automation (e.g., changelog entry details and comments). Do not remove or alter them.
Learnt from: CR
PR: woocommerce/woocommerce#0
File: .cursor/rules/git.mdc:0-0
Timestamp: 2025-07-18T14:54:55.592Z
Learning: Branch names should follow the structure: 'release/{version}' for release branches.
📚 Learning: 2025-08-07T10:34:27.702Z
Learnt from: jorgeatorres
PR: woocommerce/woocommerce#60250
File: .github/workflows/release-compile-changelog.yml:165-166
Timestamp: 2025-08-07T10:34:27.702Z
Learning: In WooCommerce release workflows, the VERSION variable used in changelog generation comes from the `validate-selected-branch-version` step, which extracts the version from `plugins/woocommerce/woocommerce.php` using `grep -oP '(?<=Version: )(.+)'` and validates it matches the input version. This ensures the version is always in the correct format by the time it reaches the changelog generation step, making additional error handling for version format validation unnecessary.

Applied to files:

  • docs/contribution/releases/building-and-publishing.md
  • .github/workflows/release-build-zip-file.yml
📚 Learning: 2025-07-23T19:42:10.564Z
Learnt from: jorgeatorres
PR: woocommerce/woocommerce#59946
File: .github/workflows/release-code-freeze.yml:108-124
Timestamp: 2025-07-23T19:42:10.564Z
Learning: WooCommerce trunk versions follow the pattern `X.Y.0-dev` where the patch version is always `0`. This means when calculating release branches, string operations like `slice(0, -2)` on the version after removing `-dev` will always work correctly since the input format is predictable (e.g., `10.2.0` → `10.2`).

Applied to files:

  • docs/contribution/releases/building-and-publishing.md
📚 Learning: 2025-07-15T15:39:21.856Z
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.

Applied to files:

  • docs/contribution/releases/building-and-publishing.md
📚 Learning: 2025-06-26T12:45:40.709Z
Learnt from: prettyboymp
PR: woocommerce/woocommerce#59048
File: .github/workflows/cherry-pick-milestoned-prs.yml:60-83
Timestamp: 2025-06-26T12:45:40.709Z
Learning: WooCommerce uses WordPress versioning conventions where minor versions in X.Y.Z format are constrained to 0-9 (Y cannot exceed 9). This means version increment logic should reset minor to 0 and increment major when minor reaches 9, rather than allowing two-digit minor versions like 9.10 or 9.11.

Applied to files:

  • docs/contribution/releases/building-and-publishing.md
📚 Learning: 2025-07-11T13:05:08.440Z
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.

Applied to files:

  • .github/workflows/release-build-zip-file.yml
📚 Learning: 2025-07-21T05:22:46.426Z
Learnt from: CR
PR: woocommerce/woocommerce#0
File: .cursor/rules/generate-pr-description.mdc:0-0
Timestamp: 2025-07-21T05:22:46.426Z
Learning: Applies to .github/PULL_REQUEST_TEMPLATE.md : Preserve required markdown sections in the PR description, especially those used by automation (e.g., changelog entry details and comments). Do not remove or alter them.

Applied to files:

  • .github/workflows/release-build-zip-file.yml
📚 Learning: 2025-07-18T14:54:55.592Z
Learnt from: CR
PR: woocommerce/woocommerce#0
File: .cursor/rules/git.mdc:0-0
Timestamp: 2025-07-18T14:54:55.592Z
Learning: Branch names should follow the structure: 'release/{version}' for release branches.

Applied to files:

  • .github/workflows/release-build-zip-file.yml
🪛 actionlint (1.7.7)
.github/workflows/release-build-zip-file.yml

23-23: input "branch" of workflow_call event has the default value "", but it is also required. if an input is marked as required, its default value will never be used

(events)

@jorgeatorres jorgeatorres removed the request for review from a team August 8, 2025 07:36
Copy link
Contributor

@coderabbitai coderabbitai bot left a 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

♻️ Duplicate comments (2)
.github/workflows/release-build-zip-file.yml (2)

23-25: skip_verify input still inconsistent across triggers

workflow_call now has a sensible default: false, but the workflow_dispatch section (Lines 8-11) still marks the same input required: true with no default. Align both blocks to avoid confusing users who trigger the workflow from the UI.


125-130: Search still uses full ref – verification can silently pass

$BRANCH contains refs/heads/...; the base: qualifier expects just the branch name, so open PRs against the release branch won’t be detected. Re-use branch_name extracted above.

📜 Review details

Configuration used: .coderabbit.yml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 8f2bd03 and 3835439.

📒 Files selected for processing (1)
  • .github/workflows/release-build-zip-file.yml (7 hunks)
🧰 Additional context used
🧠 Learnings (5)
📓 Common learnings
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-07-21T05:22:46.426Z
Learning: Provide clear, step-by-step instructions for how to test the changes in the PR description.
Learnt from: jorgeatorres
PR: woocommerce/woocommerce#60250
File: .github/workflows/release-compile-changelog.yml:165-166
Timestamp: 2025-08-07T10:34:27.702Z
Learning: In WooCommerce release workflows, the VERSION variable used in changelog generation comes from the `validate-selected-branch-version` step, which extracts the version from `plugins/woocommerce/woocommerce.php` using `grep -oP '(?<=Version: )(.+)'` and validates it matches the input version. This ensures the version is always in the correct format by the time it reaches the changelog generation step, making additional error handling for version format validation unnecessary.
Learnt from: CR
PR: woocommerce/woocommerce#0
File: .cursor/rules/generate-pr-description.mdc:0-0
Timestamp: 2025-07-21T05:22:46.426Z
Learning: Applies to .github/PULL_REQUEST_TEMPLATE.md : Preserve required markdown sections in the PR description, especially those used by automation (e.g., changelog entry details and comments). Do not remove or alter them.
Learnt from: CR
PR: woocommerce/woocommerce#0
File: .cursor/rules/git.mdc:0-0
Timestamp: 2025-07-18T14:54:55.592Z
Learning: Branch names should follow the structure: 'release/{version}' for release branches.
📚 Learning: 2025-07-11T13:05:08.440Z
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.

Applied to files:

  • .github/workflows/release-build-zip-file.yml
📚 Learning: 2025-08-07T10:34:27.702Z
Learnt from: jorgeatorres
PR: woocommerce/woocommerce#60250
File: .github/workflows/release-compile-changelog.yml:165-166
Timestamp: 2025-08-07T10:34:27.702Z
Learning: In WooCommerce release workflows, the VERSION variable used in changelog generation comes from the `validate-selected-branch-version` step, which extracts the version from `plugins/woocommerce/woocommerce.php` using `grep -oP '(?<=Version: )(.+)'` and validates it matches the input version. This ensures the version is always in the correct format by the time it reaches the changelog generation step, making additional error handling for version format validation unnecessary.

Applied to files:

  • .github/workflows/release-build-zip-file.yml
📚 Learning: 2025-07-21T05:22:46.426Z
Learnt from: CR
PR: woocommerce/woocommerce#0
File: .cursor/rules/generate-pr-description.mdc:0-0
Timestamp: 2025-07-21T05:22:46.426Z
Learning: Applies to .github/PULL_REQUEST_TEMPLATE.md : Preserve required markdown sections in the PR description, especially those used by automation (e.g., changelog entry details and comments). Do not remove or alter them.

Applied to files:

  • .github/workflows/release-build-zip-file.yml
📚 Learning: 2025-07-18T14:54:55.592Z
Learnt from: CR
PR: woocommerce/woocommerce#0
File: .cursor/rules/git.mdc:0-0
Timestamp: 2025-07-18T14:54:55.592Z
Learning: Branch names should follow the structure: 'release/{version}' for release branches.

Applied to files:

  • .github/workflows/release-build-zip-file.yml
🔇 Additional comments (1)
.github/workflows/release-build-zip-file.yml (1)

6-7: Good fix – removed misleading empty default for branch.
Eliminates the action-lint warning and clarifies that the input is mandatory.

Also applies to: 19-21

Copy link
Contributor

@albarin albarin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great!
✅ Tested all described scenarios in my fork and confirmed they all worked as described.

@jorgeatorres jorgeatorres merged commit 4346747 into trunk Aug 8, 2025
12 checks passed
@jorgeatorres jorgeatorres deleted the fix/60087 branch August 8, 2025 09:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Documentation Issues and PRs related to improving documentation focus: monorepo infrastructure Issues and PRs related to monorepo tooling.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Release: building zip should verify open milestone PRs
2 participants