From f0f2a6c11fb6a7819c0a57b59b2e713d8fea493b Mon Sep 17 00:00:00 2001 From: hedger Date: Tue, 12 Sep 2023 12:24:44 +0300 Subject: [PATCH] github: typo fix (#3070) * github: typo fix * github: sdk action: added validation for action inputs * github: sdk action: 10+ rcs --- .github/actions/submit_sdk/action.yml | 29 ++++++++++++++++++++++++--- .github/workflows/build.yml | 2 +- 2 files changed, 27 insertions(+), 4 deletions(-) diff --git a/.github/actions/submit_sdk/action.yml b/.github/actions/submit_sdk/action.yml index 5de5d3d8..269185d5 100644 --- a/.github/actions/submit_sdk/action.yml +++ b/.github/actions/submit_sdk/action.yml @@ -5,10 +5,10 @@ description: | inputs: catalog-url: - description: The URL of the Catalog API + description: The URL of the Catalog API. Must not be empty or end with a /. required: true catalog-api-token: - description: The token to use to authenticate with the Catalog API + description: The token to use to authenticate with the Catalog API. Must not be empty. required: true firmware-api: description: Fimware's API version, major.minor @@ -17,12 +17,35 @@ inputs: description: Firmware's target, e.g. f7/f18 required: true firmware-version: - description: Firmware's version, e.g. 0.13.37-rc3 + description: Firmware's version, e.g. 0.13.37-rc3, or 0.13.37 required: true runs: using: composite steps: + - name: Check inputs + shell: bash + run: | + if [ -z "${{ inputs.catalog-url }}" ] ; then + echo "Invalid catalog-url: ${{ inputs.catalog-url }}" + exit 1 + fi + if [ -z "${{ inputs.catalog-api-token }}" ] ; then + echo "Invalid catalog-api-token: ${{ inputs.catalog-api-token }}" + exit 1 + fi + if ! echo "${{ inputs.firmware-api }}" | grep -q "^[0-9]\+\.[0-9]\+$" ; then + echo "Invalid firmware-api: ${{ inputs.firmware-api }}" + exit 1 + fi + if ! echo "${{ inputs.firmware-target }}" | grep -q "^f[0-9]\+$" ; then + echo "Invalid firmware-target: ${{ inputs.firmware-target }}" + exit 1 + fi + if ! echo "${{ inputs.firmware-version }}" | grep -q "^[0-9]\+\.[0-9]\+\.[0-9]\+\(-rc\)\?\([0-9]\+\)\?$" ; then + echo "Invalid firmware-version: ${{ inputs.firmware-version }}" + exit 1 + fi - name: Submit SDK shell: bash run: | diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 84e89059..7a718883 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -165,5 +165,5 @@ jobs: catalog-url: ${{ secrets.CATALOG_URL }} catalog-api-token: ${{ secrets.CATALOG_API_TOKEN }} firmware-api: ${{ steps.build-fw.outputs.firmware_api }} - firwmare-target: ${{ matrix.target }} + firmware-target: ${{ matrix.target }} firmware-version: ${{ steps.names.outputs.suffix }}