From 318ad60fb6cc091be599711006f8e6b8e58fec53 Mon Sep 17 00:00:00 2001 From: ZePan110 Date: Fri, 20 Sep 2024 22:21:09 +0800 Subject: [PATCH] Add retry for occasional failures Signed-off-by: ZePan110 --- .github/workflows/pr-path-detection.yml | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/.github/workflows/pr-path-detection.yml b/.github/workflows/pr-path-detection.yml index 495d5649..f58dfbd2 100644 --- a/.github/workflows/pr-path-detection.yml +++ b/.github/workflows/pr-path-detection.yml @@ -27,7 +27,6 @@ jobs: for url_line in $url_lines; do url=$(echo "$url_line"|cut -d '(' -f2 | cut -d ')' -f1|sed 's/\.git$//') path=$(echo "$url_line"|cut -d':' -f1 | cut -d'/' -f2-) - echo "$url" if [[ "https://intel.sharepoint.com/:v:/s/mlconsultingandsupport/EZa7vjON10ZCpMvE7U-SPMwBRXbVHqe1Ybsa-fmnXayNUA?e=f6FPsl" == "$url" || "https://intel.sharepoint.com/:v:/s/mlconsultingandsupport/ESMIcBseFTdIuqkoB7TZy6ABfwR9CkfV49TvTa1X_Jihkg?e=zMH7O7" == "$url" ]]; then echo "Link "$url" from ${{github.workspace}}/$path need to be verified by a real person." else @@ -39,8 +38,7 @@ jobs: echo "*****Retry successful*****" else urls+=("$url") - echo "Invalid link from ${{github.workspace}}/$path: $url status code: $response_retry" - fail="TRUE" + echo "Status code: $response_retry, Link $url validation failed, will retry later." fi fi fi @@ -49,7 +47,12 @@ jobs: for link in "${urls[@]}"; do retry=$(curl -s -o /dev/null -w "%{http_code}" "$url") - echo $retry + if [ "$response_retry" -eq 200 ]; then + echo "*****Retry successful*****" + else + echo "Invalid link from ${{github.workspace}}/$path: $url status code: $retry" + fail="TRUE" + fi done if [[ "$fail" == "TRUE" ]]; then