Skip to content

Commit

Permalink
DRY out use of core.setFailed
Browse files Browse the repository at this point in the history
  • Loading branch information
Barry Gordon committed Aug 25, 2021
1 parent 70d83e3 commit 4fb3a24
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,23 +49,20 @@ export async function run(context: Context): Promise<void> {
await ImageService.pull(UPDATER_IMAGE_NAME)
await ImageService.pull(PROXY_IMAGE_NAME)
} catch (error) {
failJob(apiClient, error, DependabotErrorType.Image)
core.setFailed(error.message)
await failJob(apiClient, error, DependabotErrorType.Image)
return
}

try {
await updater.runUpdater()
} catch (error) {
failJob(apiClient, error, DependabotErrorType.UpdateRun)
core.setFailed(error.message)
await failJob(apiClient, error, DependabotErrorType.UpdateRun)
return
}
core.info('🤖 ~fin~')
} catch (error) {
// Update Dependabot API on the job failure
failJob(apiClient, error)
core.setFailed(error.message)
await failJob(apiClient, error)
}
} catch (error) {
// If we've reached this point, we do not have a viable
Expand All @@ -87,6 +84,7 @@ async function failJob(
'error-detail': error.message
})
await apiClient.markJobAsProcessed()
core.setFailed(error.message)
}

run(github.context)

0 comments on commit 4fb3a24

Please sign in to comment.