From 44d5c6a44fd1f45a2e80c635c9f74e20d49f87e8 Mon Sep 17 00:00:00 2001 From: Helber Belmiro Date: Fri, 7 Jul 2023 10:31:51 -0300 Subject: [PATCH] Added action for PR backporting (#120) Signed-off-by: Helber Belmiro --- .github/workflows/pr-backporting.yml | 39 ++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 .github/workflows/pr-backporting.yml diff --git a/.github/workflows/pr-backporting.yml b/.github/workflows/pr-backporting.yml new file mode 100644 index 0000000..0aae8a4 --- /dev/null +++ b/.github/workflows/pr-backporting.yml @@ -0,0 +1,39 @@ +name: Pull Request Backporting + +on: + pull_request_target: + types: [closed, labeled] +env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + +jobs: + compute-targets: + if: ${{ github.event.pull_request.state == 'closed' && github.event.pull_request.merged }} + runs-on: ubuntu-latest + outputs: + target-branches: ${{ steps.set-targets.outputs.targets }} + env: + LABELS: ${{ toJSON(github.event.pull_request.labels) }} + steps: + - name: Set target branches + id: set-targets + uses: kiegroup/kie-ci/.ci/actions/parse-labels@main + with: + labels: ${LABELS} + + backporting: + if: ${{ github.event.pull_request.state == 'closed' && github.event.pull_request.merged && needs.compute-targets.outputs.target-branches != '[]' }} + name: "[${{ matrix.target-branch }}] - Backporting" + runs-on: ubuntu-latest + needs: compute-targets + strategy: + matrix: + target-branch: ${{ fromJSON(needs.compute-targets.outputs.target-branches) }} + fail-fast: false + env: + REVIEWERS: ${{ toJSON(github.event.pull_request.requested_reviewers) }} + steps: + - name: Backporting + uses: kiegroup/kie-ci/.ci/actions/backporting@main + with: + target-branch: ${{ matrix.target-branch }} \ No newline at end of file