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:31 UTC
(maven-gh-actions-shared) 04/04: Keep saving caches on pushed branches; skip pull requests and dependabot/ 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 76f052273aca904bc7ab5c9e5b0686549f2269ca
Author: Sylwester Lachiewicz <sl...@apache.org>
AuthorDate: Mon Oct 12 11:38:00 2026 +0000
Keep saving caches on pushed branches; skip pull requests and dependabot/ branches
Maintenance lines such as maven-4.0.x and other long-lived branches keep
their own caches. cache-save-default-branch-only restores the stricter rule
for projects that push topic branches to the repository.
---
.github/workflows/maven-verify.yml | 26 +++++++++++++-------------
1 file changed, 13 insertions(+), 13 deletions(-)
diff --git a/.github/workflows/maven-verify.yml b/.github/workflows/maven-verify.yml
index fcda5ea..8a30f92 100644
--- a/.github/workflows/maven-verify.yml
+++ b/.github/workflows/maven-verify.yml
@@ -220,13 +220,13 @@ on:
default: false
type: boolean
- cache-save-branches:
+ cache-save-default-branch-only:
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.
+ Save the Maven and JDK caches only on the default branch; other branches restore them.
+ By default every pushed branch saves except dependabot/ branches, and pull requests only restore.
required: false
- default: '[]'
- type: string
+ default: false
+ type: boolean
# allow single build per branch or PR
concurrency:
@@ -323,8 +323,8 @@ jobs:
java-version: ${{ inputs.ff-jdk-toolchain }}
distribution: ${{ inputs.ff-jdk-distribution }}
cache-jdk: true
- # 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) }}
+ # pull requests and dependabot/ branches restore caches without saving their own copies
+ cache-read-only: ${{ github.event_name == 'pull_request' || startsWith(github.ref_name, 'dependabot/') || (inputs.cache-save-default-branch-only && github.ref_name != github.event.repository.default_branch) }}
show-download-progress: ${{ inputs.show-download-progress }}
- name: Set up JDK
@@ -333,8 +333,8 @@ jobs:
java-version: ${{ inputs.ff-jdk }}
distribution: ${{ inputs.ff-jdk-distribution }}
cache: 'maven'
- # 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) }}
+ # pull requests and dependabot/ branches restore caches without saving their own copies
+ cache-read-only: ${{ github.event_name == 'pull_request' || startsWith(github.ref_name, 'dependabot/') || (inputs.cache-save-default-branch-only && github.ref_name != github.event.repository.default_branch) }}
show-download-progress: ${{ inputs.show-download-progress }}
- name: Set up Maven
@@ -459,8 +459,8 @@ jobs:
java-version: ${{ inputs.jdk-toolchain }}
distribution: ${{ matrix.distribution }}
cache-jdk: true
- # 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) }}
+ # pull requests and dependabot/ branches restore caches without saving their own copies
+ cache-read-only: ${{ github.event_name == 'pull_request' || startsWith(github.ref_name, 'dependabot/') || (inputs.cache-save-default-branch-only && github.ref_name != github.event.repository.default_branch) }}
show-download-progress: ${{ inputs.show-download-progress }}
- name: Set up JDK
@@ -470,8 +470,8 @@ jobs:
java-version: ${{ matrix.jdk }}
distribution: ${{ matrix.distribution }}
cache: 'maven'
- # 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) }}
+ # pull requests and dependabot/ branches restore caches without saving their own copies
+ cache-read-only: ${{ github.event_name == 'pull_request' || startsWith(github.ref_name, 'dependabot/') || (inputs.cache-save-default-branch-only && github.ref_name != github.event.repository.default_branch) }}
show-download-progress: ${{ inputs.show-download-progress }}
- name: Set up Maven