actions / actions/toolkit

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

Open
#538 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

cache enhancement
Dominant language
TypeScript
Stars
5.9k
Forks
1.8k
PR merge metrics
No merged PRs in 30d

Description

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?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the @actions/cache saveCache and restoreCache APIs and trace how their options reach the logging described in the issue. Determine the scope of passing cacheName through both APIs and verify that cache-related messages identify the relevant cache and remain compatible with existing calls.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
ci-cd
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.