From fce1bac155b6032b7ec35be904c9e6167d8e5b19 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Pupier?= Date: Thu, 2 Jul 2026 09:20:13 +0200 Subject: [PATCH] Restrict trigger push branch for GitHub Workflow MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Feature branches rarely need their own CI runs: the code is already tested when a pull request is opened against a release branch. If the push trigger has no branch restriction and pull_request is also configured, every push to a branch with an open PR runs the workflow twice: once for the push and once for the PR synchronisation. Always give the push trigger an explicit list of branches: this stops branches created from a release branch from inheriting its workflow runs. see https://cwiki.apache.org/confluence/pages/viewpage.action?pageId=430408443#GitHubActionsRecommendedPractices-Restrictthepushtriggertospecificbranches Signed-off-by: Aurélien Pupier --- .github/workflows/maven.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index e53ef6b81..16a6c4519 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -15,7 +15,13 @@ name: Java CI -on: [push, pull_request, workflow_dispatch] +on: + push: + branches: + - master + - release + pull_request: + workflow_dispatch: permissions: contents: read