Skip to content

Move release related jobs to release-new-release-published.yml #59722

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 7 commits into from
Jul 18, 2025

Conversation

albarin
Copy link
Contributor

@albarin albarin commented Jul 17, 2025

Submission Review Guidelines:

Changes proposed in this Pull Request:

Problem

Previously, workflows triggered by release events (like published or prereleased) would run using the workflow code from the tagged commit. This meant that if a release branch was created weeks ago, any improvements made to the workflow files since then would not be applied during the release process.

Solution

This can be fixed by having a "proxy" workflow that runs on the prereleased and published events and calls a dispatchable workflow pinned at trunk. This PR implements this with two workflows:

  • Proxy Workflow (release-release-events-proxy.yml) - Triggers on both release events and dispatches to the main workflow in trunk.
  • Main Workflow (release-new-release-published.yml) - Contains the actual logic and always runs from trunk. This workflow contains the logic to distinguish between published and prereleased events and calls the corresponding flows depending on the trigger.

Part of #59533

How to test the changes in this Pull Request:

Using the WooCommerce Testing Instructions Guide, include your detailed testing instructions:
Preparation

  1. Fork the woocommerce/woocommerce repo with all branches into your GH account.
  2. In your forked repo, go to Settings > Secrets and variables > Actions and create 3 new repository secrets:
  • CODE_FREEZE_BOT_TOKEN, get the token value from the Test Assistant bot from the secret store.
  • WOO_RELEASE_SLACK_CHANNEL: You can use the test channel test-woo-core-release-notifications.
  • WOO_RELEASE_SLACK_NOTIFICATION_CHANNEL: You can use the test channel test-woo-core-release-notifications.
  1. In the forked repo, create a PR with the branch 59533/proxy-new-release and merge it (to get this new workflow into trunk).
  2. 🚨Important: In your fork, replace woocommerce/woocommerce with your fork name: YOUR_REPO/woocommerce in:

Test 1: Publishing a pre-release

  1. Go to Releases, click on Draft a new release, create a new release with a correct version pre-release format tag (like 9.9-rc.1 and branch release/9.9), and save it as pre-release.
  2. Make sure this triggers the Release: Release events proxy workflow and calls the release-commits-and-contributors.yml 👇 and Notify in Slack when a new release is published and Update changelog.txt after any stable release are skipped.
Screenshot 2025-07-17 at 13 49 39

Test 2: Publishing a release

  1. Go to Releases, click on Draft a new release, create a new release with a correct version format tag (like 9.9 and branch release/9.9), and save it as a final release.
  2. Make sure this triggers the Release: Release events proxy workflow and Notify in Slack when a new release is published, and Update changelog.txt after any stable release are triggered. release-commits-and-contributors.yml should be skipped.
Screenshot 2025-07-17 at 14 04 29

Testing that has already taken place:

Changelog entry

  • Automatically create a changelog entry from the details below.
  • This Pull Request does not require a changelog entry. (Comment required below)
Changelog Entry Details

Significance

  • Patch
  • Minor
  • Major

Type

  • Fix - Fixes an existing bug
  • Add - Adds functionality
  • Update - Update existing functionality
  • Dev - Development related task
  • Tweak - A minor adjustment to the codebase
  • Performance - Address performance issues
  • Enhancement - Improvement to existing functionality

Message

Changelog Entry Comment

Comment

@github-actions github-actions bot added the focus: monorepo infrastructure Issues and PRs related to monorepo tooling. label Jul 17, 2025
@albarin albarin force-pushed the 59533/proxy-new-release branch from 559d775 to c38bbeb Compare July 17, 2025 08:36
@albarin albarin requested a review from jorgeatorres July 17, 2025 12:09
@albarin albarin marked this pull request as ready for review July 17, 2025 12:09
@albarin albarin requested a review from a team as a code owner July 17, 2025 12:09
Copy link
Contributor

Testing Guidelines

Hi @jorgeatorres @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 Jul 17, 2025

📝 Walkthrough

Walkthrough

The release workflow was refactored to be reusable via workflow_call with an explicit release_tag_name input. Handling for both published and prereleased events was added, with jobs and parameters updated to use the new input. The proxy workflow was updated to trigger the refactored workflow for both event types.

Changes

File(s) Change Summary
.github/workflows/release-new-release-published.yml Refactored to use workflow_call trigger with release_tag_name input; added prerelease job; updated jobs to use input parameter; removed direct reliance on release event context.
.github/workflows/release-release-events-proxy.yml Expanded trigger to both prereleased and published events; renamed job; switched to new reusable workflow; updated input parameter name.

Sequence Diagram(s)

