Skip to content

chore(RedisInstance): use .status.state (GCP, AWS) #961

chore(RedisInstance): use .status.state (GCP, AWS)

chore(RedisInstance): use .status.state (GCP, AWS) #961

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}`);