Skip to content

The easy-to-use open source Business Intelligence and Embedded Analytics tool that lets everyone work with data :bar_chart:

Only run auto-backport when a backport label is added (#63606)

Fraserc0ca9e049388
diff --git a/.github/actions/create-backport/action.yml b/.github/actions/create-backport/action.yml
index 2f1afd8124d..53315476af1 100644
--- a/.github/actions/create-backport/action.yml
+++ b/.github/actions/create-backport/action.yml
@@ -74,7 +74,7 @@ runs:
git push -u origin ${BACKPORT_BRANCH}
- BACKPORT_PR_URL=$(gh pr create --base "${TARGET_BRANCH}" --head "${BACKPORT_BRANCH}" --label "was-backported" --assignee "${GITHUB_ACTOR}" --title "🤖 backported \"${ORIGINAL_TITLE}\"" --body "${PR_BODY}")
+ BACKPORT_PR_URL=$(gh pr create --base "${TARGET_BRANCH}" --head "${BACKPORT_BRANCH}" --label "was-backported" --assignee "${{ github.event.pull_request.user.login }}" --title "🤖 backported \"${ORIGINAL_TITLE}\"" --body "${PR_BODY}")
BACKPORT_PR_NUMBER=${BACKPORT_PR_URL##*/}
echo "backport_pr_number=$BACKPORT_PR_NUMBER" >> $GITHUB_OUTPUT
diff --git a/.github/workflows/auto-backport.yml b/.github/workflows/auto-backport.yml
index 88fe25eece0..2cee0a83db0 100644
--- a/.github/workflows/auto-backport.yml
+++ b/.github/workflows/auto-backport.yml
@@ -6,11 +6,19 @@ on:
jobs:
create-backport:
- if: | # the PR must be merged and have a backport label
+ if:
+ | # the PR must have a backport label when it's merged, or be labeled with a backport label after merge
github.event.pull_request.merged == true && (
- contains(github.event.pull_request.labels.*.name, 'backport') ||
- contains(github.event.pull_request.labels.*.name, 'double-backport') ||
- contains(github.event.pull_request.labels.*.name, 'triple-backport')
+ github.event.action == 'closed' && (
+ contains(github.event.pull_request.labels.*.name, 'backport') ||
+ contains(github.event.pull_request.labels.*.name, 'double-backport') ||
+ contains(github.event.pull_request.labels.*.name, 'triple-backport')
+ ) ||
+ github.event.action == 'labeled' && (
+ github.event.label.name == 'backport' ||
+ github.event.label.name == 'double-backport' ||
+ github.event.label.name == 'triple-backport'
+ )
)
runs-on: ubuntu-latest
steps: