Skip to content

Add "cache name" to @action/cache APIs, so log messages could be tailored to the cache in question #538

Description

@vlsi

Describe the enhancement

Current saveCache and restoreCache work, and they are useful for creating customized caches.
It would be great if the methods could take cacheName as an extra option.

Then the logging inside @actions/cache can include caheName, so the logs are human-friendly.

Code Snippet

saveCache(["~/.m2/repository"],"main-"+hashFiles("**/pom.xml"),{cacheName: "Maven local repository"})restoreCache(["~/.m2/repository"],"main-"+hashFiles("**/pom.xml"),["main-"],{cacheName: "./m2/repository"})

Additional information

Current logging might look like the following.
It is hard to tell which cache was not found, and it is hard to tell which cache is 30MiB, and which is 5MiB.

Cache was not found for dependencies-maven-macOS-master-e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855, restore keys: dependencies-maven-macOS-master
Received 31360354 of 31360354 (100.0%), 43.0 MBs/sec
Cache Size: ~30 MB (31360354 B)
/usr/bin/tar --use-compress-program zstd -d -xf /Users/runner/work/_temp/feef5a0b-b9e2-4376-b2cb-4a9da63ef6ec/cache.tzst -P -C /Users/runner/work/calcite/calcite
Received 5672258 of 5672258 (100.0%), 8.9 MBs/sec
Cache Size: ~5 MB (5672258 B)
Received 41943040 of 361858910 (11.6%), 39.1 MBs/sec
/usr/bin/tar --use-compress-program zstd -d -xf /Users/runner/work/_temp/8b10504b-9c4c-4d2c-9bf5-8d672093ed38/cache.tzst -P -C /Users/runner/work/calcite/calcite

If cacheName is added, then each message could be prefixed with a cache name.

WDYT?

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions