Skip to content

Commit f992837

Browse files
CopilotKanti
andauthored
Restrict push trigger to master to avoid duplicate PR-branch runs
Co-authored-by: Kanti <471387+Kanti@users.noreply.github.com>
1 parent 0377fe5 commit f992837

2 files changed

Lines changed: 15 additions & 2 deletions

File tree

‎.github/workflows/build.yaml‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@ name: build
33
schedule:
44
-
55
cron: '0 0 * * *'
6-
push: null
6+
push:
7+
branches:
8+
- master
79
pull_request:
810
branches:
911
- master

‎ci/src/Commands/GithubCommand.php‎

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,18 @@ protected function execute(InputInterface $input, OutputInterface $output)
5959
'schedule' => [
6060
['cron' => '0 0 * * *'], // every week on Tuesday
6161
],
62-
'push' => null,
62+
// Restricted to 'master' so a PR branch's commits are only
63+
// ever built once, via the 'pull_request' event below. A
64+
// broad `push: null` trigger (any branch) would otherwise
65+
// fire a second, fully duplicate run of the whole pipeline
66+
// (build, test, and the OCI artifact dance) for the exact
67+
// same commit as its corresponding pull_request run. Master
68+
// itself is never reached by 'pull_request' (it has no PR
69+
// targeting itself), so its push-triggered publish path is
70+
// unaffected.
71+
'push' => [
72+
'branches' => ['master'],
73+
],
6374
'pull_request' => [
6475
'branches' => ['master'],
6576
],

0 commit comments

Comments
 (0)