This is an automated email from the ASF dual-hosted git repository.
imbajin pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/hugegraph-ai.git
The following commit(s) were added to refs/heads/main by this push:
new c04f3a1c chore: add automatic rerun workflow for CI (#321)
c04f3a1c is described below
commit c04f3a1c82cfb61e6a20170b5d49af471c36028d
Author: contrueCT <[email protected]>
AuthorDate: Sun Apr 26 14:18:23 2026 +0800
chore: add automatic rerun workflow for CI (#321)
## Summary
- Add a `Rerun CI` workflow to automatically rerun failed test CI jobs.
- Limit reruns to CI workflows that may be affected by transient
integration or service startup issues.
- Keep automatic reruns limited to push and pull request events, with a
max retry count of 2.
---
.github/workflows/rerun-ci.yml | 102 +++++++++++++++++++++++++++++++++++++++++
1 file changed, 102 insertions(+)
diff --git a/.github/workflows/rerun-ci.yml b/.github/workflows/rerun-ci.yml
new file mode 100644
index 00000000..34f58d1d
--- /dev/null
+++ b/.github/workflows/rerun-ci.yml
@@ -0,0 +1,102 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+name: "Rerun CI"
+
+on:
+ workflow_run:
+ workflows:
+ - "HG-Python-Client CI"
+ - "HugeGraph-LLM CI"
+ types:
+ - completed
+
+permissions: {}
+
+env:
+ MAX_RERUNS: '2'
+ RETRY_DELAY_SECONDS: '180'
+
+jobs:
+ decide-rerun-action:
+ if: ${{ github.event.workflow_run.conclusion == 'failure' }}
+ 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 }}
+ EVENT_NAME: ${{ github.event.workflow_run.event }}
+ HEAD_BRANCH: ${{ github.event.workflow_run.head_branch }}
+ run: |
+ set -euo pipefail
+
+ action="skip"
+ reason="unsupported event: $EVENT_NAME"
+
+ if [[ "$EVENT_NAME" == "push" || "$EVENT_NAME" == "pull_request" ]];
then
+ if (( 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