diff --git a/.github/workflows/backport.yml b/.github/workflows/backport.yml index ab7f622..fac9157 100644 --- a/.github/workflows/backport.yml +++ b/.github/workflows/backport.yml @@ -14,10 +14,7 @@ jobs: if: > github.event.pull_request.merged && ( - ( - github.event.action == 'closed' - && contains(github.event.pull_request.labels.*.name, 'backport') - ) + github.event.action == 'closed' || ( github.event.action == 'labeled' && contains(github.event.label.name, 'backport') @@ -25,6 +22,6 @@ jobs: ) steps: - name: Backport - uses: tibdex/backport@v1 + uses: tibdex/backport@v2 with: github_token: ${{ secrets.GITHUB_TOKEN }} diff --git a/action.yml b/action.yml index 69d4492..676d9b4 100644 --- a/action.yml +++ b/action.yml @@ -31,7 +31,7 @@ inputs: The data properties are: - base: backport PR's base branch - - labels: array containing the original PR's labels + - labels: array containing the original PR's labels, excluding those matching `label_pattern`. default: "[]" github_token: description: Token for the GitHub API. diff --git a/package.json b/package.json index 2ba87a3..7974cf3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "backport", - "version": "2.0.0", + "version": "2.0.1", "license": "MIT", "main": "dist/index.js", "files": [ diff --git a/src/backport.ts b/src/backport.ts index 96f83a4..afb9136 100644 --- a/src/backport.ts +++ b/src/backport.ts @@ -269,7 +269,9 @@ const backport = async ({ const head = getHead({ base, number }); const labels = getLabels({ base, - labels: originalLabels.map(({ name }) => name), + labels: originalLabels + .map(({ name }) => name) + .filter((label) => !labelRegExp.test(label)), }); const title = getTitle({ base, number, title: originalTitle });