| 73 | with: | 73 | with: |
| 74 | repo-token: ${{ secrets.BOT_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} | 74 | repo-token: ${{ secrets.BOT_GITHUB_TOKEN || secrets.GITHUB_TOKEN }} |
| 75 | | 75 | |
| | 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 | |
| 76 | pr-auto-comments: | 118 | pr-auto-comments: |
| 77 | name: Post PR Comments Based on Labels | 119 | name: Post PR Comments Based on Labels |
| 78 | needs: [check-merge-conflicts, pr-size-labeler] | 120 | needs: [check-merge-conflicts, pr-size-labeler, label-release-prs, apply-file-based-labels] |
| 79 | runs-on: ubuntu-latest | 121 | runs-on: ubuntu-latest |
| 80 | | 122 | |
| 81 | steps: | 123 | steps: |