79332797

Date: 2025-01-06 10:54:50
Score: 2
Natty:
Report link

you are using an powershell task, might just read the file and then filter the line by key name?

- task: PowerShell@2
    displayName: Run gradle sonar
    inputs:
        targetType: 'inline'
        pwsh: true
        workingDirectory: ${{ parameters.workingDirectory }}
        script: |
            $searchText = "VERSION_CODE"
            $filteredLine = Get-Content -Path 'gradle.properties' | Select-String -Pattern $searchText
                
            if ($filteredLine) {
                $splitLine = $filteredLine -split '='
                $version = $splitLine[1].Trim()
                $version
            }
            $GRADLE_COMMAND = "./gradlew sonar"
            $GRADLE_COMMAND += " ""-Dsonar.projectVersion=$(version)"""
Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Ends in question mark (2):
  • Low reputation (1):
Posted by: qkfang