Refactor code
This commit is contained in:
parent
cf1d9cb755
commit
1a2e6296c5
|
@ -447,7 +447,7 @@ function run() {
|
|||
}
|
||||
if (versions.length) {
|
||||
const quality = core.getInput('dotnet-quality');
|
||||
if (quality && !qualityOptions.includes(quality)) {
|
||||
if (!qualityOptions.includes(quality)) {
|
||||
throw new Error(`${quality} is not a supported value for 'dotnet-quality' option. Supported values are: daily, signed, validated, preview, ga.`);
|
||||
}
|
||||
let dotnetInstaller;
|
||||
|
|
|
@ -7,6 +7,7 @@ import {chmodSync} from 'fs';
|
|||
import path from 'path';
|
||||
import semver from 'semver';
|
||||
import {IS_LINUX, IS_WINDOWS} from './utils';
|
||||
import {QualityOptions} from './setup-dotnet';
|
||||
|
||||
export interface DotnetVersion {
|
||||
type: string;
|
||||
|
@ -111,7 +112,7 @@ export class DotnetVersionResolver {
|
|||
|
||||
export class DotnetCoreInstaller {
|
||||
private version: string;
|
||||
private quality: string;
|
||||
private quality: QualityOptions;
|
||||
private static readonly installationDirectoryWindows = path.join(
|
||||
process.env['PROGRAMFILES'] + '',
|
||||
'dotnet'
|
||||
|
@ -146,7 +147,7 @@ export class DotnetCoreInstaller {
|
|||
}
|
||||
}
|
||||
|
||||
constructor(version: string, quality: string) {
|
||||
constructor(version: string, quality: QualityOptions) {
|
||||
this.version = version;
|
||||
this.quality = quality;
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ const qualityOptions = [
|
|||
'ga'
|
||||
] as const;
|
||||
|
||||
type QualityOptions = typeof qualityOptions[number];
|
||||
export type QualityOptions = typeof qualityOptions[number];
|
||||
|
||||
export async function run() {
|
||||
try {
|
||||
|
@ -50,7 +50,7 @@ export async function run() {
|
|||
if (versions.length) {
|
||||
const quality = core.getInput('dotnet-quality') as QualityOptions;
|
||||
|
||||
if (quality && !qualityOptions.includes(quality)) {
|
||||
if (!qualityOptions.includes(quality)) {
|
||||
throw new Error(
|
||||
`${quality} is not a supported value for 'dotnet-quality' option. Supported values are: daily, signed, validated, preview, ga.`
|
||||
);
|
||||
|
|
Loading…
Reference in New Issue