From 52502c9a1d087e6124e92ade53223f3161dce4c0 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Tue, 29 Nov 2022 00:55:43 +0000 Subject: [PATCH] Prevent backport workflow from running on umerged PRs (#2746) Signed-off-by: Miki Signed-off-by: Miki (cherry picked from commit a3cbd305bf8593adb241dc02ca889dc6979a6393) Signed-off-by: github-actions[bot] --- .github/workflows/backport.yml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/.github/workflows/backport.yml b/.github/workflows/backport.yml index f515b254b868..f066af06d442 100644 --- a/.github/workflows/backport.yml +++ b/.github/workflows/backport.yml @@ -12,6 +12,17 @@ jobs: contents: write pull-requests: write name: Backport + # Only react to merged PRs for security reasons. + # See https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#pull_request_target. + if: > + github.event.pull_request.merged + && ( + github.event.action == 'closed' + || ( + github.event.action == 'labeled' + && contains(github.event.label.name, 'backport') + ) + ) steps: - name: GitHub App token id: github_app_token