From 5ff7c830cae5eb7b604c01521f84dc041deb2f0f Mon Sep 17 00:00:00 2001 From: Hanif Koh Date: Mon, 12 Oct 2026 00:15:06 +0800 Subject: [PATCH] Fail the clang-tidy Deps Wait When Listing Caches Keeps Failing --- .github/workflows/clang_tidy.yml | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/.github/workflows/clang_tidy.yml b/.github/workflows/clang_tidy.yml index 2b2fd921ac..64dde3b27c 100644 --- a/.github/workflows/clang_tidy.yml +++ b/.github/workflows/clang_tidy.yml @@ -37,7 +37,7 @@ jobs: # The PR merge commit plus its first parent, the base it is diffed against. fetch-depth: 2 - - name: Look for changed C++ files + - name: Look for changed files id: changes run: | if git -c core.quotePath=false diff --name-only HEAD^1 -- src tests | grep -qE '\.(cpp|cc|cxx|hpp|h|hxx)$'; then @@ -71,7 +71,9 @@ jobs: restore-keys: linux-clang-cache-orcaslicer_deps-build- fail-on-cache-miss: true - # Linux Build Deps takes about 35 minutes. + # Linux Build Deps takes about 35 minutes on GitHub-hosted runners. A + # failing lookup is retried a few times, then fails the job instead of + # waiting out the deadline. - name: Wait for this PR's deps cache if: steps.changes.outputs.cpp == 'true' && steps.deps_cache.outputs.cache-hit != 'true' && steps.changes.outputs.deps == 'true' timeout-minutes: 100 @@ -80,7 +82,15 @@ jobs: KEY: ${{ steps.changes.outputs.deps-key }} run: | deadline=$((SECONDS + 90 * 60)) - until [ -n "$(gh cache list --repo "$GITHUB_REPOSITORY" --ref "$GITHUB_REF" --key "$KEY" --json key --jq ".[] | select(.key == \"$KEY\") | .key")" ]; do + failures=0 + while true; do + if found=$(gh cache list --repo "$GITHUB_REPOSITORY" --ref "$GITHUB_REF" --key "$KEY" --json key --jq ".[] | select(.key == \"$KEY\") | .key"); then + [ -n "$found" ] && break + failures=0 + elif [ $((++failures)) -ge 3 ]; then + echo "::error::Listing caches failed 3 times in a row." + exit 1 + fi if [ "$SECONDS" -ge "$deadline" ]; then echo "::error::No deps cache $KEY after 90 minutes. Check the Linux Build Deps job, then rerun clang-tidy." exit 1