File: BlockPRMerge.yml

package info (click to toggle)
azure-cli 2.82.0-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 2,359,416 kB
  • sloc: python: 1,910,381; sh: 1,343; makefile: 406; cs: 145; javascript: 74; sql: 37; xml: 21
file content (26 lines) | stat: -rw-r--r-- 843 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
name: Block PR merging on blocked labels

on:
  pull_request_target:
    types: [labeled, unlabeled]
    branches:
      - dev
      - release

jobs:
  block-merge:
    runs-on: ubuntu-latest
    steps:
      - name: Check blocked labels
        uses: actions/github-script@v7
        with:
          script: |
            const labels = context.payload.pull_request.labels.map(label => label.name);
            const blockedLabels = ["do-not-merge", "needs-author-feedback"];
            
            if (labels.some(label => blockedLabels.includes(label))) {
              console.log(`It is not allowed to merge a PR with any blocked labels: ${blockedLabels}`);
              process.exit(1); // Exit with a non-zero status code to block merge
            } else {
              console.log("It is allowed to merge the PR.");
            }