setup-node icon indicating copy to clipboard operation
setup-node copied to clipboard

Save cache even when job failed

Open morriq opened this issue 1 year ago • 1 comments

Description: Currently, saving the cache is executed only when the job is successful:

https://github.com/actions/setup-node/blob/39370e3970a6d050c480ffad4ff0ed4d3fdee5af/action.yml#L38-L39

In my opinion, the job can fail for many reasons, and saving the package to the cache should be independent.

Justification: Slowed-down job execution makes me prefer using a manual cache:

    - name: Always Save pnpm cache
      if: always() && steps.cache-pnpm.outputs.cache-hit != 'true'
      uses: actions/cache/save@v4
      with:
        path: |
          ${{ env.STORE_PATH }}
        key: ${{ steps.cache-pnpm.outputs.cache-primary-key }}

instead of cache input in action.

Are you willing to submit a PR?

morriq avatar Dec 04 '24 09:12 morriq

Hello @morriq 👋, Thank you for this feature request. We will investigate it and get back to you as soon as we have some feedback.

priya-kinthali avatar Dec 04 '24 09:12 priya-kinthali