cache-extensions icon indicating copy to clipboard operation
cache-extensions copied to clipboard

write cache if job fails

Open brettmc opened this issue 1 year ago • 0 comments

Describe the feature I would like to be able to cache extensions even if the job fails (perhaps optionally, via a cache-on-error: <bool> option)

Version

  • [ x] I have checked releases and the feature is missing in the latest patch version of v1.

Underlying issue Testing a library against PHP nightly, I expect it to fail a lot (ie during composer install, tests, linting, etc). But, that doesn't mean the extensions weren't created correctly, and I would like to avoid recompiling them each run.

Describe alternatives

  • make all steps continue-on-error. Then, cache will be written. However, the job now reports as being successful even with failed steps.
  • make all steps continue-on-error, then use an action like gacts/run-and-post-run (ensuring it runs after cache write), check each step for failure if [ ${{steps.step1.outcome == 'failure'}} || steps.stepN.outcome == 'failure' ]; then exit 1; fi and then fail at the end. This works, but is a little tedious.
  • add an if: always() condition to the cache-extensions step (does not work)

Additional context

Are you willing to submit a PR? Yes

brettmc avatar Jan 15 '24 22:01 brettmc