Skip to content

Commit e82429c

Browse files
committed
Restrict trigger push branch for GitHub Workflow
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 a97c510 commit e82429c

4 files changed

Lines changed: 25 additions & 7 deletions

File tree

.github/workflows/build.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,12 @@
1717

1818
name: Build
1919
on:
20-
- push
21-
- pull_request
20+
push:
21+
branches:
22+
- main
23+
- 4.22
24+
- 4.20
25+
pull_request:
2226
concurrency:
2327
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
2428
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}

.github/workflows/ci.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,12 @@
1717

1818
name: Simulator CI
1919
on:
20-
- push
21-
- pull_request
20+
push:
21+
branches:
22+
- main
23+
- 4.22
24+
- 4.20
25+
pull_request:
2226
concurrency:
2327
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
2428
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}

.github/workflows/rat.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,12 @@
1717

1818
name: License Check
1919
on:
20-
- push
21-
- pull_request
20+
push:
21+
branches:
22+
- main
23+
- 4.22
24+
- 4.20
25+
pull_request:
2226
concurrency:
2327
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
2428
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}

.github/workflows/ui.yml

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

1818
name: UI Build
1919

20-
on: [push, pull_request]
20+
on:
21+
push:
22+
branches:
23+
- main
24+
- 4.22
25+
- 4.20
26+
pull_request:
2127

2228
concurrency:
2329
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}

0 commit comments

Comments
 (0)