Skip to content

Adds workflow file to check for labels on PRs #3

Adds workflow file to check for labels on PRs

Adds workflow file to check for labels on PRs #3

Workflow file for this run

name: Require semver label before merge
on:
pull_request:
types: [opened, edited, labeled, unlabeled, synchronize]
jobs:
require-label:
runs-on: ubuntu-latest
steps:
- name: Check for required labels
uses: actions/github-script@v6
with:
script: |
const requiredLabels = ['Semver-Major', 'Semver-Minor', 'Semver-Patch'];
const labels = context.payload.pull_request.labels.map(label => label.name);
const hasRequiredLabel = requiredLabels.some(label => labels.includes(label));
if (!hasRequiredLabel) {
core.setFailed(`Pull request must have one of the following labels: ${requiredLabels.join(', ')}`);
}