From 0ce025768d04bc9c8077b803450dc75b72a8aeca Mon Sep 17 00:00:00 2001 From: Ian Faust Date: Fri, 30 Aug 2024 06:57:08 +0200 Subject: [PATCH 1/5] Create label_enforcement.yml --- .github/workflows/label_enforcement.yml | 19 +++++++++++++++++++ 1 file changed, 19 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..74540464a64 --- /dev/null +++ b/.github/workflows/label_enforcement.yml @@ -0,0 +1,19 @@ +name: Enforce Labels +on: + pull_request: + branches: [ "main" ] + +env: + LABELS: ${{ toJSON(github.event.pull_request.labels.*.name) }} + +jobs: + label_checker: + strategy: + fail-fast: false + name: Please include labels on your pull request + runs-on: ubuntu-latest + timeout-minutes: 120 + + steps: + - name: test + run: echo "${{ env.LABELS }}" From 1c59a210525559502bff2b0da9a7258b3deadd17 Mon Sep 17 00:00:00 2001 From: Ian Faust Date: Fri, 30 Aug 2024 07:01:50 +0200 Subject: [PATCH 2/5] Update label_enforcement.yml --- .github/workflows/label_enforcement.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/label_enforcement.yml b/.github/workflows/label_enforcement.yml index 74540464a64..c56eadfb3ca 100644 --- a/.github/workflows/label_enforcement.yml +++ b/.github/workflows/label_enforcement.yml @@ -8,12 +8,10 @@ env: jobs: label_checker: - strategy: - fail-fast: false name: Please include labels on your pull request runs-on: ubuntu-latest - timeout-minutes: 120 + timeout-minutes: 5 steps: - name: test - run: echo "${{ env.LABELS }}" + run: if [[ "${{ env.LABELS }}" == "[]" ]]; then exit 1; fi From 60111f12fbdee7ef49fb6d5efe34a98724d870b9 Mon Sep 17 00:00:00 2001 From: Ian Faust Date: Fri, 30 Aug 2024 07:08:35 +0200 Subject: [PATCH 3/5] Update and rename label_enforcement.yml to label-enforcement.yml --- .../{label_enforcement.yml => label-enforcement.yml} | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) rename .github/workflows/{label_enforcement.yml => label-enforcement.yml} (64%) diff --git a/.github/workflows/label_enforcement.yml b/.github/workflows/label-enforcement.yml similarity index 64% rename from .github/workflows/label_enforcement.yml rename to .github/workflows/label-enforcement.yml index c56eadfb3ca..cd383bf885b 100644 --- a/.github/workflows/label_enforcement.yml +++ b/.github/workflows/label-enforcement.yml @@ -14,4 +14,8 @@ jobs: steps: - name: test - run: if [[ "${{ env.LABELS }}" == "[]" ]]; then exit 1; fi + run: | + if [[ "${{ env.LABELS }}" == "[]" ]]; then + echo "::error::No label set on the pull request" + exit 1 + fi From d74aae0e19364c232359eaed4f209ee0d7334cf5 Mon Sep 17 00:00:00 2001 From: Ian Faust Date: Fri, 30 Aug 2024 09:34:35 +0200 Subject: [PATCH 4/5] Update label-enforcement.yml --- .github/workflows/label-enforcement.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/label-enforcement.yml b/.github/workflows/label-enforcement.yml index cd383bf885b..de362da03e6 100644 --- a/.github/workflows/label-enforcement.yml +++ b/.github/workflows/label-enforcement.yml @@ -3,9 +3,6 @@ on: pull_request: branches: [ "main" ] -env: - LABELS: ${{ toJSON(github.event.pull_request.labels.*.name) }} - jobs: label_checker: name: Please include labels on your pull request @@ -15,7 +12,11 @@ jobs: steps: - name: test run: | - if [[ "${{ env.LABELS }}" == "[]" ]]; then + 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 == "[]" ]]; then echo "::error::No label set on the pull request" exit 1 fi + env: + GH_TOKEN: ${{ github.token }} From ed8362bf0b3fc7f4cf2ee469a30f75cd1ba3c265 Mon Sep 17 00:00:00 2001 From: Ian Faust Date: Fri, 30 Aug 2024 09:41:17 +0200 Subject: [PATCH 5/5] Update label-enforcement.yml --- .github/workflows/label-enforcement.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/label-enforcement.yml b/.github/workflows/label-enforcement.yml index de362da03e6..5ad1f6ff8d9 100644 --- a/.github/workflows/label-enforcement.yml +++ b/.github/workflows/label-enforcement.yml @@ -14,7 +14,7 @@ jobs: 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 == "[]" ]]; then + if [[ $LABELS == "[]" ]] || [[ $LABELS == "[\"RFC\"]" ]]; then echo "::error::No label set on the pull request" exit 1 fi