These do not need to be async
This commit is contained in:
@@ -2,21 +2,18 @@ import * as core from '@actions/core';
|
|||||||
import * as fs from 'fs';
|
import * as fs from 'fs';
|
||||||
import * as path from 'path';
|
import * as path from 'path';
|
||||||
|
|
||||||
export async function findHaskellGHCVersion(
|
export function findHaskellGHCVersion(baseInstallDir: string, version: string) {
|
||||||
baseInstallDir: string,
|
|
||||||
version: string
|
|
||||||
) {
|
|
||||||
return _findHaskellToolVersion(baseInstallDir, 'ghc', version);
|
return _findHaskellToolVersion(baseInstallDir, 'ghc', version);
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function findHaskellCabalVersion(
|
export function findHaskellCabalVersion(
|
||||||
baseInstallDir: string,
|
baseInstallDir: string,
|
||||||
version: string
|
version: string
|
||||||
) {
|
) {
|
||||||
return _findHaskellToolVersion(baseInstallDir, 'cabal', version);
|
return _findHaskellToolVersion(baseInstallDir, 'cabal', version);
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function _findHaskellToolVersion(
|
export function _findHaskellToolVersion(
|
||||||
baseInstallDir: string,
|
baseInstallDir: string,
|
||||||
tool: string,
|
tool: string,
|
||||||
version: string
|
version: string
|
||||||
@@ -33,11 +30,10 @@ export async function _findHaskellToolVersion(
|
|||||||
|
|
||||||
const toolPath: string = path.join(baseInstallDir, tool, version, 'bin');
|
const toolPath: string = path.join(baseInstallDir, tool, version, 'bin');
|
||||||
throw new Error(`Looking in ${toolPath}`);
|
throw new Error(`Looking in ${toolPath}`);
|
||||||
|
// if (fs.existsSync(toolPath)) {
|
||||||
if (fs.existsSync(toolPath)) {
|
// core.debug(`Found tool in cache ${tool} ${version}`);
|
||||||
core.debug(`Found tool in cache ${tool} ${version}`);
|
// core.addPath(toolPath);
|
||||||
core.addPath(toolPath);
|
// } else {
|
||||||
} else {
|
// throw new Error(`Version ${version} of ${tool} not found`);
|
||||||
throw new Error(`Version ${version} of ${tool} not found`);
|
// }
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,13 +13,13 @@ async function run() {
|
|||||||
if (!ghcVersion) {
|
if (!ghcVersion) {
|
||||||
ghcVersion = defaultGHCVersion;
|
ghcVersion = defaultGHCVersion;
|
||||||
}
|
}
|
||||||
await findHaskellGHCVersion(baseInstallDir, ghcVersion);
|
findHaskellGHCVersion(baseInstallDir, ghcVersion);
|
||||||
|
|
||||||
let cabalVersion = core.getInput('cabal-version');
|
let cabalVersion = core.getInput('cabal-version');
|
||||||
if (!cabalVersion) {
|
if (!cabalVersion) {
|
||||||
cabalVersion = defaultCabalVersion;
|
cabalVersion = defaultCabalVersion;
|
||||||
}
|
}
|
||||||
await findHaskellCabalVersion(baseInstallDir, cabalVersion);
|
findHaskellCabalVersion(baseInstallDir, cabalVersion);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
core.setFailed(error.message);
|
core.setFailed(error.message);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user