sequenceDiagram
    participant GitHub Release Event
    participant Proxy Workflow (release-release-events-proxy.yml)
    participant Reusable Workflow (release-new-release-published.yml)
    participant Release Commits & Contributors Workflow

    GitHub Release Event->>Proxy Workflow: Trigger on prereleased/published
    Proxy Workflow->>Reusable Workflow: Call with release_tag_name input

    alt If action is prereleased
        Reusable Workflow->>Release Commits & Contributors Workflow: Call with version input
    else If action is published
        Reusable Workflow->>Slack/Changelog Jobs: Run with release_tag_name input
    end
Loading

Possibly related PRs


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.
    • @coderabbitai modularize this function.
  • 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.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need 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)

  • @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 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: 2

🔭 Outside diff range comments (1)
.github/workflows/release-new-release-published.yml (1)

24-34: Slack notification fires for all published releases, including RCs and beta-tester tags

notify-release-published triggers on published only and no longer filters out tags such as -rc or wc-beta-tester.
This will spam the public Slack channel for every release candidate.

Re-introduce the filter you removed or adapt the condition:

-if: ${{ github.event.action == 'published' }}
+if: ${{ github.event.action == 'published' && !contains(inputs.release_tag_name, '-rc') && !contains(inputs.release_tag_name, 'wc-beta-tester') }}
🧹 Nitpick comments (2)
.github/workflows/release-release-events-proxy.yml (1)

8-14: Job identifier/name no longer reflects the broader scope

Now that the job covers all release-event types, the id call-new-release-published-workflow and display name are misleading.
Consider renaming to something neutral such as call-release-events-workflow to avoid confusion for future maintainers.

.github/workflows/release-new-release-published.yml (1)

50-53: Fail-fast path missing an early set -e

The script block downloads and unzips assets, then manually exits on failure, but earlier commands (gh release download, unzip) could fail silently.
Add set -euo pipefail to catch such errors immediately.

 run: |
-  gh release download "$RELEASE_TAG" --pattern 'woocommerce.zip'
+  set -euo pipefail
+  gh release download "$RELEASE_TAG" --pattern 'woocommerce.zip'
   unzip -qq woocommerce.zip
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 2cf09b1 and 840152d.

📒 Files selected for processing (2)
  • .github/workflows/release-new-release-published.yml (3 hunks)
  • .github/workflows/release-release-events-proxy.yml (1 hunks)
🧰 Additional context used
🧠 Learnings (3)
📓 Common learnings
Learnt from: jorgeatorres
PR: woocommerce/woocommerce#59675
File: .github/workflows/release-bump-as-requirement.yml:48-65
Timestamp: 2025-07-15T15:39:21.815Z
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: prettyboymp
PR: woocommerce/woocommerce#59048
File: .github/workflows/cherry-pick-milestoned-prs.yml:118-131
Timestamp: 2025-07-11T13:05:08.430Z
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: Provide clear, step-by-step instructions for how to test the changes in the PR description.
.github/workflows/release-release-events-proxy.yml (1)
Learnt from: prettyboymp
PR: woocommerce/woocommerce#59048
File: .github/workflows/cherry-pick-milestoned-prs.yml:118-131
Timestamp: 2025-07-11T13:05:08.430Z
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.
.github/workflows/release-new-release-published.yml (4)
Learnt from: jorgeatorres
PR: woocommerce/woocommerce#59675
File: .github/workflows/release-bump-as-requirement.yml:48-65
Timestamp: 2025-07-15T15:39:21.815Z
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: prettyboymp
PR: woocommerce/woocommerce#59048
File: .github/workflows/cherry-pick-milestoned-prs.yml:118-131
Timestamp: 2025-07-11T13:05:08.430Z
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 : 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/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).
🔇 Additional comments (1)
.github/workflows/release-new-release-published.yml (1)

12-18: Guard expression relies on github.event.action, which is undefined outside a release event

When this workflow is invoked via workflow_call, the event context is forwarded today, but that is an implementation detail.
If a future caller (or a manual dispatch) omits a release event payload, github.event.action will be empty, the expression will evaluate to false but still be syntactically valid and might hide problems.

A safer, explicit pattern is to pass the action as an input and base the condition on that, e.g.:

inputs:
  release_action:
    description: Release event action
    required: true
    type: string

and then

-if: ${{ github.event.action == 'prereleased' }}
+if: ${{ inputs.release_action == 'prereleased' }}

Same for the published checks below.

Copy link
Member

@jorgeatorres jorgeatorres left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks @albarin!

For proper testing I had to cherry pick the proxy workflow to the release/10.0 branch in my fork, but that's a one off thing and expected.

Confirmed (in my fork) that:

@albarin albarin merged commit c183a34 into trunk Jul 18, 2025
21 of 23 checks passed
@albarin albarin deleted the 59533/proxy-new-release branch July 18, 2025 10:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
focus: monorepo infrastructure Issues and PRs related to monorepo tooling.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants