Fix review points

This commit is contained in:
IvanZosimov 2022-09-20 10:27:47 +02:00
parent c32f58ecce
commit 5719647987
3 changed files with 7 additions and 11 deletions

View File

@ -26,3 +26,4 @@ jobs:
with:
source-tag: ${{ env.TAG_NAME }}
slack-webhook: ${{ secrets.SLACK_WEBHOOK }}

8
dist/index.js vendored
View File

@ -212,7 +212,7 @@ class DotnetVersionResolver {
}
resolveVersionInput() {
return __awaiter(this, void 0, void 0, function* () {
if (!this.isValidVersion(this.inputVersion)) {
if (!semver_1.default.validRange(this.inputVersion)) {
throw new Error(`'dotnet-version' was supplied in invalid format: ${this.inputVersion}! Supported syntax: A.B.C, A.B, A.B.x, A, A.x`);
}
if (semver_1.default.valid(this.inputVersion)) {
@ -238,9 +238,6 @@ class DotnetVersionResolver {
}
});
}
isValidVersion(version) {
return semver_1.default.valid(version) || semver_1.default.validRange(version) ? true : false;
}
isNumericTag(versionTag) {
return /^\d+$/.test(versionTag);
}
@ -358,7 +355,8 @@ class DotnetCoreInstaller {
}
scriptArguments.push(`-InstallDir '${DotnetCoreInstaller.installationDirectoryWindows}'`);
// process.env must be explicitly passed in for DOTNET_INSTALL_DIR to be used
scriptPath = yield io.which('powershell', true);
scriptPath =
(yield io.which('powershell', false)) || (yield io.which('pwsh', true));
scriptArguments = [...windowsDefaultOptions, scriptArguments.join(' ')];
}
else {

View File

@ -42,7 +42,7 @@ export class DotnetVersionResolver {
}
private async resolveVersionInput(): Promise<void> {
if (!this.isValidVersion(this.inputVersion)) {
if (!semver.validRange(this.inputVersion)) {
throw new Error(
`'dotnet-version' was supplied in invalid format: ${this.inputVersion}! Supported syntax: A.B.C, A.B, A.B.x, A, A.x`
);
@ -72,10 +72,6 @@ export class DotnetVersionResolver {
}
}
private isValidVersion(version) {
return semver.valid(version) || semver.validRange(version) ? true : false;
}
private isNumericTag(versionTag): Boolean {
return /^\d+$/.test(versionTag);
}
@ -237,7 +233,8 @@ export class DotnetCoreInstaller {
`-InstallDir '${DotnetCoreInstaller.installationDirectoryWindows}'`
);
// process.env must be explicitly passed in for DOTNET_INSTALL_DIR to be used
scriptPath = await io.which('powershell', true);
scriptPath =
(await io.which('powershell', false)) || (await io.which('pwsh', true));
scriptArguments = [...windowsDefaultOptions, scriptArguments.join(' ')];
} else {
chmodSync(escapedScript, '777');