[Snyk] Fix for 1 vulnerabilities #821
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Required PR Label | |
on: | |
pull_request: | |
types: [opened, labeled, unlabeled, synchronize] | |
jobs: | |
label: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check PR Labels | |
uses: actions/github-script@v6 | |
with: | |
script: | | |
let missing = false; | |
const labels = context.payload.pull_request.labels.map(l => l.name); | |
if (labels.filter(l => l.startsWith('area:')).length === 0) { | |
console.error('::error::Missing label: Please add at least one "area" label.'); | |
missing = true; | |
} | |
if (labels.filter(l => l.startsWith('semver:')).length !== 1) { | |
console.error('::error::Missing label: Please add exactly one "semver" label.'); | |
missing = true; | |
} | |
if (missing) { | |
process.exit(1); | |
} | |
console.log('::notice::Success: This pull request has correct labels, thanks!'); |