diff --git a/.github/actions/auto-cherry-pick/action.yml b/.github/actions/auto-cherry-pick/action.yml deleted file mode 100644 index 054ffbcf39d..00000000000 --- a/.github/actions/auto-cherry-pick/action.yml +++ /dev/null @@ -1,52 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -name: "Auto Cherry Pick" -description: "cherry pick commits from Pull Requests into Release branch" -inputs: - trigger_label_prefix: - description: "The trigger label prefix" - default: "needs-cherrypick-" - required: false - author_email: - description: "The author email address" - default: ${{ github.actor }}@users.noreply.github.com - required: false - author_name: - description: "The author name" - default: ${{ github.actor }} - required: false - assignees: - description: "A comma or newline separated list of assignees (GitHub usernames)." - default: ${{ github.actor }} - required: false -runs: - using: "composite" - steps: - - run: chmod +x $GITHUB_ACTION_PATH/cherry-pick.sh - shell: bash - - run: $GITHUB_ACTION_PATH/cherry-pick.sh - shell: bash - env: - GH_TOKEN: ${{ github.token }} - ORIGIN_PR_NUMBER: ${{ github.event.pull_request.number }} - ORIGIN_PR_TITLE: ${{ github.event.pull_request.title }} - ORIGIN_PR_LABELS_JSON: ${{ toJson(github.event.pull_request.labels.*.name) }} - TRIGER_LABEL_PREFIX: ${{ inputs.trigger_label_prefix }} - AUTHOR_EMAIL: ${{ inputs.author_email }} - AUTHOR_NAME: ${{ inputs.author_name }} - ASSIGNEES: ${{ inputs.assignees }} diff --git a/.github/actions/auto-cherry-pick/cherry-pick.sh b/.github/actions/auto-cherry-pick/cherry-pick.sh deleted file mode 100644 index 5931a98c4b6..00000000000 --- a/.github/actions/auto-cherry-pick/cherry-pick.sh +++ /dev/null @@ -1,88 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -#!/bin/bash - -set -e - -ORIGIN_PR_LABELS=$(echo "$ORIGIN_PR_LABELS_JSON" | jq -r '.[]') - -echo "::group::Origin Info" -echo "Origin PR Number: $ORIGIN_PR_NUMBER" -echo "Origin PR Title: $ORIGIN_PR_TITLE" -echo "Origin PR Labels: $ORIGIN_PR_LABELS" -echo "GitHub SHA: $GITHUB_SHA" -echo "Trigger Label Prefix: $TRIGER_LABEL_PREFIX" -echo "Author Email: $AUTHOR_EMAIL" -echo "Author Name: $AUTHOR_NAME" -echo "Assignees: $ASSIGNEES" -echo "::endgroup::" - -AUTO_CHERRY_PICK_LABEL="bot/auto-cherry-pick" -AUTO_CHERRY_PICK_FAILED_LABEL="bot/auto-cherry-pick-failed" -AUTO_CHERRY_PICK_COMPLETED_LABEL="bot/auto-cherry-pick-completed" - -for label in ${ORIGIN_PR_LABELS[@]}; do - if [[ "$label" == "$TRIGER_LABEL_PREFIX"* ]]; then - TARGET_BRANCH="release-${label##*-}" - AUTO_CREATE_PR_BRANCH="$TARGET_BRANCH-auto-cherry-pick-$ORIGIN_PR_NUMBER" - AUTO_CHERRY_PICK_VERSION_LABEL="bot/auto-cherry-pick-for-$TARGET_BRANCH" - - echo "::group::Generate Info" - echo "Target Branch: $TARGET_BRANCH" - echo "Auto Create PR Branch: $AUTO_CREATE_PR_BRANCH" - echo "Auto Cherry Pick Version Label: $AUTO_CHERRY_PICK_VERSION_LABEL" - echo "::endgroup::" - - echo "::group::Git Cherry Pick" - git config --global user.email "$AUTHOR_EMAIL" - git config --global user.name "$AUTHOR_NAME" - - git remote update - git fetch --all - git checkout -b $AUTO_CREATE_PR_BRANCH origin/$TARGET_BRANCH - git cherry-pick -m 1 $GITHUB_SHA || ( - gh pr comment $ORIGIN_PR_NUMBER --body "🤖 The current file has a conflict, and the pr cannot be automatically created." - gh pr edit $ORIGIN_PR_NUMBER --add-label $AUTO_CHERRY_PICK_FAILED_LABEL - exit 1 - ) - git push origin $AUTO_CREATE_PR_BRANCH - echo "::endgroup::" - - echo "::group::GitHub Auto Create PR" - AUTO_CREATED_PR_LINK=$(gh pr create \ - -B $TARGET_BRANCH \ - -H $AUTO_CREATE_PR_BRANCH \ - -t "cherry-pick #$ORIGIN_PR_NUMBER $ORIGIN_PR_TITLE" \ - -b "cherry-pick #$ORIGIN_PR_NUMBER $ORIGIN_PR_TITLE" \ - -a $ASSIGNEES) - - gh pr comment $ORIGIN_PR_NUMBER --body "🤖 Target: #$TARGET_BRANCH cherry pick finished successfully 🎉!" - gh pr edit $ORIGIN_PR_NUMBER --add-label $AUTO_CHERRY_PICK_COMPLETED_LABEL || ( - gh label create $AUTO_CHERRY_PICK_COMPLETED_LABEL -c "#0E8A16" -d "auto cherry pick completed" - gh pr edit $ORIGIN_PR_NUMBER --add-label $AUTO_CHERRY_PICK_COMPLETED_LABEL - ) - - gh pr comment $AUTO_CREATED_PR_LINK --body "🤖 this a auto create pr!cherry picked from #$ORIGIN_PR_NUMBER." - gh pr edit $AUTO_CREATED_PR_LINK --add-label "$AUTO_CHERRY_PICK_LABEL,$AUTO_CHERRY_PICK_VERSION_LABEL" || ( - gh label create $AUTO_CHERRY_PICK_LABEL -c "#0E8A16" -d "auto cherry pick pr" -f - gh label create $AUTO_CHERRY_PICK_VERSION_LABEL -c "#5319E7" -d "auto cherry pick pr for $TARGET_BRANCH" -f - gh pr edit $AUTO_CREATED_PR_LINK --add-label "$AUTO_CHERRY_PICK_LABEL,$AUTO_CHERRY_PICK_VERSION_LABEL" - ) - echo "::endgroup::" - fi -done diff --git a/.github/workflows/auto-cherry-pick.yml b/.github/workflows/auto-cherry-pick.yml deleted file mode 100644 index 271041723ec..00000000000 --- a/.github/workflows/auto-cherry-pick.yml +++ /dev/null @@ -1,39 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -name: Auto Cherry Pick - -on: - pull_request: - types: - - labeled - - closed - -jobs: - auto-cherry-pick: - if: false # disabled - # if: github.event.pull_request.merged == true - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v7 - with: - fetch-depth: 0 - - name: Auto Cherry Pick - uses: ./.github/actions/auto-cherry-pick - with: - author_email: action_bot@users.noreply.devlake.com - author_name: action_bot