jiajunwang commented on a change in pull request #1757:
URL: https://github.com/apache/helix/pull/1757#discussion_r640020128



##########
File path: .github/workflows/Helix-CI.yml
##########
@@ -20,9 +20,90 @@ jobs:
       run: mvn clean install -Dmaven.test.skip.exec=true
     - name: Run All Tests
       run: mvn -q -fae test
-    - name: Print Tests Results
-      run: .github/scripts/printTestResult.sh
-      if: ${{ success() || failure() }}
     - name: Upload to Codecov
       run: bash <(curl -s https://codecov.io/bash)
       if: ${{ github.event_name == 'push' && (success() || failure()) }}
+    - name: Print Tests Results
+      run: .github/scripts/printTestResult.sh
+      if: ${{ success() || failure() }}
+    - name: Report Tests Results
+      uses: actions/github-script@v4
+      with:
+        github-token: ${{secrets.GITHUB_TOKEN}}
+        script: |
+          const fs = require('fs');
+          const readline = require('readline');
+
+          const failureReportPath = './FailingTest.out'
+          // 1. Search for any test failures
+          if (!fs.existsSync(failureReportPath)) {
+            console.log('No test failure report found.')
+            return
+          }
+
+          var response = await github.issues.listForRepo({
+            owner: context.repo.owner,
+            repo: context.repo.repo,
+            labels: ['FailedTestTracking'],
+            state: ['all']
+          })
+          const existingIssues = response.data.filter((data) => 
!data.pull_request)
+
+          const lineReader = readline.createInterface({
+            input: fs.createReadStream('./FailingTest.out')
+          });
+          const failingTests = []
+          for await (const line of lineReader) {
+            failingTests.push(line)
+          }
+
+          for (failingTest of failingTests) {
+            // 2. Creating issues for the failing tests
+            console.log('Failing test identified:\n' + failingTest)
+            if (failingTest) {
+              const testInfo = failingTest.split(' ')[0]
+              const issueTitle = '[Failed CI Test] ' + testInfo
+              if (issueTitle) {
+                console.log('Adding comment to issue: ' + issueTitle)
+                var issue = null
+                // 2.1. Check existing test issues, create new ones for the 
failing tests if not exist.
+                for (existingIssue of existingIssues) {
+                  if (existingIssue.title == issueTitle) {

Review comment:
       Duplicate tickets are fine. We are not trying to resolve the issues 
automatically. As long as tickets are created, we have the track. The current 
design is trying to minimize duplicate issues as far as we can. But there is no 
guarantee. Feel free to let me know if you have a better idea. I can change the 
logic.
   
   Regarding the existing issues, I will close them once this PR is in.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to