From 2ddc1d2258138ebead3427e25b0c156efdb9e8cd Mon Sep 17 00:00:00 2001 From: Tamo Date: Thu, 6 Mar 2025 16:30:48 +0100 Subject: [PATCH] update the CI to enforce the db change label on PR --- .github/workflows/db-change.yml | 28 ++++++++++++++++++++++++++++ bors.toml | 1 + 2 files changed, 29 insertions(+) create mode 100644 .github/workflows/db-change.yml diff --git a/.github/workflows/db-change.yml b/.github/workflows/db-change.yml new file mode 100644 index 000000000..dbd6bb82c --- /dev/null +++ b/.github/workflows/db-change.yml @@ -0,0 +1,28 @@ +name: Check db change labels + +on: + pull_request: + types: [opened, synchronize, reopened, labeled, unlabeled] + +env: + GH_TOKEN: ${{ secrets.MEILI_BOT_GH_PAT }} + +jobs: + check-labels: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v2 + - name: Check db change labels + id: check_labels + run: | + URL=/repos/meilisearch/meilisearch/pulls/${{ github.event.pull_request.number }}/labels + echo ${{ github.event.pull_request.number }} + echo $URL + LABELS=$(gh api -H "Accept: application/vnd.github+json" -H "X-GitHub-Api-Version: 2022-11-28" /repos/meilisearch/meilisearch/issues/${{ 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 diff --git a/bors.toml b/bors.toml index 3d04b834c..8671ab305 100644 --- a/bors.toml +++ b/bors.toml @@ -5,6 +5,7 @@ status = [ 'Run Clippy', 'Run Rustfmt', 'Run tests in debug', + 'Check db change labels', ] # 3 hours timeout timeout-sec = 10800