[release/v7.4]Add GitHub Actions workflow to verify PR labels (#25158)

Co-authored-by: Travis Plunk <travis.plunk@microsoft.com>
This commit is contained in:
Justin Chung
2025-03-12 11:41:40 -07:00
committed by GitHub
co-authored by Travis Plunk
parent ac77d6422a
commit bc463d9721
+31
View File
@@ -0,0 +1,31 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
name: Verify PR Labels
on:
pull_request:
types: [opened, reopened, edited, labeled, unlabeled, synchronize]
permissions:
contents: read
pull-requests: read
jobs:
verify-labels:
if: github.repository_owner == 'PowerShell'
runs-on: ubuntu-latest
steps:
- name: Check out the repository
uses: actions/checkout@v2
- name: Verify PR has label starting with 'cl-'
id: verify-labels
uses: actions/github-script@v6
with:
script: |
const labels = context.payload.pull_request.labels.map(label => label.name.toLowerCase());
if (!labels.some(label => label.startsWith('cl-'))) {
core.setFailed("Every PR must have at least one label starting with 'cl-'.");
}