You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by sl...@apache.org on 2026/10/12 20:29:30 UTC
(maven-gh-actions-shared) 03/04: Let long-lived branches save caches through cache-save-branches
This is an automated email from the ASF dual-hosted git repository.
slachiewicz pushed a commit to branch v5
in repository https://gitbox.apache.org/repos/asf/maven-gh-actions-shared.git
commit 6b07014dd026d8f091ddbfac4940fbfe17b5d587
Author: Sylwester Lachiewicz <sl...@apache.org>
AuthorDate: Mon Oct 12 13:03:32 2026 +0200
Let long-lived branches save caches through cache-save-branches
---
.github/workflows/maven-verify.yml | 24 ++++++++++++++++--------
1 file changed, 16 insertions(+), 8 deletions(-)
diff --git a/.github/workflows/maven-verify.yml b/.github/workflows/maven-verify.yml
index 780f022..fcda5ea 100644
--- a/.github/workflows/maven-verify.yml
+++ b/.github/workflows/maven-verify.yml
@@ -220,6 +220,14 @@ on:
default: false
type: boolean
+ cache-save-branches:
+ description: >-
+ JSON array of branch names that save the Maven and JDK caches, in addition to the default branch.
+ Other branches and pull requests only restore the default branch's caches.
+ required: false
+ default: '[]'
+ type: string
+
# allow single build per branch or PR
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
@@ -315,8 +323,8 @@ jobs:
java-version: ${{ inputs.ff-jdk-toolchain }}
distribution: ${{ inputs.ff-jdk-distribution }}
cache-jdk: true
- # only the default branch saves caches; other branches and pull requests restore them
- cache-read-only: ${{ github.ref_name != github.event.repository.default_branch }}
+ # only the default branch and cache-save-branches save caches; others restore the default branch's
+ cache-read-only: ${{ github.ref_name != github.event.repository.default_branch && !contains(fromJSON(inputs.cache-save-branches), github.ref_name) }}
show-download-progress: ${{ inputs.show-download-progress }}
- name: Set up JDK
@@ -325,8 +333,8 @@ jobs:
java-version: ${{ inputs.ff-jdk }}
distribution: ${{ inputs.ff-jdk-distribution }}
cache: 'maven'
- # only the default branch saves caches; other branches and pull requests restore them
- cache-read-only: ${{ github.ref_name != github.event.repository.default_branch }}
+ # only the default branch and cache-save-branches save caches; others restore the default branch's
+ cache-read-only: ${{ github.ref_name != github.event.repository.default_branch && !contains(fromJSON(inputs.cache-save-branches), github.ref_name) }}
show-download-progress: ${{ inputs.show-download-progress }}
- name: Set up Maven
@@ -451,8 +459,8 @@ jobs:
java-version: ${{ inputs.jdk-toolchain }}
distribution: ${{ matrix.distribution }}
cache-jdk: true
- # only the default branch saves caches; other branches and pull requests restore them
- cache-read-only: ${{ github.ref_name != github.event.repository.default_branch }}
+ # only the default branch and cache-save-branches save caches; others restore the default branch's
+ cache-read-only: ${{ github.ref_name != github.event.repository.default_branch && !contains(fromJSON(inputs.cache-save-branches), github.ref_name) }}
show-download-progress: ${{ inputs.show-download-progress }}
- name: Set up JDK
@@ -462,8 +470,8 @@ jobs:
java-version: ${{ matrix.jdk }}
distribution: ${{ matrix.distribution }}
cache: 'maven'
- # only the default branch saves caches; other branches and pull requests restore them
- cache-read-only: ${{ github.ref_name != github.event.repository.default_branch }}
+ # only the default branch and cache-save-branches save caches; others restore the default branch's
+ cache-read-only: ${{ github.ref_name != github.event.repository.default_branch && !contains(fromJSON(inputs.cache-save-branches), github.ref_name) }}
show-download-progress: ${{ inputs.show-download-progress }}
- name: Set up Maven