fix: update the readme #18
This file contains 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: Mergeable Check | |
on: | |
pull_request: | |
types: [opened, synchronize, labeled, unlabeled] | |
jobs: | |
label-check: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v2 | |
- name: Check PR Labels | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
PR_NUMBER: ${{ github.event.pull_request.number }} | |
run: | | |
LABELS=$(gh pr view $PR_NUMBER --json labels --jq '.labels[].name') | |
REQUIRED_LABELS=("ready" "lgtm" "approved") | |
for LABEL in "${REQUIRED_LABELS[@]}"; do | |
if ! echo "$LABELS" | grep -q "$LABEL"; then | |
echo "Missing required label: $LABEL, unalbe to merge" | |
exit 1 | |
fi | |
done | |
if echo "$LABELS" | grep -q "hold"; then | |
echo "Label 'hold' is present, unable to merge." | |
exit 1 | |
fi | |
echo "The pr is mergeable." |