From 2e0036bc3a9f5ea21ba9335c863511b3ffac5df8 Mon Sep 17 00:00:00 2001 From: Lin Yang Date: Tue, 3 Dec 2024 15:13:42 +0800 Subject: [PATCH] ci: trigger cherry-pick/backport by labels on PR (#499) (#500) Signed-off-by: Lin Yang (cherry picked from commit 77f6c3b0c4967d741785c216c073f543c19bf412) --- .github/workflows/backport.yml | 4 ++-- .github/workflows/cherry-pick.yml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/backport.yml b/.github/workflows/backport.yml index 37a3c41b9..1650df0ac 100644 --- a/.github/workflows/backport.yml +++ b/.github/workflows/backport.yml @@ -13,7 +13,7 @@ jobs: backport_v1_4: runs-on: ubuntu-latest name: Backport into release/v1.4 - if: ${{ !startsWith(github.event.pull_request.title, '[cherry-pick]') && github.repository == 'flomesh-io/fsm' && github.event.pull_request.merged == true }} + if: ${{ contains(github.event.pull_request.labels.*.name, 'needs-backport') && github.repository == 'flomesh-io/fsm' && github.event.pull_request.merged == true }} steps: - name: Checkout uses: actions/checkout@v4 @@ -23,7 +23,7 @@ jobs: uses: korthout/backport-action@v3 with: copy_assignees: true - copy_labels_pattern: '[\s\S]+' + copy_labels_pattern: '^(?!needs-).*' copy_requested_reviewers: true github_token: ${{ secrets.WORKFLOW_PAT }} pull_title: '[backport] ${pull_title}' diff --git a/.github/workflows/cherry-pick.yml b/.github/workflows/cherry-pick.yml index 256fa81fc..b35f5d318 100644 --- a/.github/workflows/cherry-pick.yml +++ b/.github/workflows/cherry-pick.yml @@ -13,7 +13,7 @@ jobs: cherry_pick_main: runs-on: ubuntu-latest name: Cherry pick into main - if: ${{ !startsWith(github.event.pull_request.title, '[backport]') && github.repository == 'flomesh-io/fsm' && github.event.pull_request.merged == true }} + if: ${{ contains(github.event.pull_request.labels.*.name, 'needs-cherry-pick') && github.repository == 'flomesh-io/fsm' && github.event.pull_request.merged == true }} steps: - name: Checkout uses: actions/checkout@v4 @@ -23,7 +23,7 @@ jobs: uses: korthout/backport-action@v3 with: copy_assignees: true - copy_labels_pattern: '[\s\S]+' + copy_labels_pattern: '^(?!needs-).*' copy_requested_reviewers: true github_token: ${{ secrets.WORKFLOW_PAT }} pull_title: '[cherry-pick] ${pull_title}'