liangyepianzhou commented on code in PR #24940:
URL: https://github.com/apache/pulsar/pull/24940#discussion_r2490018711


##########
.github/workflows/ci-pulsarbot.yaml:
##########
@@ -34,6 +34,233 @@ jobs:
     steps:
       - name: Execute pulsarbot command
         id: pulsarbot
-        env:
+        uses: actions/github-script@v7
+        with:
           GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
-        uses: apache/pulsar-test-infra/pulsarbot@master
+          script: |
+            // Supported commands:
+            // - /pulsarbot rerun
+            //   Reruns all completed workflows with conclusions of 
failure/timed_out/skipped/cancelled
+            //   If workflow is still running, cannot rerun whole workflow, 
just suggest using "/pulsarbot rerun jobname"
+            // - /pulsarbot rerun jobname
+            //   Matches job.name by keyword, reruns matching jobs (regardless 
of current state, failures are logged)
+            // - /pulsarbot stop or /pulsarbot cancel
+            //   Cancels all still running (queued/in_progress) workflow runs 
associated with the current PR
+            const commentBody = context.payload.comment.body.trim();
+            const prefix = '/pulsarbot';
+            if (!commentBody.startsWith(prefix)) {
+              console.log('Not a pulsarbot command, skipping ...');
+              return;
+            }
+            if (!context.payload.issue || !context.payload.issue.pull_request) 
{
+              console.error('This comment is not on a Pull Request. pulsarbot 
only works on PRs.');
+              return;
+            }
+            const parts = commentBody.split(/\s+/);
+            const sub = (parts[1] || '').toLowerCase();

Review Comment:
   Meaning: Re-run all jobs under the entire failed workflow.
   
   Summary:  
   console.log('Mode: full workflow re-run for completed runs with conclusions 
in [failure, timed_out, cancelled, skipped].');
   ...
   if (!targetConclusions.has(r.conclusion)) {  
       // skip  
   }  
   ...  
   reRunWorkflow  
   console.log(`Triggered full re-run for ${runKey(r)}`);  
   fullRerunCount++;



-- 
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.

To unsubscribe, e-mail: [email protected]

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

Reply via email to