File tree Expand file tree Collapse file tree 3 files changed +29
-0
lines changed Expand file tree Collapse file tree 3 files changed +29
-0
lines changed Original file line number Diff line number Diff line change @@ -809,3 +809,26 @@ jobs:
809809 [ -f "$SONAR_SSL_FOLDER/truststore.p12" ] || exit 1
810810 TRUSTSTORE_P12_MOD_TIME_T3=$(stat -c %Y "$SONAR_SSL_FOLDER/truststore.p12")
811811 [ "$TRUSTSTORE_P12_MOD_TIME_T2" != "$TRUSTSTORE_P12_MOD_TIME_T3" ] || exit 1
812+ scannerVersionValidationTest :
813+ name : >
814+ 'scannerVersion' input validation
815+ runs-on : ubuntu-latest
816+ steps :
817+ - uses : actions/checkout@v4
818+ with :
819+ token : ${{ secrets.GITHUB_TOKEN }}
820+ - name : Run action with invalid scannerVersion
821+ id : invalid_version
822+ uses : ./
823+ continue-on-error : true
824+ with :
825+ scannerVersion : " 7.1.0-SNAPSHOT"
826+ args : -Dsonar.scanner.internal.dumpToFile=./output.properties
827+ env :
828+ NO_CACHE : true
829+ SONAR_HOST_URL : http://not_actually_used
830+ - name : Assert failure of previous step
831+ if : steps.invalid_version.outcome == 'success'
832+ run : |
833+ echo "Action with invalid scannerVersion should have failed but succeeded"
834+ exit 1
Original file line number Diff line number Diff line change 3030 shell : bash
3131 env :
3232 INPUT_PROJECTBASEDIR : ${{ inputs.projectBaseDir }}
33+ INPUT_SCANNERVERSION : ${{ inputs.scannerVersion }}
3334 - name : Load Sonar Scanner CLI from cache
3435 id : sonar-scanner-cli
3536 uses : actions/cache@v4
Original file line number Diff line number Diff line change 22
33set -eo pipefail
44
5+ if [[ ! " ${INPUT_SCANNERVERSION} " =~ ^[0-9]+\. [0-9]+\. [0-9]+\. [0-9]+$ ]]; then
6+ echo " ::error title=SonarScanner::Invalid scannerVersion format. Expected format: x.y.z.w (e.g., 7.1.0.4889)"
7+ exit 1
8+ fi
9+
510if [[ -z " ${SONAR_TOKEN} " ]]; then
611 echo " ::warning title=SonarScanner::Running this GitHub Action without SONAR_TOKEN is not recommended"
712fi
You can’t perform that action at this time.
0 commit comments