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

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


The following commit(s) were added to refs/heads/master by this push:
     new 28c39b65d chore(ci): add automatic rerun controller for flaky 
workflows (#2984)
28c39b65d is described below

commit 28c39b65d2af27d1bab20b8aa785f9af8efa6fe4
Author: contrueCT <[email protected]>
AuthorDate: Sat Apr 11 23:22:29 2026 +0800

    chore(ci): add automatic rerun controller for flaky workflows (#2984)
    
    * ci: increase retry delay for rerun jobs from 60 to 180 seconds
---
 .github/workflows/rerun-ci.yml | 87 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 87 insertions(+)

diff --git a/.github/workflows/rerun-ci.yml b/.github/workflows/rerun-ci.yml
new file mode 100644
index 000000000..d2282e009
--- /dev/null
+++ b/.github/workflows/rerun-ci.yml
@@ -0,0 +1,87 @@
+name: "Rerun CI"
+
+on:
+  workflow_run:
+    workflows:
+      - "HugeGraph-Server CI"
+      - "HugeGraph-Commons CI"
+      - "HugeGraph-PD & Store & Hstore CI"
+      - "Cluster Test CI"
+    types:
+      - completed
+
+permissions: {}
+
+env:
+  MAX_RERUNS: '2'
+  RETRY_DELAY_SECONDS: '180'
+
+jobs:
+  decide-rerun-action:
+    runs-on: ubuntu-latest
+    outputs:
+      action: ${{ steps.decision.outputs.action }}
+    steps:
+      - name: Decide rerun action
+        id: decision
+        env:
+          WORKFLOW_NAME: ${{ github.event.workflow_run.name }}
+          RUN_ID: ${{ github.event.workflow_run.id }}
+          RUN_ATTEMPT: ${{ github.event.workflow_run.run_attempt }}
+          CONCLUSION: ${{ github.event.workflow_run.conclusion }}
+          EVENT_NAME: ${{ github.event.workflow_run.event }}
+          HEAD_BRANCH: ${{ github.event.workflow_run.head_branch }}
+        run: |
+          set -euo pipefail
+
+          action="skip"
+          reason="non-failure"
+
+          if [[ "$CONCLUSION" == "failure" ]]; then
+            if [[ "$EVENT_NAME" != "push" && "$EVENT_NAME" != "pull_request" 
]]; then
+              reason="unsupported event: $EVENT_NAME"
+            elif (( RUN_ATTEMPT > MAX_RERUNS )); then
+              reason="retry limit reached"
+            else
+              action="rerun"
+              reason="within retry limit"
+            fi
+          fi
+
+          {
+            echo "action=$action"
+            echo "reason=$reason"
+          } >> "$GITHUB_OUTPUT"
+
+          {
+            echo "### Rerun CI decision"
+            echo ""
+            echo "- Workflow: $WORKFLOW_NAME"
+            echo "- Source event: $EVENT_NAME"
+            echo "- Head branch: $HEAD_BRANCH"
+            echo "- Run ID: $RUN_ID"
+            echo "- Current attempt: $RUN_ATTEMPT"
+            echo "- Max automatic reruns: $MAX_RERUNS"
+            echo "- Delay seconds: $RETRY_DELAY_SECONDS"
+            echo "- Action: $action"
+            echo "- Reason: $reason"
+          } >> "$GITHUB_STEP_SUMMARY"
+
+  rerun-failed-jobs:
+    needs: decide-rerun-action
+    if: needs.decide-rerun-action.outputs.action == 'rerun'
+    permissions:
+      actions: write
+      contents: read
+    runs-on: ubuntu-latest
+    steps:
+      - name: Wait before rerun
+        run: |
+          sleep "$RETRY_DELAY_SECONDS"
+
+      - name: Rerun failed jobs
+        env:
+          GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+          GH_REPO: ${{ github.repository }}
+        run: |
+          gh run rerun ${{ github.event.workflow_run.id }} --failed

Reply via email to