diff --git a/.github/workflows/qa-main.yml b/.github/workflows/qa-main.yml index b8ce7c4..6591347 100644 --- a/.github/workflows/qa-main.yml +++ b/.github/workflows/qa-main.yml @@ -808,38 +808,4 @@ jobs: run: | [ -f "$SONAR_SSL_FOLDER/truststore.p12" ] || exit 1 TRUSTSTORE_P12_MOD_TIME_T3=$(stat -c %Y "$SONAR_SSL_FOLDER/truststore.p12") - [ "$TRUSTSTORE_P12_MOD_TIME_T2" != "$TRUSTSTORE_P12_MOD_TIME_T3" ] || exit 1 - scannerVersionValidationTest: - name: > - 'scannerVersion' input validation - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - with: - token: ${{ secrets.GITHUB_TOKEN }} - - name: Run action with invalid scannerVersion - id: invalid_version - uses: ./ - continue-on-error: true - with: - scannerVersion: "7.1.0-SNAPSHOT" - args: -Dsonar.scanner.internal.dumpToFile=./output.properties - env: - NO_CACHE: true - SONAR_HOST_URL: http://not_actually_used - - name: Assert failure of previous step - if: steps.invalid_version.outcome == 'success' - run: | - echo "Action with invalid scannerVersion should have failed but succeeded" - exit 1 - - name: Run action with valid scannerVersion - uses: ./ - with: - scannerVersion: "7.1.0.4889" - args: -Dsonar.scanner.internal.dumpToFile=./output.properties - env: - NO_CACHE: true - SONAR_HOST_URL: http://not_actually_used - - name: Assert - run: | - ./test/assertFileExists ./output.properties \ No newline at end of file + [ "$TRUSTSTORE_P12_MOD_TIME_T2" != "$TRUSTSTORE_P12_MOD_TIME_T3" ] || exit 1 \ No newline at end of file diff --git a/action.yml b/action.yml index 2ba0299..fe4ac90 100644 --- a/action.yml +++ b/action.yml @@ -25,14 +25,6 @@ inputs: runs: using: "composite" steps: - - name: Validate Scanner Version input - run: | - SCANNER_VERSION="${{ inputs.scannerVersion }}" - if [[ ! "$SCANNER_VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$ ]]; then - echo "ERROR: Invalid scannerVersion format. Expected format: x.y.z.w (e.g., 7.1.0.4889)" - exit 1 - fi - shell: bash - name: Sanity checks run: ${GITHUB_ACTION_PATH}/scripts/sanity-checks.sh shell: bash diff --git a/scripts/sanity-checks.sh b/scripts/sanity-checks.sh index 6fd8b97..c3b706b 100755 --- a/scripts/sanity-checks.sh +++ b/scripts/sanity-checks.sh @@ -2,6 +2,11 @@ set -eo pipefail +if [[ ! "${INPUT_SCANNERVERSION}" =~ ^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$ ]]; then + echo "::error title=SonarScanner::Invalid scannerVersion format. Expected format: x.y.z.w (e.g., 7.1.0.4889)" + exit 1 +fi + if [[ -z "${SONAR_TOKEN}" ]]; then echo "::warning title=SonarScanner::Running this GitHub Action without SONAR_TOKEN is not recommended" fi