Skip to content

Action fails if saving cache fails #53

Closed
@s-weigand

Description

@s-weigand

First of all thanks for this action 😄

Today I had my pre-commit job failing, with the following error, which isn't fixable by rerunning the job:

Error: reserveCache failed: Cache already exists. Scope: refs/pull/80/merge, Key: pre-commit-2-b76e203571a33b83fd824866e8e8daaeda30555cba9e70eb155d9e5310e578b8-7365e065f5f4ed7e591c7e54ee4f8c40d559f8ff4d40fb8fc9eec5d1a9d2e11c, Version: 28cdb9f5496f334116f23e86f0063f5d3a9348c2e22425a33171e071aadada7e

My best guess is, that this caused by a corrupted cache, where a cache entry with the key exists, but cache.restoreCache is unable to restore it properly (maybe on: push and on: pull_request wanted to save the cache at the same time? 😵 ).
So this might be a very rare and quite impossible to reproduce case.

Anyway, since the cache is nice and all, but not a key feature, IMHO it would be reasonable to catch errors caused by cache.saveCache and give users a warning ( core.warning), instead of letting it bubble up to core.setFailed.

main().catch((e) => core.setFailed(e.message));

Also, there have been some changes to @actions/cache since version 0.2.1 which you use, so running npm upgrade might improve this action as well.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions