From 5d71fd3a1beab42c1983dbd38891c4f8ec27436d Mon Sep 17 00:00:00 2001 From: Codefarmer Date: Fri, 8 Nov 2024 09:21:26 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=92=9A=20Ci:=20validate=20inputes?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/conferenceapp.yaml | 30 +++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/.github/workflows/conferenceapp.yaml b/.github/workflows/conferenceapp.yaml index 440f66b..6afa73f 100644 --- a/.github/workflows/conferenceapp.yaml +++ b/.github/workflows/conferenceapp.yaml @@ -19,16 +19,16 @@ on: changelog: description: 'Changelog for this release' - required: true + required: false build-version: description: 'Version number for the release' - required: ${{ github.event.inputs.release-type == 'build' }} + required: false default: '' type: string build-number: - required: ${{ github.event.inputs.release-type == 'build' }} + required: false default: '' type: string @@ -36,6 +36,30 @@ env: SHOREBIRD_TOKEN: ${{ secrets.SHOREBIRD_TOKEN }} jobs: + + validate-inputs: + runs-on: ubuntu-latest + steps: + - name: Validate Inputs + run: | + if [[ "${{ github.event.inputs.release-type }}" == "build" ]]; then + if [[ -z "${{ github.event.inputs.build-version }}" ]]; then + echo "Error: build-version is required for a build release." + exit 1 + fi + if [[ -z "${{ github.event.inputs.build-number }}" ]]; then + echo "Error: build-number is required for a build release." + exit 1 + fi + if [[ -z "${{ github.event.inputs.changelog }}" ]]; then + echo "Error: changelog is required for a build release." + exit 1 + fi + fi + if [[ "${{ github.event.inputs.release-type }}" == "patch" ]]; then + echo "Patch release selected. Skipping build-version and build-number validation." + fi + check-formatting: if: github.event_name == 'pull_request' uses: ./.github/workflows/shared-workflow.yaml