Skip to content

Commit 316df8e

Browse files
authored
Restrict trigger push branch for GitHub Workflow (#16367)
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 ed0e11e commit 316df8e

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

.github/workflows/build-and-test-pr.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
name: "Build and Test For PR"
22

3-
on: [push, pull_request, workflow_dispatch]
3+
on:
4+
push:
5+
branches:
6+
- 3.3
7+
- 3.2
8+
pull_request:
9+
workflow_dispatch:
410

511
permissions:
612
contents: read

0 commit comments

Comments
 (0)