Skip to content

Caching should occur even when your job fails #145

Closed
@mcafaro

Description

@mcafaro

The "Post Set up MATLAB" step which uploads MATLAB to the GitHub Actions cache does not appear to run if your job fails. This is unfortunate if MATLAB was set up properly but a subsequent steps happened to fail. It would be nice if even in this case MATLAB were still cached. This often occurs while initially setting up your workflow and having MATLAB cached would decrease the iteration time.

Activity

mcafaro

mcafaro commented on May 14, 2025

@mcafaro
MemberAuthor

One way to do this would be to set post-if: always() in action.yml so that the post script always runs. Then in the main script do something like core.saveState('succeeded', 'true') to communicate to the post script that MATLAB was set up successful. Then in the post script do something like:

const cache = core.getBooleanInput('cache');
const succeeded = core.getState('succeeded');
if (cache && succeeded === 'true') { ...
self-assigned this
on May 20, 2025
mcafaro

mcafaro commented on Jun 5, 2025

@mcafaro
MemberAuthor

Closed by #148

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

    Development

    No branches or pull requests

      Participants

      @mcafaro

      Issue actions

        Caching should occur even when your job fails · Issue #145 · matlab-actions/setup-matlab