Skip to content

Workflow tweaking #7319

Workflow tweaking

Workflow tweaking #7319

name: "Label Check"
on:
pull_request:
branches:
- "main"
- "release/**"
types: [opened, edited, labeled, unlabeled, synchronize]
jobs:
check-label:
runs-on: ubuntu-latest
steps:
- name: Check labels
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9
with:
script: |
const labels = context.payload.pull_request.labels;
const releaseLabels = ["ignore-for-release", "breaking-change", "feature", "bugfix", "dependency", "other"];
if(!releaseLabels.some(r=>labels.some(l=>l.name == r))){
core.setFailed(`The PR must have at least one of these labels: ${releaseLabels}`)
}
// const backportLabels = ["backport", "backport-ignore"];
// const targetBranch = context.payload.pull_request.base.ref;
// if(targetBranch === "main" && !backportLabels.some(r=>labels.some(l=>l.name == r))){
// core.setFailed(`The PR must have at least one of these labels: ${backportLabels}`)
// }