diff --git a/.github/workflows/check-label-added.yml b/.github/workflows/check-label-added.yml index 6ff60a18f..1fe3f5164 100644 --- a/.github/workflows/check-label-added.yml +++ b/.github/workflows/check-label-added.yml @@ -7,12 +7,15 @@ jobs: check-label: runs-on: ubuntu-latest steps: - - name: Check if at least one label matches the pattern "kind/*" + - name: Check labels uses: actions/github-script@v6 with: script: | const labels = context.payload.pull_request.labels; - const hasMatchingLabel = labels.some(label => /^kind\/.*/.test(label.name)); - if (!hasMatchingLabel) { - core.setFailed('The PR must have at least one label matching the pattern "kind/*".'); + const hasIgnoreLabel = labels.some(label => label.name === 'ignore-for-release'); + if (!hasIgnoreLabel) { + const hasMatchingLabel = labels.some(label => /^kind\/.*/.test(label.name)); + if (!hasMatchingLabel) { + core.setFailed('The PR must have at least one label matching the pattern "kind/*", unless it has the "ignore-for-release" label.'); + } }