2025-03-06 16:30:48 +01:00
|
|
|
name: Check db change labels
|
|
|
|
|
|
|
|
on:
|
|
|
|
pull_request:
|
|
|
|
types: [opened, synchronize, reopened, labeled, unlabeled]
|
|
|
|
|
2025-03-06 18:14:14 +01:00
|
|
|
env:
|
|
|
|
GH_TOKEN: ${{ secrets.MEILI_BOT_GH_PAT }}
|
|
|
|
|
2025-03-06 16:30:48 +01:00
|
|
|
jobs:
|
|
|
|
check-labels:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: Checkout code
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
- name: Check db change labels
|
|
|
|
id: check_labels
|
|
|
|
run: |
|
2025-03-06 18:22:30 +01:00
|
|
|
URL=/repos/meilisearch/meilisearch/pulls/${{ github.event.pull_request.number }}/labels
|
|
|
|
echo ${{ github.event.pull_request.number }}
|
|
|
|
echo $URL
|
2025-03-06 16:30:48 +01:00
|
|
|
LABELS=$(gh api -H "Accept: application/vnd.github.v3+json" /repos/meilisearch/meilisearch/pulls/${{ github.event.pull_request.number }}/labels -q .[].name)
|
|
|
|
if [[ ! "$LABELS" =~ "db change" && ! "$LABELS" =~ "no db change" ]]; then
|
|
|
|
echo "::error::Pull request must contain either the 'db change' or 'no db change' label."
|
|
|
|
exit 1
|
|
|
|
else
|
|
|
|
echo "The label is set"
|
|
|
|
fi
|