fix: replace use of any type

This commit is contained in:
Peter Evans
2022-10-21 15:10:59 +09:00
parent 1488116043
commit 3b9f4f25f0
2 changed files with 13 additions and 3 deletions

View File

@@ -4,6 +4,11 @@ import * as dockerhubHelper from './dockerhub-helper'
import * as fs from 'fs'
import {inspect} from 'util'
function getErrorMessage(error: unknown) {
if (error instanceof Error) return error.message
return String(error)
}
async function run(): Promise<void> {
try {
const inputs = inputHelper.getInputs()
@@ -31,9 +36,9 @@ async function run(): Promise<void> {
readmeContent
)
core.info('Request successful')
} catch (error: any) {
} catch (error) {
core.debug(inspect(error))
core.setFailed(error.message)
core.setFailed(getErrorMessage(error))
}
}