Add check for PRs with merge-blocking labels

843bd1cf3cbc7b74246e244b5a99dd845a1729cd

Wolfsblvt <wolfsblvt@gmail.com>

2 files changed, +44 -2Showing whitespace changes
.github/workflows/on-open-handler.yml+1 -1
@@ -15,7 +15,7 @@ jobs:
1515 - name: Label if Author is a Repo Maintainer
1616 # GitHub Script
1717 # https://github.com/marketplace/actions/github-script
1818 uses: actions/github-script@v6v7
1919 with:
2020 script: |
2121 // Get basic info
.github/workflows/pr-auto-manager.yml+43 -1
@@ -73,9 +73,51 @@ jobs:
7373 with:
7474 repo-token: ${{ secrets.BOT_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
7575
76+ check-merge-blocking-labels:
77+ name: Check Merge Blocking Labels
78+ needs: [check-merge-conflicts, pr-size-labeler, label-release-prs, apply-file-based-labels]
79+ runs-on: ubuntu-latest
80+
81+ steps:
82+ - name: Check Merge Blocking
83+ # GitHub Script
84+ # https://github.com/marketplace/actions/github-scriptLabels
85+ id: label-check
86+ uses: actions/github-script@v7
87+ with:
88+ script: |
89+ const prLabels = context.payload.pull_request.labels.map(label => label.name);
90+ const blockingLabels = [
91+ "⛔ Don't Merge",
92+ "🔨 Needs Work",
93+ "🔬 Needs Testing",
94+ "⛔ Waiting For External/Upstream",
95+ "❗ Against Release Branch",
96+ "💥💣 Breaking Changes"
97+ ];
98+ const hasBlockingLabel = prLabels.some(label => blockingLabels.includes(label));
99+
100+ if (hasBlockingLabel) {
101+ console.log("Blocking label detected. Setting warning status.");
102+ await github.rest.checks.create({
103+ owner: context.repo.owner,
104+ repo: context.repo.repo,
105+ name: "PR Label Warning",
106+ head_sha: context.payload.pull_request.head.sha,
107+ status: "completed",
108+ conclusion: "neutral",
109+ output: {
110+ title: "Potential Merge Issue",
111+ summary: "This PR has a merge-blocking label. Proceed with caution."
112+ }
113+ });
114+ } else {
115+ console.log("No merge-blocking labels found.");
116+ }
117+
76118 pr-auto-comments:
77119 name: Post PR Comments Based on Labels
78120 needs: [check-merge-conflicts, pr-size-labeler, label-release-prs, apply-file-based-labels]
79121 runs-on: ubuntu-latest
80122
81123 steps: