| 8336 | return this.script; |
| 8337 | } |
| 8338 | checkModuleVersionScript(moduleName, version) { |
| 8339 | const command = `Get-Module -Name ${moduleName} -ListAvailable | Where-Object Version -match ${version}`; |
| 8340 | this.script += `try { |
| 8341 | $ErrorActionPreference = "Stop" |
| 8342 | $WarningPreference = "SilentlyContinue" |
| 8343 | $output = @{} |
| 8344 | $data = ${command} |
| 8345 | $output['${Constants_1.default.versionExists}'] = [string]::IsNullOrEmpty($data) |
| 8346 | $output['${Constants_1.default.Success}'] = "true" |
| 8347 | } |
| 8348 | catch { |
| 8349 | $output['${Constants_1.default.Error}'] = $_.exception.Message |
| 8350 | } |
| 8351 | return ConvertTo-Json $output`; |
| 8352 | core.debug(`CheckModuleVersionScript: ${this.script}`); |
| 8353 | return this.script; |
| 8354 | } |
| 8355 | getInlineScriptFile(inlineScript, errorActionPreference) { |
| 8356 | this.script = `$ErrorActionPreference = '${errorActionPreference}'${os.EOL}${inlineScript}`; |
| 8357 | core.debug(`InlineScript file to be executed: ${this.script}`); |