From c3accfd1d39de7a288620e6cd180e9cc1fcd26d4 Mon Sep 17 00:00:00 2001 From: Maurice Date: Tue, 25 Aug 2026 18:01:58 +0700 Subject: [PATCH] Save cache after cancelled builds Allow cache and artifact uploads to retain partial build output when the build step is cancelled, including by the job timeout. Document why skipped builds are excluded. --- .github/workflows/testpr.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/testpr.yml b/.github/workflows/testpr.yml index ec2f4db4..155b7e42 100644 --- a/.github/workflows/testpr.yml +++ b/.github/workflows/testpr.yml @@ -141,7 +141,8 @@ jobs: - name: Save build cache uses: actions/cache/save@v5 - if: ${{ always() && (steps.build-recipes.outcome == 'success' || steps.build-recipes.outcome == 'failure') }} + # Save partial output when the build fails or is cancelled by the job timeout; do not save when it was skipped. + if: ${{ always() && (steps.build-recipes.outcome == 'success' || steps.build-recipes.outcome == 'failure' || steps.build-recipes.outcome == 'cancelled') }} with: path: | ${{ matrix.folder_cache }} @@ -153,7 +154,8 @@ jobs: pixi run vinca-gha --platform ${{ matrix.platform }} --trigger-branch dummy_build_branch_as_it_is_unused -d ./recipes - name: Upload build cache as artifact - if: ${{ always() && env.SAVE_CACHE_AS_ARTIFACT == 'true' && (steps.build-recipes.outcome == 'success' || steps.build-recipes.outcome == 'failure') }} + # Keep artifacts consistent with the cache: retain partial output from failed or cancelled builds, but not skipped builds. + if: ${{ always() && env.SAVE_CACHE_AS_ARTIFACT == 'true' && (steps.build-recipes.outcome == 'success' || steps.build-recipes.outcome == 'failure' || steps.build-recipes.outcome == 'cancelled') }} uses: actions/upload-artifact@v6 with: name: cache-${{ matrix.platform }}-${{ github.run_id }}