diff --git a/.github/workflows/cherry-pick.yml b/.github/workflows/cherry-pick.yml new file mode 100644 index 0000000..c2336e4 --- /dev/null +++ b/.github/workflows/cherry-pick.yml @@ -0,0 +1,34 @@ +name: Cherry-Pick PRs to Master + +on: + pull_request: + types: + - closed + +jobs: + get_labels: + runs-on: ubuntu-latest + steps: + - name: Checkout Repository + uses: actions/checkout@v2 + + - name: Get Merged PR Labels. + id: merged_pr + run: | + 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 "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} + + # 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 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 diff --git a/pr-test1.md b/pr-test1.md new file mode 100644 index 0000000..3b3d983 --- /dev/null +++ b/pr-test1.md @@ -0,0 +1 @@ +pr-test5