Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Cache prefix key for multiple cache-dependency-path

オープン
#1,320 コメント 1 件 リアクション 6 件 担当者 0 名 GitHub で見る

メンテナーはふだん 8 日以内に返信

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
35/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
nodejs, typescript
領域
ci-cd

調査の方向性

setup-node が cache-dependency-path からキャッシュキーをどのように構築するかを確認し、次に関連する issue #1120 を読んで背景を把握してください。完了条件は、ワークフローからパッケージマネージャーと lockfile のハッシュの間に制御可能なプレフィックスを指定でき、目的の異なる monorepo のキャッシュが相互に復元されないことです。

索引モデルが issue の本文から書いたものです。

説明

feature request

Description:

Currently the cache key is always the following format node-cache-{platform}-{packageManager}-{fileHash(lockfile)}
I'd like a way to add a prefix between the packageManager and the file hash like node-cache-{platform}-{packageManager}-{cachePrefix}-{fileHash(lockfile)}

Justification:

We work in a monorepo with yarn workspaces. In order to scope our yarn installs and cache, we use yarn workspaces focus with cache-dependency-path pointing to yarn.workspace.lock from https://github.com/MaintainX/yarn-plugin-workspace-lockfile

This means we have multiple workflows all saving and restoring caches for different file hashes.
Because we use yarn3, setup-node uses fallback restore keys.
Which means it frequently happens that 1 workflow will fallback on the cache from a totally different set of lockfiles, run yarn effectively download what's missing and grow the cache and save that cache back.

Somewhat related https://github.com/actions/setup-node/issues/1120

What happens is that our caches are constantly growing, over time including the whole monorepo's dependencies and more.
We tried to mitigate this by manually creating caches on push to master using actions/cache/save instead of setup-node so we wouldn't restore the cache making it a "fresh" cache.

Having a cache prefix that we control, we could give a semantic name for scopes of the monorepo allowing to avoid workflows to cross restore caches for a different yarn workspaces focus command

Are you willing to submit a PR?

Yes I'm willing to open a PR if this suggestion is accepted

主要言語
TypeScript
スター
5k
フォーク
1.7k
平均マージ
2日 11時間
マージ済み PR(30日)
3

環境構築

このプロジェクトの環境構築ファイルはまだ確認していません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

actions/setup-node のほかの issue

actions/setup-node の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。