Create label.yml #6
Workflow file for this run
This file contains hidden or 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
| # 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@v4 | |
| - name: Verify PR has label starting with 'cl-' | |
| id: verify-labels | |
| uses: actions/github-script@v7 | |
| 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-'."); | |
| } |