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:
809
809
[ -f "$SONAR_SSL_FOLDER/truststore.p12" ] || exit 1
810
810
TRUSTSTORE_P12_MOD_TIME_T3=$(stat -c %Y "$SONAR_SSL_FOLDER/truststore.p12")
811
811
[ "$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 30
30
shell : bash
31
31
env :
32
32
INPUT_PROJECTBASEDIR : ${{ inputs.projectBaseDir }}
33
+ INPUT_SCANNERVERSION : ${{ inputs.scannerVersion }}
33
34
- name : Load Sonar Scanner CLI from cache
34
35
id : sonar-scanner-cli
35
36
uses : actions/cache@v4
Original file line number Diff line number Diff line change 2
2
3
3
set -eo pipefail
4
4
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
+
5
10
if [[ -z " ${SONAR_TOKEN} " ]]; then
6
11
echo " ::warning title=SonarScanner::Running this GitHub Action without SONAR_TOKEN is not recommended"
7
12
fi
You can’t perform that action at this time.
0 commit comments