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 }}