From 758f4ccd7125e53d8f94f8f5df7bd92662279071 Mon Sep 17 00:00:00 2001 From: Ian Faust Date: Fri, 30 Aug 2024 16:15:51 +0200 Subject: [PATCH] [enhancement] Add a label checker to GitHub Actions (#2885) * Create label_enforcement.yml * Update label_enforcement.yml * Update and rename label_enforcement.yml to label-enforcement.yml * Update label-enforcement.yml * Update label-enforcement.yml --- .github/workflows/label-enforcement.yml | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 .github/workflows/label-enforcement.yml diff --git a/.github/workflows/label-enforcement.yml b/.github/workflows/label-enforcement.yml new file mode 100644 index 00000000000..5ad1f6ff8d9 --- /dev/null +++ b/.github/workflows/label-enforcement.yml @@ -0,0 +1,22 @@ +name: Enforce Labels +on: + pull_request: + branches: [ "main" ] + +jobs: + label_checker: + name: Please include labels on your pull request + runs-on: ubuntu-latest + timeout-minutes: 5 + + steps: + - name: test + run: | + LABELS=`gh api -H "Accept: application/vnd.github+json" /repos/oneapi-src/oneDAL/issues/${{ github.event.pull_request.number }}/labels | jq '[.[].name]'` + echo $LABELS + if [[ $LABELS == "[]" ]] || [[ $LABELS == "[\"RFC\"]" ]]; then + echo "::error::No label set on the pull request" + exit 1 + fi + env: + GH_TOKEN: ${{ github.token }}