From 7147b9e5488ab20d2e6b5aea3f3d43aff5af18fe Mon Sep 17 00:00:00 2001 From: golf66 <69233028+hudeng-go@users.noreply.github.com> Date: Mon, 11 Nov 2024 20:59:37 +0800 Subject: [PATCH] chore: Add retry for doc check init step --- .github/workflows/doc-check.yml | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/.github/workflows/doc-check.yml b/.github/workflows/doc-check.yml index 8c91ea879..abab04763 100644 --- a/.github/workflows/doc-check.yml +++ b/.github/workflows/doc-check.yml @@ -40,8 +40,21 @@ jobs: echo "deb [trusted=yes] https://ci.deepin.com/repo/obs/deepin:/CI:/topics:/${trimedBranch}/deepin_develop/ ./" >> /etc/apt/sources.list echo "deb-src [trusted=yes] https://ci.deepin.com/repo/obs/deepin:/CI:/topics:/${trimedBranch}/deepin_develop/ ./" >> /etc/apt/sources.list fi - apt-get update && apt-get install -y --force-yes ca-certificates apt-transport-https sudo - sudo apt-get install -y --force-yes python3-pip python3-coverxygen + retries=3 + for i in $(seq 1 $retries); do + apt-get update && apt-get install -y --force-yes ca-certificates apt-transport-https sudo && sudo apt-get install -y --force-yes python3-pip python3-coverxygen + status=$? + if [ $status -eq 0 ]; then + echo "Init succeeded after $i attempt(s)" + exit 0 + fi + if [ $i -lt $retries ]; then + echo "Init failed. Attempt $i of $retries. Retrying in 5 seconds..." + sleep 5 + fi + done + echo "Init failed after $retries attempts. Giving up." + exit 1 - uses: actions/checkout@v3 with: