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