From 15fc5c97a6cbd64872f109e7ed8f7c974792e88b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=2E=20Fatih=20C=C4=B1r=C4=B1t?= Date: Wed, 12 Jun 2024 16:56:31 +0300 Subject: [PATCH] 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 --- .../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..73168f7b --- /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: + run: + 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.run }} + steps: + - name: Check if label exists + 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: Fail the job + 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