This is an automated email from the ASF dual-hosted git repository.
zky pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git
The following commit(s) were added to refs/heads/main by this push:
new 6d818ff92 fix: adjust action for auto cherry pick (#5276)
6d818ff92 is described below
commit 6d818ff92d1f9b05eb38d0d4e51ab0a9fef0730d
Author: 青湛 <[email protected]>
AuthorDate: Thu Aug 3 23:10:22 2023 +1200
fix: adjust action for auto cherry pick (#5276)
Co-authored-by: Louis.z <[email protected]>
---
.github/actions/auto-cherry-pick/action.yml | 3 ++-
.github/actions/auto-cherry-pick/cherry-pick.sh | 23 +++++++++++------------
.github/workflows/auto-cherry-pick.yml | 8 ++------
3 files changed, 15 insertions(+), 19 deletions(-)
diff --git a/.github/actions/auto-cherry-pick/action.yml
b/.github/actions/auto-cherry-pick/action.yml
index 4d0966825..095472784 100644
--- a/.github/actions/auto-cherry-pick/action.yml
+++ b/.github/actions/auto-cherry-pick/action.yml
@@ -28,6 +28,7 @@ inputs:
required: false
assignees:
description: "A comma or newline separated list of assignees (GitHub
usernames)."
+ default: ${{ github.actor }}
required: false
runs:
using: "composite"
@@ -38,9 +39,9 @@ runs:
shell: bash
env:
GH_TOKEN: ${{ github.token }}
+ REPOSITORY: ${{ github.repository }}
PR_NUMBER: ${{ github.event.pull_request.number }}
PR_TITLE: ${{ github.event.pull_request.title }}
- PR_BODY: ${{ github.event.pull_request.body }}
LABEL_NAME: ${{ github.event.label.name }}
AUTHOR_EMAIL: ${{ inputs.author_email }}
AUTHOR_NAME: ${{ inputs.author_name }}
diff --git a/.github/actions/auto-cherry-pick/cherry-pick.sh
b/.github/actions/auto-cherry-pick/cherry-pick.sh
index 97c697d57..a58afb197 100644
--- a/.github/actions/auto-cherry-pick/cherry-pick.sh
+++ b/.github/actions/auto-cherry-pick/cherry-pick.sh
@@ -20,16 +20,16 @@
set -e
TARGET_BRANCH="release-${LABEL_NAME##*-}"
-PR_BRANCH="auto-cherry-pick-$TARGET_BRANCH-$GITHUB_SHA"
+PR_BRANCH="$TARGET_BRANCH-auto-cherry-pick-$PR_NUMBER"
AUTO_CHERRY_PICK_LABEL="bot/auto-cherry-pick"
AUTO_CHERRY_PICK_VERSION_LABEL="bot/auto-cherry-pick-for-$TARGET_BRANCH"
AUTO_CHERRY_PICK_FAILED_LABEL="bot/auto-cherry-pick-failed"
AUTO_CHERRY_PICK_COMPLETED_LABEL="bot/auto-cherry-pick-completed"
-echo "==================== Basic Info ===================="
+echo "::group::Basic Info"
+echo "Repository: $REPOSITORY"
echo "PR Number: $PR_NUMBER"
echo "PR Title: $PR_TITLE"
-echo "PR Body: $PR_BODY"
echo "Label: $LABEL_NAME"
echo "GitHub SHA: $GITHUB_SHA"
echo "Author Email: $AUTHOR_EMAIL"
@@ -37,8 +37,9 @@ echo "Author Name: $AUTHOR_NAME"
echo "Assignees: $ASSIGNEES"
echo "Target Branch: $TARGET_BRANCH"
echo "PR Branch: $PR_BRANCH"
+echo "::endgroup::"
-echo "==================== Git Cherry Pick ===================="
+echo "::group::Git Cherry Pick"
git config --global user.email "$AUTHOR_EMAIL"
git config --global user.name "$AUTHOR_NAME"
@@ -48,20 +49,18 @@ git restore .
git checkout -b $PR_BRANCH origin/$TARGET_BRANCH
git cherry-pick -m 1 --strategy=recursive --strategy-option=theirs $GITHUB_SHA
|| (
gh pr comment $PR_NUMBER --body "🤖 The current file has a conflict, and
the pr cannot be automatically created."
- gh pr edit $PR_NUMBER --add-label $AUTO_CHERRY_PICK_FAILED_LABEL || (
- gh label create $AUTO_CHERRY_PICK_FAILED_LABEL -c "#D93F0B" -d
"auto cherry pick failed"
- gh pr edit $PR_NUMBEr --add-label $AUTO_CHERRY_PICK_FAILED_LABEL
- )
+ gh pr edit $PR_NUMBEr --add-label $AUTO_CHERRY_PICK_FAILED_LABEL
exit 1
)
git push origin $PR_BRANCH
+echo "::endgroup::"
-echo "==================== GitHub Auto Create PR ===================="
+echo "::group::GitHub Auto Create PR"
AUTO_CREATED_PR_LINK=$(gh pr create \
-B $TARGET_BRANCH \
-H $PR_BRANCH \
- -t "$PR_TITLE (cherry-picked-from #$PR_NUMBER)" \
- -b "$PR_BODY" \
+ -t "cherry-pick #$PR_NUMBER $PR_TITLE" \
+ -b "cherry-pick #$PR_NUMBER $PR_TITLE" \
-a $ASSIGNEES)
gh pr comment $PR_NUMBER --body "🤖 cherry pick finished successfully 🎉!"
@@ -72,7 +71,7 @@ gh pr edit $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 #$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 "#5319E7" -d "auto cherry
pick pr"
gh label create $AUTO_CHERRY_PICK_VERSION_LABEL -c "#5319E7" -d "auto
cherry pick pr for $TARGET_BRANCH"
gh pr edit $AUTO_CREATED_PR_LINK --add-label
"$AUTO_CHERRY_PICK_LABEL,$AUTO_CHERRY_PICK_VERSION_LABEL"
)
+echo "::endgroup::"
diff --git a/.github/workflows/auto-cherry-pick.yml
b/.github/workflows/auto-cherry-pick.yml
index 9d3cefa23..b9957a49a 100644
--- a/.github/workflows/auto-cherry-pick.yml
+++ b/.github/workflows/auto-cherry-pick.yml
@@ -24,17 +24,13 @@ on:
- closed
jobs:
- cherry-pick:
+ auto-cherry-pick:
if: github.event.pull_request.merged == true &&
startsWith(github.event.label.name, 'needs-cherrypick-')
runs-on: ubuntu-latest
- permissions:
- contents: write
- pull-requests: write
steps:
- uses: actions/checkout@v3
- - name: Cherry Pick
+ - name: Auto Cherry Pick
uses: ./.github/actions/auto-cherry-pick
with:
author_email: [email protected]
author_name: action_bot
- assignees: abeizn