Skip to content

Commit

Permalink
Skip rate-limit metrics if GitHub API returned error (#1239)
Browse files Browse the repository at this point in the history
  • Loading branch information
int128 authored Sep 22, 2024
1 parent d5a7fdd commit a9931f8
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,12 @@ export const run = async (context: GitHubContext, inputs: Inputs): Promise<void>

await handleEvent(metricsClient, context, inputs)

const rateLimit = await getRateLimitMetrics(context, inputs)
await metricsClient.submitMetrics(rateLimit, 'rate limit')
const rateLimit = await getRateLimitMetrics(context, inputs).catch((e) => {
core.warning(`Rate-limit metrics are not available: ${e}`)
})
if (rateLimit) {
await metricsClient.submitMetrics(rateLimit, 'rate-limit')
}
}

const handleEvent = async (metricsClient: MetricsClient, context: GitHubContext, inputs: Inputs) => {
Expand Down

0 comments on commit a9931f8

Please sign in to comment.