mirror of
https://gitea.com/actions/checkout.git
synced 2025-04-06 15:29:41 +00:00
update dev dependencies and react to new linting rules (#611)
This commit is contained in:
@ -9,7 +9,7 @@ export function directoryExistsSync(path: string, required?: boolean): boolean {
|
||||
try {
|
||||
stats = fs.statSync(path)
|
||||
} catch (error) {
|
||||
if (error.code === 'ENOENT') {
|
||||
if ((error as any)?.code === 'ENOENT') {
|
||||
if (!required) {
|
||||
return false
|
||||
}
|
||||
@ -18,7 +18,8 @@ export function directoryExistsSync(path: string, required?: boolean): boolean {
|
||||
}
|
||||
|
||||
throw new Error(
|
||||
`Encountered an error when checking whether path '${path}' exists: ${error.message}`
|
||||
`Encountered an error when checking whether path '${path}' exists: ${(error as any)
|
||||
?.message ?? error}`
|
||||
)
|
||||
}
|
||||
|
||||
@ -39,12 +40,13 @@ export function existsSync(path: string): boolean {
|
||||
try {
|
||||
fs.statSync(path)
|
||||
} catch (error) {
|
||||
if (error.code === 'ENOENT') {
|
||||
if ((error as any)?.code === 'ENOENT') {
|
||||
return false
|
||||
}
|
||||
|
||||
throw new Error(
|
||||
`Encountered an error when checking whether path '${path}' exists: ${error.message}`
|
||||
`Encountered an error when checking whether path '${path}' exists: ${(error as any)
|
||||
?.message ?? error}`
|
||||
)
|
||||
}
|
||||
|
||||
@ -60,12 +62,13 @@ export function fileExistsSync(path: string): boolean {
|
||||
try {
|
||||
stats = fs.statSync(path)
|
||||
} catch (error) {
|
||||
if (error.code === 'ENOENT') {
|
||||
if ((error as any)?.code === 'ENOENT') {
|
||||
return false
|
||||
}
|
||||
|
||||
throw new Error(
|
||||
`Encountered an error when checking whether path '${path}' exists: ${error.message}`
|
||||
`Encountered an error when checking whether path '${path}' exists: ${(error as any)
|
||||
?.message ?? error}`
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -94,7 +94,7 @@ class GitAuthHelper {
|
||||
await fs.promises.stat(gitConfigPath)
|
||||
configExists = true
|
||||
} catch (err) {
|
||||
if (err.code !== 'ENOENT') {
|
||||
if ((err as any)?.code !== 'ENOENT') {
|
||||
throw err
|
||||
}
|
||||
}
|
||||
@ -213,7 +213,7 @@ class GitAuthHelper {
|
||||
await fs.promises.readFile(userKnownHostsPath)
|
||||
).toString()
|
||||
} catch (err) {
|
||||
if (err.code !== 'ENOENT') {
|
||||
if ((err as any)?.code !== 'ENOENT') {
|
||||
throw err
|
||||
}
|
||||
}
|
||||
@ -302,7 +302,7 @@ class GitAuthHelper {
|
||||
try {
|
||||
await io.rmRF(keyPath)
|
||||
} catch (err) {
|
||||
core.debug(err.message)
|
||||
core.debug(`${(err as any)?.message ?? err}`)
|
||||
core.warning(`Failed to remove SSH key '${keyPath}'`)
|
||||
}
|
||||
}
|
||||
|
@ -39,7 +39,9 @@ export async function prepareExistingDirectory(
|
||||
try {
|
||||
await io.rmRF(lockPath)
|
||||
} catch (error) {
|
||||
core.debug(`Unable to delete '${lockPath}'. ${error.message}`)
|
||||
core.debug(
|
||||
`Unable to delete '${lockPath}'. ${(error as any)?.message ?? error}`
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -92,7 +92,10 @@ export async function getDefaultBranch(
|
||||
assert.ok(result, 'default_branch cannot be empty')
|
||||
} catch (err) {
|
||||
// Handle .wiki repo
|
||||
if (err['status'] === 404 && repo.toUpperCase().endsWith('.WIKI')) {
|
||||
if (
|
||||
(err as any)?.status === 404 &&
|
||||
repo.toUpperCase().endsWith('.WIKI')
|
||||
) {
|
||||
result = 'master'
|
||||
}
|
||||
// Otherwise error
|
||||
|
@ -24,7 +24,7 @@ async function run(): Promise<void> {
|
||||
coreCommand.issueCommand('remove-matcher', {owner: 'checkout-git'}, '')
|
||||
}
|
||||
} catch (error) {
|
||||
core.setFailed(error.message)
|
||||
core.setFailed(`${(error as any)?.message ?? error}`)
|
||||
}
|
||||
}
|
||||
|
||||
@ -32,7 +32,7 @@ async function cleanup(): Promise<void> {
|
||||
try {
|
||||
await gitSourceProvider.cleanup(stateHelper.RepositoryPath)
|
||||
} catch (error) {
|
||||
core.warning(error.message)
|
||||
core.warning(`${(error as any)?.message ?? error}`)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -10,10 +10,10 @@ import * as yaml from 'js-yaml'
|
||||
|
||||
function updateUsage(
|
||||
actionReference: string,
|
||||
actionYamlPath: string = 'action.yml',
|
||||
readmePath: string = 'README.md',
|
||||
startToken: string = '<!-- start usage -->',
|
||||
endToken: string = '<!-- end usage -->'
|
||||
actionYamlPath = 'action.yml',
|
||||
readmePath = 'README.md',
|
||||
startToken = '<!-- start usage -->',
|
||||
endToken = '<!-- end usage -->'
|
||||
): void {
|
||||
if (!actionReference) {
|
||||
throw new Error('Parameter actionReference must not be empty')
|
||||
|
@ -253,7 +253,9 @@ export async function checkCommitInfo(
|
||||
await octokit.repos.get({owner: repositoryOwner, repo: repositoryName})
|
||||
}
|
||||
} catch (err) {
|
||||
core.debug(`Error when validating commit info: ${err.stack}`)
|
||||
core.debug(
|
||||
`Error when validating commit info: ${(err as any)?.stack ?? err}`
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -29,7 +29,7 @@ export class RetryHelper {
|
||||
try {
|
||||
return await action()
|
||||
} catch (err) {
|
||||
core.info(err.message)
|
||||
core.info((err as any)?.message)
|
||||
}
|
||||
|
||||
// Sleep
|
||||
|
Reference in New Issue
Block a user