Add check for PRs with merge-blocking labels

This commit is contained in:
Wolfsblvt
2025-03-12 04:02:14 +01:00
parent fc151284e4
commit 843bd1cf3c
2 changed files with 44 additions and 2 deletions

View File

@@ -15,7 +15,7 @@ jobs:
- name: Label if Author is a Repo Maintainer
# GitHub Script
# https://github.com/marketplace/actions/github-script
uses: actions/github-script@v6
uses: actions/github-script@v7
with:
script: |
// Get basic info

View File

@@ -73,9 +73,51 @@ jobs:
with:
repo-token: ${{ secrets.BOT_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
check-merge-blocking-labels:
name: Check Merge Blocking Labels
needs: [check-merge-conflicts, pr-size-labeler, label-release-prs, apply-file-based-labels]
runs-on: ubuntu-latest
steps:
- name: Check Merge Blocking
# GitHub Script
# https://github.com/marketplace/actions/github-scriptLabels
id: label-check
uses: actions/github-script@v7
with:
script: |
const prLabels = context.payload.pull_request.labels.map(label => label.name);
const blockingLabels = [
"⛔ Don't Merge",
"🔨 Needs Work",
"🔬 Needs Testing",
"⛔ Waiting For External/Upstream",
"❗ Against Release Branch",
"💥💣 Breaking Changes"
];
const hasBlockingLabel = prLabels.some(label => blockingLabels.includes(label));
if (hasBlockingLabel) {
console.log("Blocking label detected. Setting warning status.");
await github.rest.checks.create({
owner: context.repo.owner,
repo: context.repo.repo,
name: "PR Label Warning",
head_sha: context.payload.pull_request.head.sha,
status: "completed",
conclusion: "neutral",
output: {
title: "Potential Merge Issue",
summary: "This PR has a merge-blocking label. Proceed with caution."
}
});
} else {
console.log("No merge-blocking labels found.");
}
pr-auto-comments:
name: Post PR Comments Based on Labels
needs: [check-merge-conflicts, pr-size-labeler]
needs: [check-merge-conflicts, pr-size-labeler, label-release-prs, apply-file-based-labels]
runs-on: ubuntu-latest
steps: