Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: check mergable by label #2405

Merged
merged 12 commits into from Sep 20, 2023
34 changes: 34 additions & 0 deletions .github/workflows/check-mergable-by-label.yml
Shinigami92 marked this conversation as resolved.
Show resolved Hide resolved
@@ -0,0 +1,34 @@
name: Check mergable by label
Shinigami92 marked this conversation as resolved.
Show resolved Hide resolved

on:
pull_request:
types:
- opened
- reopened
- synchronize
- edited
Shinigami92 marked this conversation as resolved.
Show resolved Hide resolved
- labeled
- unlabeled

permissions:
pull-requests: read
Shinigami92 marked this conversation as resolved.
Show resolved Hide resolved

jobs:
fail-by-blocking-label:
runs-on: ubuntu-latest
steps:
- name: Fail if PR is labeled by a blocking label
Shinigami92 marked this conversation as resolved.
Show resolved Hide resolved
run: |
BLOCKING_LABELS=("do NOT merge yet" "s: on hold")
PR_LABELS=$(jq -r '.pull_request.labels[].name' "$GITHUB_EVENT_PATH")

for LABEL in "${BLOCKING_LABELS[@]}"; do
if [[ "$PR_LABELS" == *"$LABEL"* ]]; then
echo "This PR has a blocking label: $LABEL"
exit 1
fi
done

echo "No blocking labels found"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Shinigami92 marked this conversation as resolved.
Show resolved Hide resolved