Skip to content

Commit

Permalink
added case for ignore for release
Browse files Browse the repository at this point in the history
  • Loading branch information
adamhaeger committed Oct 21, 2024
1 parent 8e66259 commit 81f4d26
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions .github/workflows/check-label-added.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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.');
}
}

0 comments on commit 81f4d26

Please sign in to comment.