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

Prefer `actions/setup` caching over `actions/cache`

オープン
#47 コメント 4 件 リアクション 0 件 担当者 0 名 GitHub で見る

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

評価

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

調査の方向性

.github/workflows/build.yml と、リンクされている actions/setup-java、setup-node、setup-python、setup-go のキャッシュに関するドキュメントから始めます。recipe が actions/cache のステップをどのように識別するかを調べ、各 setup action に対応するパッケージマネージャーのキャッシュオプションを決定します。手動のキャッシュステップが対応する setup のキャッシュキーに置き換えられれば完了です。

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

説明

recipe
  1. Remove actions/cache
  2. Add the cache key to the corresponding actions/setup

See :
https://github.com/actions/setup-java#caching-packages-dependencies
https://github.com/actions/setup-node#caching-packages-dependencies
https://github.com/actions/setup-python
https://github.com/actions/setup-go#caching-dependency-files-and-build-outputs

Examples:


diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 4555776..785bc33 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -17,16 +17,11 @@ jobs:
       checks: write
     steps:
       - uses: actions/checkout@v3
-      - uses: actions/cache@v3
-        with:
-          path: ~/.m2/repository
-          key: ${{ runner.os }}-main-maven-${{ hashFiles('**/pom.xml') }}
-          restore-keys: |
-            ${{ runner.os }}-main-maven-
       - uses: actions/setup-java@v3
         with:
           java-version: 8
          distribution: 'zulu'
+          cache: 'maven'
       - run: cd tests && mvn clean test --batch-mode -Dmaven.test.failure.ignore=true
       - uses: ./
         if: github.ref != 'refs/heads/master'

diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 785bc33..e2d8a91 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -52,12 +52,7 @@ jobs:
       - uses: actions/setup-node@v3
         with:
           node-version: 16
-      - uses: actions/cache@v3
-        with:
-          path: ~/.npm
-          key: ${{ runner.os }}-npm-cache-${{ hashFiles('**/package-lock.json') }}
-          restore-keys: |
-            ${{ runner.os }}-npm-cache-
+          cache: npm
       - run: npm install
       - run: npm run eslint
       - run: npm run test

I think that the main challenge here is to determine what type to use.

For example, for actions/setup-java we have maven, gradle and sbt as options. The recipe should be able to detect the package manager and make the correct selection

主要言語
Java
スター
1
フォーク
9
平均マージ
45分
マージ済み PR(30日)
7

環境構築

はじめの一歩

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

openrewrite/rewrite-github-actions のほかの issue

openrewrite/rewrite-github-actions の issue をすべて見る

似ている issue

Java の issue をもっと見る

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

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