diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 6aca0c6..d12f5f9 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -14,9 +14,39 @@ env: PIXI_VERSION: "v0.63.0" jobs: - # TODO: Add a job that clears the GitHub cache + clear-cache: + runs-on: ubuntu-slim + permissions: + actions: write + steps: + - name: Clear pixi-lock cache entries + env: + GH_TOKEN: ${{ github.token }} + run: | + echo "Clearing pixi-lock-* cache entries" + gh cache list --repo ${{ github.repository }} --json key --jq '.[].key' | grep '^pixi-lock_' | while read -r key; do + echo "Deleting cache: $key" + for attempt in 1 2 3; do + if gh cache delete "$key" --repo ${{ github.repository }}; then + break + fi + echo "Attempt $attempt failed, retrying in 5 seconds..." + sleep 5 + done + done + sleep 5 + echo "Verifying all caches are cleared..." + remaining=$(gh cache list --repo ${{ github.repository }} --json key --jq '.[].key' | grep '^pixi-lock_' || true) + if [ -n "$remaining" ]; then + echo "Error: Some caches still exist:" + echo "$remaining" + exit 1 + fi + echo "Cache cleared" + cache-pixi-lock: - runs-on: ubuntu-latest + needs: clear-cache + runs-on: ubuntu-slim outputs: cache-key: ${{ steps.create-and-cache.outputs.cache-key }} pixi-version: ${{ steps.create-and-cache.outputs.pixi-version }} @@ -52,7 +82,7 @@ jobs: strategy: fail-fast: false matrix: - os: [ubuntu-latest, macos-latest, windows-latest] + os: [ubuntu-slim, macos-latest, windows-latest] steps: - name: Checkout repository uses: actions/checkout@v6