Skip to content

[Release] CI: change automation PRs author (batch 1) #60247

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 9 commits into from
Aug 8, 2025

Conversation

kalessil
Copy link
Contributor

@kalessil kalessil commented Aug 7, 2025

Submission Review Guidelines:

Changes proposed in this Pull Request:

Related to: #60245, WOOPLUG-5274

Do not merge: I'll create a new token in the repository before I merge the PR.

To trigger CI for PRs created by our automation, we are switching the auth token starting with the cherry-picking automation.
Along the way, we fix resolving woocommercebot as a committer.

The new token has a fallback to the GH actions token to simplify testing any future changes in the forks.

For the example PR note: GH action bot is not referenced, woocommercebot is correctly recognized as a committer.

Screenshot from 2025-08-07 12-26-30

How to test the changes in this Pull Request:

Follow test instructions from #59048, with additional setup steps:

  • Navigate to developer settings under your GitHub account and create a custom token limited to the fork-repo and PRs write permission
  • add a new fork-repo secret: WC_BOT_PR_CREATE_TOKEN for the new token (in the monorepo, we'll use the woocommercebot token)
  • as per the shared screenshot, expect your profile to be referenced instead of mine

@kalessil kalessil self-assigned this Aug 7, 2025
@github-actions github-actions bot added the focus: monorepo infrastructure Issues and PRs related to monorepo tooling. label Aug 7, 2025
@kalessil kalessil changed the title [Release] CI: change automation PRs author [Release] CI: change automation PRs author (batch 1) Aug 7, 2025
@kalessil kalessil marked this pull request as ready for review August 7, 2025 10:46
@kalessil kalessil requested a review from a team as a code owner August 7, 2025 10:46
Copy link
Contributor

github-actions bot commented Aug 7, 2025

Testing Guidelines

Hi @prettyboymp @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 Aug 7, 2025

📝 Walkthrough

Walkthrough

The GitHub Actions workflows for cherry-picking pull requests were updated to change the Git committer/author identity from "WooCommerce Bot" to "woocommercebot" and use a GitHub noreply email. Steps using actions/github-script@v7 now explicitly pass a github-token input, preferring a custom secret if available. Secrets inheritance was also made explicit. No core logic or control flow changes were made.

Changes

Cohort / File(s) Change Summary
Cherry-pick Workflows: Identity & Token Updates
.github/workflows/cherry-pick-milestoned-prs.yml, .github/workflows/cherry-pick-to-frozen.yml, .github/workflows/cherry-pick-to-trunk.yml, .github/workflows/shared-cherry-pick.yml
Updated Git committer/author name and email to "woocommercebot" with GitHub noreply email. Explicitly passed github-token input to all actions/github-script steps, prioritizing WC_BOT_PR_CREATE_TOKEN secret and falling back to GITHUB_TOKEN. Explicit inheritance of secrets added where needed. No logic or control flow changes.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related PRs

Note

⚡️ Unit Test Generation is now available in beta!

Learn more here, or try it out under "Finishing Touches" below.


📜 Recent review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between fa35487 and fdde6cd.

📒 Files selected for processing (4)
  • .github/workflows/cherry-pick-milestoned-prs.yml (12 hunks)
  • .github/workflows/cherry-pick-to-frozen.yml (7 hunks)
  • .github/workflows/cherry-pick-to-trunk.yml (7 hunks)
  • .github/workflows/shared-cherry-pick.yml (6 hunks)
🚧 Files skipped from review as they are similar to previous changes (4)
  • .github/workflows/cherry-pick-milestoned-prs.yml
  • .github/workflows/shared-cherry-pick.yml
  • .github/workflows/cherry-pick-to-frozen.yml
  • .github/workflows/cherry-pick-to-trunk.yml
✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch dev/WOOPLUG-5274-spike-automation-prs-author

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: 0

🧹 Nitpick comments (5)
.github/workflows/shared-cherry-pick.yml (2)

249-250: Repeat-after-me token expression – extract once, reuse everywhere
The fallback expression

github-token: ${{ secrets.WC_BOT_PR_CREATE_TOKEN || secrets.GITHUB_TOKEN }}

is repeated in several steps (here and below, and again in other workflows).
To DRY this up and avoid future copy-paste divergence, consider defining it once at workflow-level:

env:
   GIT_COMMITTER_NAME: 'woocommercebot'
   GIT_COMMITTER_EMAIL: 'woocommercebot@users.noreply.github.com'
   GIT_AUTHOR_NAME: 'woocommercebot'
   GIT_AUTHOR_EMAIL: 'woocommercebot@users.noreply.github.com'
+  BOT_GITHUB_TOKEN: ${{ secrets.WC_BOT_PR_CREATE_TOKEN || secrets.GITHUB_TOKEN }}

…then reference it:

- github-token: ${{ secrets.WC_BOT_PR_CREATE_TOKEN || secrets.GITHUB_TOKEN }}
+ github-token: ${{ env.BOT_GITHUB_TOKEN }}

Same tweak can be applied to every other workflow updated in this PR.


298-299: Consistency nit – some earlier github-script steps still rely on the implicit token
Now that you’re passing an explicit token here, you may want to do the same for the earlier verification steps (Lines 60 / 105) for consistency and easier grepping in the future. Functionally it’s fine, just stylistic.

.github/workflows/cherry-pick-to-trunk.yml (1)

118-119: Token repetition comment applies here too
Same duplication of the fallback expression. Consider the BOT_GITHUB_TOKEN env trick mentioned in the shared workflow comment to keep things tidy.

.github/workflows/cherry-pick-to-frozen.yml (1)

129-130: Token expression duplication
Same optional refactor as flagged earlier – factor the fallback token into an env var to cut repetition.

.github/workflows/cherry-pick-milestoned-prs.yml (1)

127-128: DRY the token fallback
Same suggestion: pull the WC_BOT_PR_CREATE_TOKEN || GITHUB_TOKEN expression into an env var and reference it, here and throughout the workflow.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 3de58cd and fa35487.

📒 Files selected for processing (4)
  • .github/workflows/cherry-pick-milestoned-prs.yml (11 hunks)
  • .github/workflows/cherry-pick-to-frozen.yml (6 hunks)
  • .github/workflows/cherry-pick-to-trunk.yml (6 hunks)
  • .github/workflows/shared-cherry-pick.yml (3 hunks)
🧰 Additional context used
🧠 Learnings (7)
📓 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.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-07-21T05:22:46.426Z
Learning: Provide clear, step-by-step instructions for how to test the changes in the PR description.
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: 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#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.
📚 Learning: in woocommerce release workflows, the version variable used in changelog generation comes from the `...
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/cherry-pick-to-trunk.yml
  • .github/workflows/shared-cherry-pick.yml
  • .github/workflows/cherry-pick-to-frozen.yml
  • .github/workflows/cherry-pick-milestoned-prs.yml
📚 Learning: in woocommerce core repository, changelog entries for all prs live in `plugins/woocommerce/changelog...
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:

  • .github/workflows/cherry-pick-to-trunk.yml
  • .github/workflows/shared-cherry-pick.yml
  • .github/workflows/cherry-pick-to-frozen.yml
  • .github/workflows/cherry-pick-milestoned-prs.yml
📚 Learning: in github actions workflows, when reviewing steps that access event data like `github.event.pull_req...
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/cherry-pick-to-trunk.yml
  • .github/workflows/shared-cherry-pick.yml
  • .github/workflows/cherry-pick-to-frozen.yml
  • .github/workflows/cherry-pick-milestoned-prs.yml
📚 Learning: do not suggest using `cross-env` in the woocommerce repository as it's deprecated/archived and the t...
Learnt from: gigitux
PR: woocommerce/woocommerce#58785
File: plugins/woocommerce/client/blocks/package.json:0-0
Timestamp: 2025-06-17T10:25:36.686Z
Learning: Do not suggest using `cross-env` in the WooCommerce repository as it's deprecated/archived and the team is working to remove it from blocks commands to reduce the dependency tree. Instead, inline environment variables like `WP_EXPERIMENTAL_MODULES=true knip` should work fine in supported environments.

Applied to files:

  • .github/workflows/cherry-pick-to-trunk.yml
  • .github/workflows/shared-cherry-pick.yml
  • .github/workflows/cherry-pick-to-frozen.yml
  • .github/workflows/cherry-pick-milestoned-prs.yml
📚 Learning: applies to .github/pull_request_template.md : preserve required markdown sections in the pr descript...
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/cherry-pick-to-frozen.yml
📚 Learning: woocommerce trunk versions follow the pattern `x.y.0-dev` where the patch version is always `0`. thi...
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:

  • .github/workflows/cherry-pick-milestoned-prs.yml
🔇 Additional comments (7)
.github/workflows/shared-cherry-pick.yml (1)

39-44: Identity switch looks correct and in-line with other workflows
Swapping the committer/author to woocommercebot with the @users.noreply.github.com e-mail is a ✅-move and keeps commits attributed to the bot account consistently across the repo.

.github/workflows/cherry-pick-to-trunk.yml (2)

9-14: Identity switch acknowledged
woocommercebot persona variables are updated as in the shared workflow – looks good.


41-42: Secret inheritance is required – good catch
Explicit secrets: inherit ensures the reusable workflow can push the branch. Nice addition.

.github/workflows/cherry-pick-to-frozen.yml (2)

12-17: Bot identity update
Change mirrors the other workflows – no issues spotted.


89-90: Secret inheritance thumbs-up
Ensures the reusable cherry-pick job can authenticate when running from pull_request_target.

.github/workflows/cherry-pick-milestoned-prs.yml (2)

11-16: Bot persona switch approved
Consistent with the rest of the batch.


105-106: secrets: inherit OK
Allows pushes to release branches – required for milestoned picks.

Copy link
Contributor

@prettyboymp prettyboymp left a comment

Choose a reason for hiding this comment

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

Reviewed and tested. No issues found.

@kalessil kalessil merged commit a7b4e7b into trunk Aug 8, 2025
12 checks passed
@kalessil kalessil deleted the dev/WOOPLUG-5274-spike-automation-prs-author branch August 8, 2025 09:44
@kalessil kalessil added this to the 10.1.0 milestone Aug 8, 2025
@woocommercebot
Copy link
Collaborator

IMPORTANT: Merging this PR to the appropriate branches is critical to the release process and ensures that the bug does not cause regressions in the future releases.

Cherry picking was successful for release/10.1. Please merge the following PR: [Backport to release/10.1] [Release] CI: change automation PRs author (batch 1)

@kalessil kalessil removed this from the 10.1.0 milestone Aug 8, 2025
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.

4 participants