Add action confirmation editor #104
Workflow file for this run
This file contains hidden or 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: Blocking labels | |
| on: | |
| pull_request: | |
| types: | |
| - opened | |
| - synchronize | |
| - reopened | |
| - labeled | |
| - unlabeled | |
| branches: | |
| - dev | |
| - master | |
| permissions: | |
| contents: read | |
| jobs: | |
| check: | |
| name: Check for labels which block the Pull Request from being merged | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Check for blocking labels | |
| uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 | |
| with: | |
| script: | | |
| const blockingLabels = [ | |
| "wait for backend", | |
| "Needs UX", | |
| "Do Not Review", | |
| "Blocked", | |
| "has-parent", | |
| ]; | |
| const prLabels = context.payload.pull_request.labels.map( | |
| (l) => l.name | |
| ); | |
| const found = blockingLabels.filter((bl) => prLabels.includes(bl)); | |
| if (found.length > 0) { | |
| const message = `This Pull Request is blocked by label${found.length > 1 ? "s" : ""}: ${found.join(", ")}`; | |
| await core.summary | |
| .addHeading(":no_entry_sign: Pull Request is blocked", 2) | |
| .addRaw(message) | |
| .write(); | |
| core.setFailed(message); | |
| } else { | |
| await core.summary | |
| .addHeading(":white_check_mark: Pull Request is clear to merge after review", 2) | |
| .addRaw("This Pull Request is not blocked by any labels which prevent it from being merged.") | |
| .write(); | |
| } |