From ffb497310bf0dae2cd7a04e3a88381be3910ab1d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=2E=20Fatih=20C=C4=B1r=C4=B1t?= Date: Wed, 12 Jun 2024 18:13:07 +0300 Subject: [PATCH 1/4] feat(make-sure-label-is-present): new workflow MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: M. Fatih Cırıt result Signed-off-by: M. Fatih Cırıt fix var Signed-off-by: M. Fatih Cırıt toJson Signed-off-by: M. Fatih Cırıt if space, noJson Signed-off-by: M. Fatih Cırıt test test-label Signed-off-by: M. Fatih Cırıt test Signed-off-by: M. Fatih Cırıt test Signed-off-by: M. Fatih Cırıt as it is Signed-off-by: M. Fatih Cırıt --- .../workflows/make-sure-label-is-present.yaml | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 .github/workflows/make-sure-label-is-present.yaml diff --git a/.github/workflows/make-sure-label-is-present.yaml b/.github/workflows/make-sure-label-is-present.yaml new file mode 100644 index 00000000..d7305344 --- /dev/null +++ b/.github/workflows/make-sure-label-is-present.yaml @@ -0,0 +1,31 @@ +name: make-sure-label-is-present + +on: + workflow_call: + inputs: + label: + required: true + type: string + outputs: + result: + value: ${{ jobs.make-sure-label-is-present.outputs.result }} + +jobs: + make-sure-label-is-present: + runs-on: ubuntu-latest + outputs: + result: ${{ steps.make-sure-label-is-present.outputs.result }} + steps: + - name: Check if label is present + id: make-sure-label-is-present + if: contains(github.event.pull_request.labels.*.name, inputs.label) + run: | + echo "result=true" >> $GITHUB_OUTPUT + shell: bash + + - name: Skip if label is not present + if: steps.make-sure-label-is-present.outputs.result != 'true' + run: | + echo "Please add the label '${{ inputs.label }}' to run this workflow." + echo "result=false" >> $GITHUB_OUTPUT + shell: bash From 4b702ee3f147b32fd98485ee64c8c784aa59c444 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=2E=20Fatih=20C=C4=B1r=C4=B1t?= Date: Wed, 12 Jun 2024 18:44:22 +0300 Subject: [PATCH 2/4] check if input label is added MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: M. Fatih Cırıt --- .../workflows/make-sure-label-is-present.yaml | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/.github/workflows/make-sure-label-is-present.yaml b/.github/workflows/make-sure-label-is-present.yaml index d7305344..0e5bfe82 100644 --- a/.github/workflows/make-sure-label-is-present.yaml +++ b/.github/workflows/make-sure-label-is-present.yaml @@ -16,9 +16,25 @@ jobs: outputs: result: ${{ steps.make-sure-label-is-present.outputs.result }} steps: + - name: Check if new label is input label + id: check-if-new-label-is-input-label + if: github.event.label.name == inputs.label + run: | + echo "new_label_is_input_label=true" >> $GITHUB_OUTPUT + shell: bash + + - name: Skip if new label is not input label + if: steps.check-if-new-label-is-input-label.outputs.new_label_is_input_label != 'true' + run: | + echo "Skipping execution since a different label '${{ github.event.label.name }}' is added." + echo "result=false" >> $GITHUB_OUTPUT + shell: bash + - name: Check if label is present id: make-sure-label-is-present - if: contains(github.event.pull_request.labels.*.name, inputs.label) + if: | + (contains(github.event.pull_request.labels.*.name, inputs.label) && + steps.check-if-new-label-is-input-label.outputs.new_label_is_input_label == 'true') run: | echo "result=true" >> $GITHUB_OUTPUT shell: bash From 4c2a1c3b4d4fd27ac1fdfacc1b26f3a3b09261aa Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 12 Jun 2024 15:44:34 +0000 Subject: [PATCH 3/4] style(pre-commit): autofix --- .github/workflows/make-sure-label-is-present.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/make-sure-label-is-present.yaml b/.github/workflows/make-sure-label-is-present.yaml index 0e5bfe82..d2676e60 100644 --- a/.github/workflows/make-sure-label-is-present.yaml +++ b/.github/workflows/make-sure-label-is-present.yaml @@ -33,7 +33,7 @@ jobs: - name: Check if label is present id: make-sure-label-is-present if: | - (contains(github.event.pull_request.labels.*.name, inputs.label) && + (contains(github.event.pull_request.labels.*.name, inputs.label) && steps.check-if-new-label-is-input-label.outputs.new_label_is_input_label == 'true') run: | echo "result=true" >> $GITHUB_OUTPUT From e6eac32b045b6fd772b1cd8ead6f1fc609d6553e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=2E=20Fatih=20C=C4=B1r=C4=B1t?= Date: Thu, 13 Jun 2024 18:21:26 +0300 Subject: [PATCH 4/4] remove checks MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: M. Fatih Cırıt --- .../workflows/make-sure-label-is-present.yaml | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/.github/workflows/make-sure-label-is-present.yaml b/.github/workflows/make-sure-label-is-present.yaml index d2676e60..d7305344 100644 --- a/.github/workflows/make-sure-label-is-present.yaml +++ b/.github/workflows/make-sure-label-is-present.yaml @@ -16,25 +16,9 @@ jobs: outputs: result: ${{ steps.make-sure-label-is-present.outputs.result }} steps: - - name: Check if new label is input label - id: check-if-new-label-is-input-label - if: github.event.label.name == inputs.label - run: | - echo "new_label_is_input_label=true" >> $GITHUB_OUTPUT - shell: bash - - - name: Skip if new label is not input label - if: steps.check-if-new-label-is-input-label.outputs.new_label_is_input_label != 'true' - run: | - echo "Skipping execution since a different label '${{ github.event.label.name }}' is added." - echo "result=false" >> $GITHUB_OUTPUT - shell: bash - - name: Check if label is present id: make-sure-label-is-present - if: | - (contains(github.event.pull_request.labels.*.name, inputs.label) && - steps.check-if-new-label-is-input-label.outputs.new_label_is_input_label == 'true') + if: contains(github.event.pull_request.labels.*.name, inputs.label) run: | echo "result=true" >> $GITHUB_OUTPUT shell: bash