Skip to content

Commit 211d1a2

Browse files
authored
Restrict trigger push branch for GitHub Workflow (#5454)
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 <apupier@ibm.com>
1 parent f66a492 commit 211d1a2

7 files changed

Lines changed: 42 additions & 7 deletions

File tree

‎.github/workflows/build-backend.yml‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,12 @@
1717

1818
name: Build Backend
1919

20-
on: [push, pull_request]
20+
on:
21+
push:
22+
branches:
23+
- master
24+
- release-*
25+
pull_request:
2126

2227
env:
2328
MAVEN_OPTS: -Dmaven.resolver.transport=wagon -Dmaven.wagon.httpconnectionManager.ttlSeconds=30 -Xmx16g -XX:MetaspaceSize=4g -XX:ReservedCodeCacheSize=2g

‎.github/workflows/build-frontend.yml‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,12 @@
1717

1818
name: Build Frontend
1919

20-
on: [push, pull_request]
20+
on:
21+
push:
22+
branches:
23+
- master
24+
- release-*
25+
pull_request:
2126

2227

2328
jobs:

‎.github/workflows/check-code-format.yml‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,12 @@
1717

1818
name: Code Format Check
1919

20-
on: [push, pull_request]
20+
on:
21+
push:
22+
branches:
23+
- master
24+
- release-*
25+
pull_request:
2126

2227
jobs:
2328
spotless-check:

‎.github/workflows/check-license.yml‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,12 @@
1717

1818
name: License Check
1919

20-
on: [push, pull_request]
20+
on:
21+
push:
22+
branches:
23+
- master
24+
- release-*
25+
pull_request:
2126

2227
jobs:
2328
apache-rat-check:

‎.github/workflows/check-sql-pg-script.yml‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,12 @@
1717

1818
name: Postgresql Script Check
1919

20-
on: [push, pull_request]
20+
on:
21+
push:
22+
branches:
23+
- master
24+
- release-*
25+
pull_request:
2126

2227
jobs:
2328
sql-check:

‎.github/workflows/check-sql-script.yml‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,12 @@
1717

1818
name: Sql Script Check
1919

20-
on: [push, pull_request]
20+
on:
21+
push:
22+
branches:
23+
- master
24+
- release-*
25+
pull_request:
2126

2227
jobs:
2328
sql-check:

‎.github/workflows/dead-link-checker.yaml‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,12 @@
1818

1919
name: Dead Link Check
2020

21-
on: [push, pull_request]
21+
on:
22+
push:
23+
branches:
24+
- master
25+
- release-*
26+
pull_request:
2227

2328
jobs:
2429
dead-links-check:

0 commit comments

Comments
 (0)