docs(AzureVpcPeering): updating documentation #991
Workflow file for this run
This file contains 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
name: Block mergings PRs if it contains a blocking label (do-not-merge, hold) | |
on: | |
pull_request: | |
types: | |
- labeled | |
- unlabeled | |
- synchronize | |
- opened | |
- reopened | |
permissions: | |
contents: read | |
pull-requests: read | |
checks: write | |
jobs: | |
fail-for-labels: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Block if PR has specific labels | |
uses: actions/github-script@v7 | |
with: | |
script: | | |
const pullNumber = context.payload.pull_request.number; | |
const { data: pullRequest } = await github.rest.pulls.get({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
pull_number: pullNumber, | |
}); | |
const blockingKeywords = ["do-not-merge", "hold"]; | |
pullRequest.labels.forEach(label => | |
blockingKeywords.forEach(blockingKeyword => { | |
if(label.name.includes(blockingKeyword)) { | |
console.log(`Blocking merge due to blocking label "${blockingKeyword}"`); | |
throw new Error('Merging is blocked because this PR contains a blocking label.'); | |
} | |
}) | |
) | |
console.log(`No blocking labels found for PR ${pullNumber}`); |