This is an automated email from the ASF dual-hosted git repository.

codope pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hudi.git


The following commit(s) were added to refs/heads/master by this push:
     new 0d5bcba1fc3 [MINOR] Fix Azure CI status check to consider multiple 
runs on the same commit (#11980)
0d5bcba1fc3 is described below

commit 0d5bcba1fc3f1a4b7b54cd43cf715f5eab187a62
Author: Y Ethan Guo <[email protected]>
AuthorDate: Fri Sep 20 21:27:08 2024 -0700

    [MINOR] Fix Azure CI status check to consider multiple runs on the same 
commit (#11980)
---
 .github/workflows/azure_ci.js | 29 ++++++++++++++++++++---------
 1 file changed, 20 insertions(+), 9 deletions(-)

diff --git a/.github/workflows/azure_ci.js b/.github/workflows/azure_ci.js
index 737b8db9917..f95213f5447 100644
--- a/.github/workflows/azure_ci.js
+++ b/.github/workflows/azure_ci.js
@@ -40,16 +40,27 @@ async function checkAzureCiAndCreateCommitStatus({ github, 
context, prNumber, la
   if (botComments.length > 0) {
     const lastComment = botComments[0];
     const reportPrefix = `${latestCommitHash} Azure: `
-    const successReportString = `${reportPrefix}[SUCCESS]`
-    const failureReportString = `${reportPrefix}[FAILURE]`
+    const successReportString = `[SUCCESS]`
+    const failureReportString = `[FAILURE]`
+    let entries = lastComment.body.split("*")
 
-    if (lastComment.body.includes(reportPrefix)) {
-      if (lastComment.body.includes(successReportString)) {
-        message = 'Successful on the latest commit';
-        status = 'success';
-      } else if (lastComment.body.includes(failureReportString)) {
-        message = 'Failed on the latest commit';
-        status = 'failure';
+    // Each CI report entry is in the following format.
+    // There can be multiple runs on the same commit.
+    // * <commit_hash1> Azure: [FAILURE](url1)
+    // * <commit_hash2> Azure: [CANCELED](url2)
+    // * <commit_hash3> Azure: [CANCELED](url3) Azure: [SUCCESS](url4)
+    // As long as there is one successful CI run for a particular commit,
+    // we treat the commit passing CI.
+    for (let i = 0; i < entries.length; i++) {
+      if (entries[i].includes(reportPrefix)) {
+        if (entries[i].includes(successReportString)) {
+          message = 'Successful on the latest commit';
+          status = 'success';
+        } else if (entries[i].includes(failureReportString)) {
+          message = 'Failed on the latest commit';
+          status = 'failure';
+        }
+        break;
       }
     }
 

Reply via email to