This is an automated email from the ASF dual-hosted git repository.
kirs pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/master by this push:
new 3b0d50f5c47 [chore](auto-pick)Optimize the cherry-pick script (#43130)
3b0d50f5c47 is described below
commit 3b0d50f5c47970075c6210bfcbf4c1834ac0a0d4
Author: Calvin Kirs <[email protected]>
AuthorDate: Sat Nov 2 16:25:32 2024 +0800
[chore](auto-pick)Optimize the cherry-pick script (#43130)
- removing unnecessary comments and using a temporary directory for the
Git clone operation.
---
.github/workflows/auto-cherry-pick.yml | 2 +-
tools/auto-pick-script.py | 14 +++++++++++---
2 files changed, 12 insertions(+), 4 deletions(-)
diff --git a/.github/workflows/auto-cherry-pick.yml
b/.github/workflows/auto-cherry-pick.yml
index 7105bbccb2d..f76c88934fd 100644
--- a/.github/workflows/auto-cherry-pick.yml
+++ b/.github/workflows/auto-cherry-pick.yml
@@ -45,7 +45,7 @@ jobs:
pip install PyGithub
- name: Check SHA
run: |
-
expected_sha="80b7c6087f2a3e4f4c7f035a52e8e7b05ce00f27aa5c1bd52179df685c912447f94a96145fd3204a3958d8ed9777de5a5183b120e99e0e95bbca0366d69b0ac0"
+
expected_sha="4e4c0d7689b765c7f0677d75d23222555afa9286af46cf77ced66fa247a298d9f8a8c86830d0ce55f70e5f09532b54fbafee040c0343833077cbc7e214d486d2"
calculated_sha=$(sha512sum tools/auto-pick-script.py | awk '{
print $1 }')
if [ "$calculated_sha" != "$expected_sha" ]; then
echo "SHA mismatch! Expected: $expected_sha, but got:
$calculated_sha"
diff --git a/tools/auto-pick-script.py b/tools/auto-pick-script.py
index 8f5376863d3..a26abeaaa3a 100644
--- a/tools/auto-pick-script.py
+++ b/tools/auto-pick-script.py
@@ -59,8 +59,17 @@ subprocess.run(["git", "config", "--global",
"credential.helper", "store"], chec
# Clone the repository locally and switch to the new branch
repo_url = f"https://x-access-token:{GITHUB_TOKEN}@github.com/{REPO_NAME}.git"
-subprocess.run(["git", "clone", repo_url])
repo_dir = REPO_NAME.split("/")[-1] # Get the directory name
+#create tmp dir
+repo_tmp_dir = f"/tmp/{pr_number}/{TARGET_BRANCH}/"
+if os.path.exists(repo_tmp_dir):
+ print(f"Directory {repo_tmp_dir} already exists. Deleting it.")
+ subprocess.run(["rm", "-rf", repo_tmp_dir])
+os.makedirs(repo_tmp_dir)
+# cd to tmp
+os.chdir(repo_tmp_dir)
+subprocess.run(["git", "clone", repo_url])
+
subprocess.run(["git", "checkout", new_branch_name], cwd=repo_dir)
# Set Git user identity for commits
@@ -89,11 +98,10 @@ try:
# Create a new PR for the cherry-picked changes
new_pr = repo.create_pull(
title=f"{TARGET_BRANCH}: {pr.title}", # Prefix with branch name
- body=f"PR Body: {pr.body} \n Cherry-picked from #{pr.number}", #
Keep the original PR body
+ body=f"Cherry-picked from #{pr.number}", # Keep the original PR
body
head=new_branch_name,
base=TARGET_BRANCH
)
- new_pr.create_issue_comment("run buildall")
print(f"Created a new PR #{new_pr.number} for cherry-picked changes.")
else:
print(f"Commit {merge_commit_sha} was not found in {new_branch_name}
after cherry-picking.")
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]