From 2486155fed5c4cfc37c92c9bcaf9be041134b917 Mon Sep 17 00:00:00 2001 From: Yaswant Pradhan Date: Wed, 22 Feb 2023 14:43:34 +0000 Subject: [PATCH 01/17] add label checker action --- .github/workflows/label.yml | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 .github/workflows/label.yml diff --git a/.github/workflows/label.yml b/.github/workflows/label.yml new file mode 100644 index 00000000..b32e8dbd --- /dev/null +++ b/.github/workflows/label.yml @@ -0,0 +1,20 @@ +name: Check Label + +on: + pull_request: + # branches: + # - main + types: + - opened + - labeled + - unlabeled + +jobs: + fail-for-draft: + if: '! contains(github.event.pull_request.labels.*.name, "ready to merge")' + runs-on: ubuntu-latest + steps: + - name: Fail if PR is not labelled as ready to merge + run: | + echo "This PR is not yet ready to merge." + exit 1 From 23566794bd6865d2a78236fe0a1be38cb7748954 Mon Sep 17 00:00:00 2001 From: Yaswant Pradhan Date: Wed, 22 Feb 2023 14:54:26 +0000 Subject: [PATCH 02/17] fix syntax --- .github/workflows/label.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/label.yml b/.github/workflows/label.yml index b32e8dbd..44593e7d 100644 --- a/.github/workflows/label.yml +++ b/.github/workflows/label.yml @@ -11,7 +11,7 @@ on: jobs: fail-for-draft: - if: '! contains(github.event.pull_request.labels.*.name, "ready to merge")' + if: ! ${{ contains(github.event.pull_request.labels.*.name, 'ready to merge') }} runs-on: ubuntu-latest steps: - name: Fail if PR is not labelled as ready to merge From 54563785cdfde35553f8e3d54f7cb2dc317b0485 Mon Sep 17 00:00:00 2001 From: Yaswant Pradhan Date: Wed, 22 Feb 2023 14:59:04 +0000 Subject: [PATCH 03/17] try2 --- .github/workflows/label.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/label.yml b/.github/workflows/label.yml index 44593e7d..3ca2de27 100644 --- a/.github/workflows/label.yml +++ b/.github/workflows/label.yml @@ -11,7 +11,7 @@ on: jobs: fail-for-draft: - if: ! ${{ contains(github.event.pull_request.labels.*.name, 'ready to merge') }} + if: '! contains(github.event.pull_request.labels.*.name, 'ready to merge')' runs-on: ubuntu-latest steps: - name: Fail if PR is not labelled as ready to merge From 8f3f8b0a4732c0f0a7f6b13b4fa63e5907ea5bf8 Mon Sep 17 00:00:00 2001 From: Yaswant Pradhan Date: Wed, 22 Feb 2023 15:01:36 +0000 Subject: [PATCH 04/17] reverse logic --- .github/workflows/label.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/label.yml b/.github/workflows/label.yml index 3ca2de27..e235e0d5 100644 --- a/.github/workflows/label.yml +++ b/.github/workflows/label.yml @@ -10,11 +10,11 @@ on: - unlabeled jobs: - fail-for-draft: - if: '! contains(github.event.pull_request.labels.*.name, 'ready to merge')' + ready-to-merge: + if: contains(github.event.pull_request.labels.*.name, 'ready to merge') runs-on: ubuntu-latest steps: - - name: Fail if PR is not labelled as ready to merge + - name: Pass if PR is labelled as ready to merge run: | - echo "This PR is not yet ready to merge." - exit 1 + echo "This PR is ready to merge." + exit 0 From c7ac2a499335c01306224e4b69090a15d8b85827 Mon Sep 17 00:00:00 2001 From: Yaswant Pradhan Date: Wed, 22 Feb 2023 15:04:50 +0000 Subject: [PATCH 05/17] try 3 --- .github/workflows/label.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/label.yml b/.github/workflows/label.yml index e235e0d5..a856075b 100644 --- a/.github/workflows/label.yml +++ b/.github/workflows/label.yml @@ -2,8 +2,6 @@ name: Check Label on: pull_request: - # branches: - # - main types: - opened - labeled From baa73eff7b3eac0bf45f383969c8fe8e472be608 Mon Sep 17 00:00:00 2001 From: Yaswant Pradhan Date: Wed, 22 Feb 2023 15:11:39 +0000 Subject: [PATCH 06/17] try4 --- .github/workflows/label.yml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/workflows/label.yml b/.github/workflows/label.yml index a856075b..6c616575 100644 --- a/.github/workflows/label.yml +++ b/.github/workflows/label.yml @@ -2,6 +2,8 @@ name: Check Label on: pull_request: + # branches: + # - main types: - opened - labeled @@ -9,10 +11,10 @@ on: jobs: ready-to-merge: - if: contains(github.event.pull_request.labels.*.name, 'ready to merge') + if: ! ${{ contains(github.event.pull_request.labels.*.name, 'ready to merge') }} runs-on: ubuntu-latest steps: - - name: Pass if PR is labelled as ready to merge + - name: Fail if PR is not labelled as ready to merge run: | - echo "This PR is ready to merge." - exit 0 + echo "This PR is not yet ready to merge." + exit 1 From 521b3e32b90449af41df1109a1e06fdfc815d0c7 Mon Sep 17 00:00:00 2001 From: Yaswant Pradhan Date: Wed, 22 Feb 2023 18:27:05 +0000 Subject: [PATCH 07/17] try4 --- .github/workflows/label.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/label.yml b/.github/workflows/label.yml index 6c616575..542be5a9 100644 --- a/.github/workflows/label.yml +++ b/.github/workflows/label.yml @@ -11,7 +11,7 @@ on: jobs: ready-to-merge: - if: ! ${{ contains(github.event.pull_request.labels.*.name, 'ready to merge') }} + if: "!contains(github.event.pull_request.labels.*.name, 'ready to merge')" runs-on: ubuntu-latest steps: - name: Fail if PR is not labelled as ready to merge From 78309f4f020e5c8cd350440d45e5f2898e08ef21 Mon Sep 17 00:00:00 2001 From: Yaswant Pradhan Date: Wed, 22 Feb 2023 18:47:34 +0000 Subject: [PATCH 08/17] check for passing read-to-merge label --- .github/workflows/label.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/workflows/label.yml b/.github/workflows/label.yml index 542be5a9..23b02122 100644 --- a/.github/workflows/label.yml +++ b/.github/workflows/label.yml @@ -11,10 +11,17 @@ on: jobs: ready-to-merge: - if: "!contains(github.event.pull_request.labels.*.name, 'ready to merge')" runs-on: ubuntu-latest + steps: - name: Fail if PR is not labelled as ready to merge + if: "!contains(github.event.pull_request.labels.*.name, 'ready to merge')" run: | echo "This PR is not yet ready to merge." exit 1 + + - name: Pass if PR is labelled as ready to merge + if: contains(github.event.pull_request.labels.*.name, 'ready to merge') + run: | + echo "This PR is ready to merge." + exit 0 From 8b06d0d39a054dfbbac5431d19c68f593a39560a Mon Sep 17 00:00:00 2001 From: Yaswant Pradhan Date: Wed, 22 Feb 2023 19:09:14 +0000 Subject: [PATCH 09/17] final push --- .github/workflows/label.yml | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/.github/workflows/label.yml b/.github/workflows/label.yml index 23b02122..e80b5ab6 100644 --- a/.github/workflows/label.yml +++ b/.github/workflows/label.yml @@ -1,9 +1,8 @@ +--- name: Check Label on: pull_request: - # branches: - # - main types: - opened - labeled @@ -11,17 +10,11 @@ on: jobs: ready-to-merge: + if: "!contains(github.event.pull_request.labels.*.name, 'ready to merge')" runs-on: ubuntu-latest steps: - name: Fail if PR is not labelled as ready to merge - if: "!contains(github.event.pull_request.labels.*.name, 'ready to merge')" run: | echo "This PR is not yet ready to merge." exit 1 - - - name: Pass if PR is labelled as ready to merge - if: contains(github.event.pull_request.labels.*.name, 'ready to merge') - run: | - echo "This PR is ready to merge." - exit 0 From 4844e9d1238f259f3cb8221693d37881182e53fa Mon Sep 17 00:00:00 2001 From: Yaswant Pradhan Date: Thu, 23 Feb 2023 09:41:00 +0000 Subject: [PATCH 10/17] label check for both situation --- .github/workflows/label.yml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/.github/workflows/label.yml b/.github/workflows/label.yml index e80b5ab6..83b6c85b 100644 --- a/.github/workflows/label.yml +++ b/.github/workflows/label.yml @@ -2,6 +2,8 @@ name: Check Label on: + push: + branches: [feature/check_label] pull_request: types: - opened @@ -10,11 +12,17 @@ on: jobs: ready-to-merge: - if: "!contains(github.event.pull_request.labels.*.name, 'ready to merge')" + # if: "!contains(github.event.pull_request.labels.*.name, 'ready to merge')" runs-on: ubuntu-latest steps: - name: Fail if PR is not labelled as ready to merge + if: "!contains(github.event.pull_request.labels.*.name,'ready to merge')" run: | echo "This PR is not yet ready to merge." exit 1 + + - name: Pass if PR is labelled as ready to merge + if: "contains(github.event.pull_request.labels.*.name,'ready to merge')" + run: | + echo "This PR is ready to merge." From ae1bd3f0a53f07b5988a72d8c0f7e08fd5159359 Mon Sep 17 00:00:00 2001 From: Yaswant Pradhan Date: Thu, 23 Feb 2023 09:46:43 +0000 Subject: [PATCH 11/17] only check on PR --- .github/workflows/label.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/label.yml b/.github/workflows/label.yml index 83b6c85b..90fb7071 100644 --- a/.github/workflows/label.yml +++ b/.github/workflows/label.yml @@ -2,8 +2,8 @@ name: Check Label on: - push: - branches: [feature/check_label] + # push: + # branches: [feature/check_label] pull_request: types: - opened From bb12232610266e11e3e46d84aeb9ed923f16ed92 Mon Sep 17 00:00:00 2001 From: Yaswant Pradhan Date: Thu, 23 Feb 2023 09:58:00 +0000 Subject: [PATCH 12/17] Empty Commit From fc5095a6c90c5cca904cf41dbaab1ed900008195 Mon Sep 17 00:00:00 2001 From: Yaswant Pradhan Date: Thu, 23 Feb 2023 10:19:27 +0000 Subject: [PATCH 13/17] try on 2 --- .github/workflows/label.yml | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/.github/workflows/label.yml b/.github/workflows/label.yml index 90fb7071..4d4d5b11 100644 --- a/.github/workflows/label.yml +++ b/.github/workflows/label.yml @@ -2,13 +2,19 @@ name: Check Label on: - # push: - # branches: [feature/check_label] + push: + branches: [feature/check_label] pull_request: - types: - - opened - - labeled - - unlabeled + branches: [feature/check_label] + +# on: +# # push: +# # branches: [feature/check_label] +# pull_request: +# types: +# - opened +# - labeled +# - unlabeled jobs: ready-to-merge: From e7fbd3a9089ce2b1f9c1a052257bfa798219252f Mon Sep 17 00:00:00 2001 From: Yaswant Pradhan Date: Thu, 23 Feb 2023 10:23:54 +0000 Subject: [PATCH 14/17] try on 3 --- .github/workflows/label.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/label.yml b/.github/workflows/label.yml index 4d4d5b11..e69bc551 100644 --- a/.github/workflows/label.yml +++ b/.github/workflows/label.yml @@ -4,8 +4,13 @@ name: Check Label on: push: branches: [feature/check_label] + pull_request: branches: [feature/check_label] + types: + - opened + - labeled + - unlabeled # on: # # push: From 7c46f049675e47aff792c4542209cda05b33971c Mon Sep 17 00:00:00 2001 From: Yaswant Pradhan Date: Thu, 23 Feb 2023 10:25:16 +0000 Subject: [PATCH 15/17] Empty Commit From 8cb82a4950a1269b2622a8c9215b0e1fcf8ff2dd Mon Sep 17 00:00:00 2001 From: Yaswant Pradhan Date: Thu, 23 Feb 2023 11:08:59 +0000 Subject: [PATCH 16/17] try on 4 --- .github/workflows/label.yml | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/.github/workflows/label.yml b/.github/workflows/label.yml index e69bc551..607e89ac 100644 --- a/.github/workflows/label.yml +++ b/.github/workflows/label.yml @@ -7,10 +7,10 @@ on: pull_request: branches: [feature/check_label] - types: - - opened - - labeled - - unlabeled + # types: + # - opened + # - labeled + # - unlabeled # on: # # push: @@ -28,12 +28,15 @@ jobs: steps: - name: Fail if PR is not labelled as ready to merge - if: "!contains(github.event.pull_request.labels.*.name,'ready to merge')" + if: | + github.ref == 'pull_request' && + !contains(github.event.pull_request.labels.*.name,'ready to merge') run: | echo "This PR is not yet ready to merge." exit 1 - name: Pass if PR is labelled as ready to merge - if: "contains(github.event.pull_request.labels.*.name,'ready to merge')" - run: | - echo "This PR is ready to merge." + if: | + github.ref == 'pull_request' && + contains(github.event.pull_request.labels.*.name,'ready to merge') + run: echo "This PR is ready to merge." From 834699d2eb74e13ece9b4bbc6612457340031cd4 Mon Sep 17 00:00:00 2001 From: Yaswant Pradhan Date: Thu, 23 Feb 2023 14:37:09 +0000 Subject: [PATCH 17/17] stick to original change --- .github/workflows/label.yml | 28 +++++++--------------------- 1 file changed, 7 insertions(+), 21 deletions(-) diff --git a/.github/workflows/label.yml b/.github/workflows/label.yml index 607e89ac..d83cdc52 100644 --- a/.github/workflows/label.yml +++ b/.github/workflows/label.yml @@ -2,35 +2,20 @@ name: Check Label on: - push: - branches: [feature/check_label] - pull_request: - branches: [feature/check_label] - # types: - # - opened - # - labeled - # - unlabeled - -# on: -# # push: -# # branches: [feature/check_label] -# pull_request: -# types: -# - opened -# - labeled -# - unlabeled + types: + - opened + - labeled + - unlabeled + - synchronized jobs: ready-to-merge: - # if: "!contains(github.event.pull_request.labels.*.name, 'ready to merge')" runs-on: ubuntu-latest steps: - name: Fail if PR is not labelled as ready to merge - if: | - github.ref == 'pull_request' && - !contains(github.event.pull_request.labels.*.name,'ready to merge') + if: "!contains(github.event.pull_request.labels.*.name,'ready to merge')" run: | echo "This PR is not yet ready to merge." exit 1 @@ -40,3 +25,4 @@ jobs: github.ref == 'pull_request' && contains(github.event.pull_request.labels.*.name,'ready to merge') run: echo "This PR is ready to merge." +