diff --git a/.github/workflows/pr-cherry-pick-clean.yaml b/.github/workflows/pr-cherry-pick-clean.yaml new file mode 100644 index 0000000000..89d08dd35c --- /dev/null +++ b/.github/workflows/pr-cherry-pick-clean.yaml @@ -0,0 +1,28 @@ +name: "Clean cherry pick PR branch" + +on: + pull_request_target: + branches: + - 'release-v**.x' + types: [closed] + +jobs: + delete-cherry-pick-branch: + runs-on: ubuntu-latest + steps: + - name: delete-cherry-pick-branch + uses: actions/github-script@v6 + env: + REPO: ${{ secrets.SBO_CHERRY_PICK_REPO }} + with: + github-token: ${{ secrets.SBO_CHERRY_PICK_BOT_TOKEN }} + script: | + const [owner, repo] = process.env.REPO.split('/'); + const ref = `heads/${context.payload.pull_request.head.ref}`; + const deleteParams = { owner, repo, ref }; + console.log(`Deleting branch: "${ref}"`); + try { + github.rest.git.deleteRef(deleteParams); + } catch(e) { + console.log("Cannot delete branch; error:", e); + } diff --git a/.github/workflows/pr-cherry-picks.yaml b/.github/workflows/pr-cherry-picks.yaml new file mode 100644 index 0000000000..ec10c22c1f --- /dev/null +++ b/.github/workflows/pr-cherry-picks.yaml @@ -0,0 +1,53 @@ +name: "Cherry pick PR to release branches" + +on: + pull_request_target: + branches: + - master + types: [closed] + +jobs: + cherry_pick_release_v1_1_x: + runs-on: ubuntu-latest + name: Cherry pick into release-v1.1.x branch + if: contains(github.event.pull_request.labels.*.name, 'release/v1.1.x') && github.event.pull_request.merged + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + fetch-depth: 0 + - name: Setup SSH for cherry-pick repo + uses: webfactory/ssh-agent@v0.5.4 + with: + ssh-private-key: ${{ secrets.SBO_CHERRY_PICK_REPO_SSH_PRIVATE_KEY }} + - name: Cherry pick into release-v1.1.x + uses: pmacik/github-cherry-pick-action@main + with: + cherry-pick-repo: ${{ secrets.SBO_CHERRY_PICK_REPO }} + token: ${{ secrets.SBO_CHERRY_PICK_BOT_TOKEN }} + branch: release-v1.1.x + labels: | + cherry-pick + title-prefix: "cherry-pick(release-v1.1.x): " + cherry_pick_release_v1_2_x: + runs-on: ubuntu-latest + name: Cherry pick into release-v1.2.x branch + if: contains(github.event.pull_request.labels.*.name, 'release/v1.2.x') && github.event.pull_request.merged + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + fetch-depth: 0 + - name: Setup SSH for cherry-pick repo + uses: webfactory/ssh-agent@v0.5.4 + with: + ssh-private-key: ${{ secrets.SBO_CHERRY_PICK_REPO_SSH_PRIVATE_KEY }} + - name: Cherry pick into release-v1.2.x + uses: pmacik/github-cherry-pick-action@main + with: + cherry-pick-repo: ${{ secrets.SBO_CHERRY_PICK_REPO }} + token: ${{ secrets.SBO_CHERRY_PICK_BOT_TOKEN }} + branch: release-v1.2.x + labels: | + cherry-pick + title-prefix: "cherry-pick(release-v1.2.x): "