From 0212109e980ef06137fa6e12b302331c62a81128 Mon Sep 17 00:00:00 2001 From: oviner Date: Tue, 15 Aug 2023 15:45:14 +0300 Subject: [PATCH 01/11] add github actions --- .github/workflows/cherry-pick.yml | 37 +++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 .github/workflows/cherry-pick.yml diff --git a/.github/workflows/cherry-pick.yml b/.github/workflows/cherry-pick.yml new file mode 100644 index 0000000..7bce1b1 --- /dev/null +++ b/.github/workflows/cherry-pick.yml @@ -0,0 +1,37 @@ +name: Cherry-Pick PRs to Master + +on: + pull_request: + types: + - closed + +jobs: + cherry-pick: + runs-on: ubuntu-latest + + steps: + - name: Checkout Repository + uses: actions/checkout@v2 + + - name: Set Up Git + run: | + git config --global user.name "GitHub Actions" + git config --global user.email "actions@github.com" + + # Fetch all branches and tags to ensure we have the latest references + git fetch --prune --unshallow --tags + + - name: Cherry-Pick PR Changes + run: | + # Get the PR number from the environment variable + PR_NUMBER=${{ github.event.pull_request.number }} + + # Print the PR_NUMBER + echo "PR Labels: $PR_NUMBER" + + # Use GitHub CLI to fetch the labels of the PR + PR_LABELS=$(gh pr view $PR_NUMBER --json labels.*.name --jq '.[].name') + + # Print the labels + echo "PR Labels: $PR_LABELS" + \ No newline at end of file From 5ab2228854ad2752cde776697da69012a0a5ef07 Mon Sep 17 00:00:00 2001 From: oviner Date: Tue, 15 Aug 2023 15:47:24 +0300 Subject: [PATCH 02/11] pr-test1 --- pr-test1.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 pr-test1.md diff --git a/pr-test1.md b/pr-test1.md new file mode 100644 index 0000000..7f6982e --- /dev/null +++ b/pr-test1.md @@ -0,0 +1 @@ +pr-test1 From 25961f1c3c5a22f682d3452970f889935a07befd Mon Sep 17 00:00:00 2001 From: oviner Date: Tue, 15 Aug 2023 16:56:01 +0300 Subject: [PATCH 03/11] fix --- .github/workflows/cherry-pick.yml | 32 ++++++++++--------------------- 1 file changed, 10 insertions(+), 22 deletions(-) diff --git a/.github/workflows/cherry-pick.yml b/.github/workflows/cherry-pick.yml index 7bce1b1..49fd019 100644 --- a/.github/workflows/cherry-pick.yml +++ b/.github/workflows/cherry-pick.yml @@ -6,32 +6,20 @@ on: - closed jobs: - cherry-pick: + get_labels: runs-on: ubuntu-latest - steps: - name: Checkout Repository uses: actions/checkout@v2 - - name: Set Up Git + - name: Get Merged PR Labels + id: merged_pr run: | - git config --global user.name "GitHub Actions" - git config --global user.email "actions@github.com" - - # Fetch all branches and tags to ensure we have the latest references - git fetch --prune --unshallow --tags - - - name: Cherry-Pick PR Changes + PR_NUMBER=$(jq -r '.pull_request.number' "$GITHUB_EVENT_PATH") + ACCESS_TOKEN="${{ secrets.GITHUB_TOKEN }}" + LABELS=$(curl -s -H "Authorization: Bearer $ACCESS_TOKEN" "https://api.github.com/repos/${{ github.repository }}/pulls/$PR_NUMBER" | jq -r '.labels[].name') + echo "::set-output name=labels::$LABELS" + - name: Print Merged PR Labels run: | - # Get the PR number from the environment variable - PR_NUMBER=${{ github.event.pull_request.number }} - - # Print the PR_NUMBER - echo "PR Labels: $PR_NUMBER" - - # Use GitHub CLI to fetch the labels of the PR - PR_LABELS=$(gh pr view $PR_NUMBER --json labels.*.name --jq '.[].name') - - # Print the labels - echo "PR Labels: $PR_LABELS" - \ No newline at end of file + echo "Merged PR Labels: ${{ steps.merged_pr.outputs.labels }}" + \ No newline at end of file From b35d1380e348daeef1d182c7489bfe4eba544547 Mon Sep 17 00:00:00 2001 From: oviner Date: Tue, 15 Aug 2023 17:16:12 +0300 Subject: [PATCH 04/11] fix code --- .github/workflows/cherry-pick.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cherry-pick.yml b/.github/workflows/cherry-pick.yml index 49fd019..9d1c503 100644 --- a/.github/workflows/cherry-pick.yml +++ b/.github/workflows/cherry-pick.yml @@ -12,7 +12,7 @@ jobs: - name: Checkout Repository uses: actions/checkout@v2 - - name: Get Merged PR Labels + - name: Get Merged PR Labels. id: merged_pr run: | PR_NUMBER=$(jq -r '.pull_request.number' "$GITHUB_EVENT_PATH") From faafaa26d2c799e02b25d5e68caea6003b42b2a1 Mon Sep 17 00:00:00 2001 From: oviner Date: Tue, 15 Aug 2023 17:18:40 +0300 Subject: [PATCH 05/11] 12 --- .github/workflows/cherry-pick.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/cherry-pick.yml b/.github/workflows/cherry-pick.yml index 9d1c503..aa97e30 100644 --- a/.github/workflows/cherry-pick.yml +++ b/.github/workflows/cherry-pick.yml @@ -18,8 +18,5 @@ jobs: PR_NUMBER=$(jq -r '.pull_request.number' "$GITHUB_EVENT_PATH") ACCESS_TOKEN="${{ secrets.GITHUB_TOKEN }}" LABELS=$(curl -s -H "Authorization: Bearer $ACCESS_TOKEN" "https://api.github.com/repos/${{ github.repository }}/pulls/$PR_NUMBER" | jq -r '.labels[].name') - echo "::set-output name=labels::$LABELS" - - name: Print Merged PR Labels - run: | - echo "Merged PR Labels: ${{ steps.merged_pr.outputs.labels }}" + echo "Labels12: $LABELS" \ No newline at end of file From 4b9626e30c237f738255c1d6d55ab55a54d8cba0 Mon Sep 17 00:00:00 2001 From: oviner Date: Tue, 15 Aug 2023 17:19:16 +0300 Subject: [PATCH 06/11] fic --- pr-test1.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pr-test1.md b/pr-test1.md index 7f6982e..3b3d983 100644 --- a/pr-test1.md +++ b/pr-test1.md @@ -1 +1 @@ -pr-test1 +pr-test5 From e31ab70786c11d25c71e6b9d64e233ad78f4f3c6 Mon Sep 17 00:00:00 2001 From: oviner Date: Tue, 15 Aug 2023 18:15:05 +0300 Subject: [PATCH 07/11] che --- .github/workflows/cherry-pick.yml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/.github/workflows/cherry-pick.yml b/.github/workflows/cherry-pick.yml index aa97e30..9152504 100644 --- a/.github/workflows/cherry-pick.yml +++ b/.github/workflows/cherry-pick.yml @@ -19,4 +19,20 @@ jobs: ACCESS_TOKEN="${{ secrets.GITHUB_TOKEN }}" LABELS=$(curl -s -H "Authorization: Bearer $ACCESS_TOKEN" "https://api.github.com/repos/${{ github.repository }}/pulls/$PR_NUMBER" | jq -r '.labels[].name') echo "Labels12: $LABELS" + + # Fetch PR branch + git fetch origin pull/${PR_NUMBER}/head:pr-${PR_NUMBER} + + # Check out the release branch + git checkout release-1 + + # Cherry-pick the PR commit(s) + git cherry-pick pr-${PR_NUMBER} + + # Push changes to the release branch + git push origin release-1 + + # Create a new pull request + gh pr create --base release --head release --title "Cherry-pick PR ${PR_NUMBER}" --body "Cherry-picking changes from PR ${PR_NUMBER}." + \ No newline at end of file From 388f871717c8eeba211d9df5be8541e8df5e7272 Mon Sep 17 00:00:00 2001 From: oviner Date: Tue, 15 Aug 2023 18:27:30 +0300 Subject: [PATCH 08/11] fix --- .github/workflows/cherry-pick.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cherry-pick.yml b/.github/workflows/cherry-pick.yml index 9152504..e0e6705 100644 --- a/.github/workflows/cherry-pick.yml +++ b/.github/workflows/cherry-pick.yml @@ -33,6 +33,6 @@ jobs: git push origin release-1 # Create a new pull request - gh pr create --base release --head release --title "Cherry-pick PR ${PR_NUMBER}" --body "Cherry-picking changes from PR ${PR_NUMBER}." + gh pr create --base release-1 --head release --title "Cherry-pick PR ${PR_NUMBER}" --body "Cherry-picking changes from PR ${PR_NUMBER}." \ No newline at end of file From bc10cc28eeb02a48f1ee8cfafa6e349419319572 Mon Sep 17 00:00:00 2001 From: oviner Date: Tue, 15 Aug 2023 18:28:35 +0300 Subject: [PATCH 09/11] fix --- .github/workflows/cherry-pick.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/cherry-pick.yml b/.github/workflows/cherry-pick.yml index e0e6705..13ec583 100644 --- a/.github/workflows/cherry-pick.yml +++ b/.github/workflows/cherry-pick.yml @@ -28,10 +28,7 @@ jobs: # Cherry-pick the PR commit(s) git cherry-pick pr-${PR_NUMBER} - - # Push changes to the release branch - git push origin release-1 - + # Create a new pull request gh pr create --base release-1 --head release --title "Cherry-pick PR ${PR_NUMBER}" --body "Cherry-picking changes from PR ${PR_NUMBER}." From 19f83d88afa7b93a877f165e2c0dfb98bb94ceb4 Mon Sep 17 00:00:00 2001 From: oviner Date: Tue, 15 Aug 2023 18:38:46 +0300 Subject: [PATCH 10/11] fix co --- .github/workflows/cherry-pick.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/cherry-pick.yml b/.github/workflows/cherry-pick.yml index 13ec583..c2336e4 100644 --- a/.github/workflows/cherry-pick.yml +++ b/.github/workflows/cherry-pick.yml @@ -28,8 +28,7 @@ jobs: # Cherry-pick the PR commit(s) git cherry-pick pr-${PR_NUMBER} - - # Create a new pull request - gh pr create --base release-1 --head release --title "Cherry-pick PR ${PR_NUMBER}" --body "Cherry-picking changes from PR ${PR_NUMBER}." + # Create a new pull request + gh pr create --base release-1 --head pr-${PR_NUMBER} --title "Cherry-pick PR ${PR_NUMBER}" --body "Cherry-picking changes from PR ${PR_NUMBER}." \ No newline at end of file From 0186b02ce057cf836853a4b152ab4724bc26f407 Mon Sep 17 00:00:00 2001 From: oviner Date: Tue, 15 Aug 2023 18:40:46 +0300 Subject: [PATCH 11/11] f --- pr-222 | 1 + 1 file changed, 1 insertion(+) create mode 100644 pr-222 diff --git a/pr-222 b/pr-222 new file mode 100644 index 0000000..7abc2d7 --- /dev/null +++ b/pr-222 @@ -0,0 +1 @@ +pr222 \ No newline at end of file