From 97ec57e667fef0360e8fca48b61012d218452971 Mon Sep 17 00:00:00 2001 From: HyukjinKwon Date: Wed, 21 Apr 2021 13:32:04 +0800 Subject: [PATCH] [SPARK-35120][INFRA][FOLLOW-UP] Try catch an error to show the correct 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 https://github.com/HyukjinKwon/spark/pull/48. See https://github.com/HyukjinKwon/spark/runs/2391469416 as an example. Closes #32258 from HyukjinKwon/SPARK-35120-followup. Authored-by: HyukjinKwon Signed-off-by: Gengliang Wang --- .github/workflows/notify_test_workflow.yml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/.github/workflows/notify_test_workflow.yml b/.github/workflows/notify_test_workflow.yml index 0b725dc18cbf0..cc2b7a254e3f5 100644 --- a/.github/workflows/notify_test_workflow.yml +++ b/.github/workflows/notify_test_workflow.yml @@ -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'