From d237bacc149a5e71986fb1b28038324ae9e794db Mon Sep 17 00:00:00 2001 From: DongHyeonka Date: Thu, 12 Nov 2026 01:28:35 +0900 Subject: [PATCH] =?UTF-8?q?ci:=20JDK=20=EC=BA=90=EC=8B=9C=EB=8A=94=20main?= =?UTF-8?q?=EC=97=90=EC=84=9C=EB=A7=8C=20=EC=A0=80=EC=9E=A5=ED=95=9C?= =?UTF-8?q?=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 앞 커밋은 pull request만 읽기 전용으로 두고 push·schedule·수동 실행은 어느 브랜치에서든 저장하게 했다. 키가 Temurin 빌드 하나로 고정이고 처음 저장한 항목이 계속 쓰이므로, 쓰기 권한자가 브랜치에서 수동 실행으로 먼저 저장하면 그 뒤 모든 main 실행이 리뷰 없이 그 JDK를 복원한다. setup-gradle과 같은 규칙(main ref만 저장)으로 맞춘다. 위험·한계: 브랜치의 수동 실행에서는 main이 저장하기 전까지 캐시가 비어 있어 효과를 볼 수 없다. 효과는 병합 뒤 첫 main push에서 확인한다. --- .gitea/actions/setup-java-gradle/action.yml | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/.gitea/actions/setup-java-gradle/action.yml b/.gitea/actions/setup-java-gradle/action.yml index 867704df..afa88fdf 100644 --- a/.gitea/actions/setup-java-gradle/action.yml +++ b/.gitea/actions/setup-java-gradle/action.yml @@ -14,20 +14,19 @@ description: >- # The JDK comes from the runner's cache when it can. Every job starts in a fresh container, so # setup-java found an empty tool cache and downloaded the same 190 MB from GitHub in every job (about # 22 of the 25 seconds a job spent before Gradle, and the step that failed with 504s). setup-java -# looks in the tool cache first, so restoring the directory it installs into is enough. A pull -# request only reads the entry, so code under review cannot put a JDK in it; a push, a schedule or -# a manual run, which only a writer can start, may save it. The key names one Temurin build, so the -# entry is the same whichever branch saves it. setup-gradle below is stricter (main only), because -# a Gradle home differs by branch. +# looks in the tool cache first, so restoring the directory it installs into is enough. Only a run +# on main saves the entry, the rule setup-gradle follows below: the key is fixed and the first entry +# saved under it stays, so a branch that saved it first would decide the JDK every later main run +# restores, without review. runs: using: composite steps: - - if: ${{ github.event_name != 'pull_request' }} + - if: ${{ github.ref == 'refs/heads/main' }} uses: https://github.com/actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # actions/cache@v4.3.0 with: path: /opt/hostedtoolcache/Java_Temurin-Hotspot_jdk key: jdk-temurin-21.0.11+10.0.LTS-${{ runner.os }}-${{ runner.arch }} - - if: ${{ github.event_name == 'pull_request' }} + - if: ${{ github.ref != 'refs/heads/main' }} uses: https://github.com/actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830 # actions/cache/restore@v4.3.0 with: path: /opt/hostedtoolcache/Java_Temurin-Hotspot_jdk