Skip to content

Conversation

@jac0626
Copy link
Collaborator

@jac0626 jac0626 commented Nov 27, 2025

Add a GitHub Actions workflow to automatically cherry-pick merged PRs to target branches based on backport-to-* labels. Supports both automatic trigger on PR merge and manual trigger via workflow dispatch.

@codecov
Copy link

codecov bot commented Nov 27, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (master@da333ee). Learn more about missing BASE report.

Additional details and impacted files
@@            Coverage Diff            @@
##             master    #3106   +/-   ##
=========================================
  Coverage          ?   46.30%           
=========================================
  Files             ?       66           
  Lines             ?    13923           
  Branches          ?        0           
=========================================
  Hits              ?     6447           
  Misses            ?     7476           
  Partials          ?        0           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@mergify mergify bot added the ci-passed label Nov 27, 2025
Copy link
Contributor

@XuanYang-cn XuanYang-cn left a comment

Choose a reason for hiding this comment

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

Review Summary

Thanks for working on this! The auto cherry-pick workflow is a great addition, but it needs several enhancements to meet our requirements.

Required Changes:

1. ❌ Add Manual Trigger Support

Currently the workflow only triggers automatically. We need a manual trigger for retry scenarios.

Required: Add workflow_dispatch trigger with inputs:

on:
  workflow_dispatch:
    inputs:
      pr_number:
        description: 'PR number to cherry-pick'
        required: true
        type: number
      target_branch:
        description: 'Target branch (e.g., 2.5, 2.6)'
        required: true
        type: string
  pull_request_target:
    types: [closed, labeled]

2. ❌ Skip PRs with proto_gen Changes

PRs that modify the proto_gen/ directory should be skipped automatically since they require special handling.

Required: Add file checking before cherry-pick:

FILES_CHANGED=$(gh pr view $PR_NUMBER --json files -q '.files[].path')
if echo "$FILES_CHANGED" | grep -q "proto_gen/"; then
  gh pr comment $PR_NUMBER --body "⚠️ **Auto Cherry-Pick Skipped**
  This PR modifies \`proto_gen/\` directory. If backporting is needed, please cherry-pick manually.
  
  Target branches: $TARGET_BRANCHES"
  exit 0
fi

3. ❌ Use Label-Based Approach Instead of Label Parsing

Current implementation uses labels like "... to N.x" which is fragile and only supports one target.

Required: Change to use explicit version labels:

  • Use labels: backport/2.6, backport/2.5, etc.
  • Support multiple target branches per PR
  • Loop through all backport/* labels

Example logic:

TARGET_VERSIONS=$(gh pr view $PR_NUMBER --json labels -q '.labels[].name | select(startswith("backport/")) | sub("backport/"; "")')

for VERSION in $TARGET_VERSIONS; do
  # Find matching branch and cherry-pick
  # Create separate backport PR for each version
done

4. ❌ Add Success Tracking Label

Required: After successful cherry-pick, add backport/succeeded label to the original PR. Keep the backport/X.Y labels for reference (don't remove them).


5. ⚠️ Improve Author Notifications

Current implementation only comments on failure.

Required: Always notify the author with clear status:

  • Success: List which branches were successfully backported
  • ⚠️ Skipped: Proto changes detected, manual action may be needed
  • Failed: Conflicts detected, manual cherry-pick required

Summary of Label Design:

  • backport/2.6, backport/2.5 → Target release branches (can have multiple)
  • backport/succeeded → Added after all cherry-picks complete successfully
  • backport/manual → (Optional) Flag for PRs requiring manual handling

Please update the workflow to address these requirements. Let me know if you have questions!

@XuanYang-cn
Copy link
Contributor

Thanks to warp's help on the review comments

@XuanYang-cn
Copy link
Contributor

@jac0626 Please provide a design doc for this, because it reduces all contributors labor on cherry-pick simple PRs and requires a little bit more actions on a PR.

Please add the design in the lark doc first, and add the rules in CONTRIBUTING.md

@jac0626
Copy link
Collaborator Author

jac0626 commented Nov 28, 2025

@jac0626 Please provide a design doc for this, because it reduces all contributors labor on cherry-pick simple PRs and requires a little bit more actions on a PR.

Please add the design in the lark doc first, and add the rules in CONTRIBUTING.md

ack

@jac0626 jac0626 changed the title ci: add auto cherry-pick workflow for backporting [WIP] ci: add auto cherry-pick workflow for backporting Nov 28, 2025
@mergify mergify bot added needs-dco and removed dco-passed labels Nov 28, 2025
@jac0626 jac0626 force-pushed the master branch 2 times, most recently from 183a735 to cf5f185 Compare November 28, 2025 06:41
@mergify mergify bot added dco-passed and removed needs-dco labels Nov 28, 2025
@jac0626 jac0626 force-pushed the master branch 4 times, most recently from 19451f7 to 0bef340 Compare November 28, 2025 08:11
@jac0626
Copy link
Collaborator Author

jac0626 commented Nov 28, 2025

proto_gen

directory pymilvus/grpc_gen ? @XuanYang-cn

@mergify mergify bot added dco-passed and removed needs-dco labels Dec 1, 2025
@mergify mergify bot added needs-dco and removed dco-passed labels Dec 1, 2025
@mergify mergify bot added dco-passed and removed needs-dco labels Dec 2, 2025
@jac0626 jac0626 changed the title [WIP] ci: add auto cherry-pick workflow for backporting ci: add auto cherry-pick workflow for backporting Dec 2, 2025
@jac0626 jac0626 force-pushed the master branch 2 times, most recently from e489ae3 to b612826 Compare December 2, 2025 07:54
Signed-off-by: silas.jiang <silas.jiang@zilliz.com>
Copy link
Contributor

@XuanYang-cn XuanYang-cn left a comment

Choose a reason for hiding this comment

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

/lgtm

@sre-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: jac0626, XuanYang-cn

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@sre-ci-robot sre-ci-robot merged commit f8a5ce0 into milvus-io:master Dec 2, 2025
29 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants