fix: set error types to any

This commit is contained in:
Peter Evans 2021-09-02 13:59:30 +09:00
parent 3e21ec0c82
commit 3263596ac4
7 changed files with 67 additions and 25 deletions

View file

@ -58,7 +58,7 @@ describe('utils tests', () => {
utils.getRemoteDetail(remoteUrl)
// Fail the test if an error wasn't thrown
expect(true).toEqual(false)
} catch (e) {
} catch (e: any) {
expect(e.message).toEqual(
`The format of '${remoteUrl}' is not a valid GitHub repository URL`
)
@ -104,7 +104,7 @@ describe('utils tests', () => {
utils.parseDisplayNameEmail(displayNameEmail1)
// Fail the test if an error wasn't thrown
expect(true).toEqual(false)
} catch (e) {
} catch (e: any) {
expect(e.message).toEqual(
`The format of '${displayNameEmail1}' is not a valid email address with display name`
)
@ -115,7 +115,7 @@ describe('utils tests', () => {
utils.parseDisplayNameEmail(displayNameEmail2)
// Fail the test if an error wasn't thrown
expect(true).toEqual(false)
} catch (e) {
} catch (e: any) {
expect(e.message).toEqual(
`The format of '${displayNameEmail2}' is not a valid email address with display name`
)

74
dist/index.js vendored

File diff suppressed because one or more lines are too long

View file

@ -237,7 +237,7 @@ export async function createPullRequest(inputs: Inputs): Promise<void> {
}
}
}
} catch (error) {
} catch (error: any) {
core.setFailed(error.message)
} finally {
// Remove auth and restore persisted auth config if it existed

View file

@ -33,7 +33,7 @@ export class GitAuthHelper {
try {
await this.setExtraheaderConfig(this.persistedExtraheaderConfigValue)
core.info('Persisted git credentials restored')
} catch (e) {
} catch (e: any) {
core.warning(e)
}
}

View file

@ -60,7 +60,7 @@ export class GitHubHelper {
html_url: pull.html_url,
created: true
}
} catch (e) {
} catch (e: any) {
if (
e.message &&
e.message.includes(`A pull request already exists for ${headBranch}`)
@ -165,7 +165,7 @@ export class GitHubHelper {
pull_number: pull.number,
...requestReviewersParams
})
} catch (e) {
} catch (e: any) {
if (e.message && e.message.includes(ERROR_PR_REVIEW_FROM_AUTHOR)) {
core.warning(ERROR_PR_REVIEW_FROM_AUTHOR)
} else {

View file

@ -29,7 +29,7 @@ async function run(): Promise<void> {
core.debug(`Inputs: ${inspect(inputs)}`)
await createPullRequest(inputs)
} catch (error) {
} catch (error: any) {
core.setFailed(error.message)
}
}

View file

@ -134,7 +134,7 @@ export function fileExistsSync(path: string): boolean {
let stats: fs.Stats
try {
stats = fs.statSync(path)
} catch (error) {
} catch (error: any) {
if (error.code === 'ENOENT') {
return false
}