Skip to content

Commit

Permalink
[SPARK-35120][INFRA][FOLLOW-UP] Try catch an error to show the correc…
Browse files Browse the repository at this point in the history
…t guidance

### What changes were proposed in this pull request?

This PR proposes to handle 404 not found, see https://github.com/apache/spark/pull/32255/checks?check_run_id=2390446579 as an example.

If a fork does not have any previous workflow runs, it seems throwing 404 error instead of empty runs.

### Why are the changes needed?

To show the correct guidance to contributors.

### Does this PR introduce _any_ user-facing change?

No, dev-only.

### How was this patch tested?

Manually tested at HyukjinKwon#48. See https://github.com/HyukjinKwon/spark/runs/2391469416 as an example.

Closes #32258 from HyukjinKwon/SPARK-35120-followup.

Authored-by: HyukjinKwon <[email protected]>
Signed-off-by: Gengliang Wang <[email protected]>
  • Loading branch information
HyukjinKwon authored and gengliangwang committed Apr 21, 2021
1 parent d259f93 commit 97ec57e
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions .github/workflows/notify_test_workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,19 @@ jobs:
// Wait 3 seconds to make sure the fork repository triggered a workflow.
await new Promise(r => setTimeout(r, 3000))
const runs = await github.request(endpoint, params)
let runs
try {
runs = await github.request(endpoint, params)
} catch (error) {
console.error(error)
// Assume that runs were not found.
}
const name = 'Build and test'
const head_sha = context.payload.pull_request.head.sha
let status = 'queued'
if (runs.data.workflow_runs.length === 0) {
if (!runs || runs.data.workflow_runs.length === 0) {
status = 'completed'
const conclusion = 'action_required'
Expand Down

0 comments on commit 97ec57e

Please sign in to comment.