This is an automated email from the ASF dual-hosted git repository.
gurwls223 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/spark.git
The following commit(s) were added to refs/heads/master by this push:
new bfcc5e0135a0 [SPARK-46811][INFRA] Fix Github Action: TypeError: Cannot
read properties of undefined (reading 'head_sha')
bfcc5e0135a0 is described below
commit bfcc5e0135a05b0eb6dd7f095b79bc162d9cce46
Author: Kent Yao <[email protected]>
AuthorDate: Wed Jan 24 11:33:32 2024 +0900
[SPARK-46811][INFRA] Fix Github Action: TypeError: Cannot read properties
of undefined (reading 'head_sha')
### What changes were proposed in this pull request?
This PR adds a retry for detecting the `Check changes` job and a check for
whether it is initialized or not to avoid `TypeError `
### Why are the changes needed?
`Notify test workflow` fails at a high rate
### Does this PR introduce _any_ user-facing change?
no
### How was this patch tested?
An example PR:
https://github.com/yaooqinn/spark/actions/runs/7624423347/job/20766523539?pr=3
### Was this patch authored or co-authored using generative AI tooling?
no
Closes #44850 from yaooqinn/SPARK-46811.
Authored-by: Kent Yao <[email protected]>
Signed-off-by: Hyukjin Kwon <[email protected]>
---
.github/workflows/notify_test_workflow.yml | 20 ++++++++++++++++++--
1 file changed, 18 insertions(+), 2 deletions(-)
diff --git a/.github/workflows/notify_test_workflow.yml
b/.github/workflows/notify_test_workflow.yml
index 5a7a28bcc3ae..e99bbbfc2dc1 100644
--- a/.github/workflows/notify_test_workflow.yml
+++ b/.github/workflows/notify_test_workflow.yml
@@ -115,8 +115,22 @@ jobs:
}
// Here we get check run ID to provide Check run view instead of
Actions view, see also SPARK-37879.
- const check_runs = await github.request(check_run_endpoint,
check_run_params)
- const check_run_head = check_runs.data.check_runs.filter(r =>
r.name === "Run / Check changes")[0]
+ let retryCount = 0;
+ let check_run_head;
+ while (retryCount < 3) {
+ const check_runs = await github.request(check_run_endpoint,
check_run_params);
+ check_run_head = check_runs.data.check_runs.find(r => r.name
=== "Run / Check changes");
+ if (check_run_head) {
+ break;
+ }
+ retryCount++;
+ if (retryCount < 3) {
+ await new Promise(resolve => setTimeout(resolve, 3000));
+ }
+ }
+ if (!check_run_head) {
+ throw new Error('Failed to retrieve check_run_head after 3
attempts');
+ }
if (check_run_head.head_sha !=
context.payload.pull_request.head.sha) {
throw new Error('There was a new unsynced commit pushed.
Please retrigger the workflow.');
@@ -126,11 +140,13 @@ jobs:
+ context.payload.pull_request.head.repo.full_name
+ '/runs/'
+ check_run_head.id
+ console.log('Check run URL: ' + check_run_url)
const actions_url = 'https://github.com/'
+ context.payload.pull_request.head.repo.full_name
+ '/actions/runs/'
+ run_id
+ console.log('Actions URL: ' + actions_url)
github.rest.checks.create({
owner: context.repo.owner,
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]