Skip to content

Commit b6da79e

Browse files
committed
Add example with reusable workflow and mention possibility of duplicate CI runs
Signed-off-by: Aleksei Khudiakov <[email protected]>
1 parent 4901d14 commit b6da79e

File tree

1 file changed

+27
-1
lines changed

1 file changed

+27
-1
lines changed

README.md

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,10 @@ Create `.github/workflows/continuous-integration.yml` file with following conten
6464
```yaml
6565
name: "Continuous Integration"
6666

67-
on: [push, pull_request]
67+
on:
68+
pull_request:
69+
push:
70+
branches:
6871

6972
jobs:
7073
matrix:
@@ -92,6 +95,29 @@ jobs:
9295
job: ${{ matrix.job }}
9396
```
9497
98+
Same can be achieved with our reusable workflow :
99+
100+
```yaml
101+
name: "Continuous Integration"
102+
103+
on:
104+
pull_request:
105+
push:
106+
branches:
107+
108+
jobs:
109+
ci:
110+
uses: laminas/workflow-continuous-integration/.github/workflows/[email protected]
111+
```
112+
113+
> ### Duplicate CI runs
114+
>
115+
> When pull requests are opened from branches in the same repository CI pipeline could run twice for the same commit:
116+
> once when pushed to a branch and once when PR is opened. Workflow triggers could be adjusted to only run for
117+
> specific branches or to skip branches using simple glob patterns.
118+
> See [Events that trigger workflows](https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#running-your-workflow-only-when-a-push-to-specific-branches-occurs)
119+
> for more info.
120+
95121
> ### actions/checkout not required
96122
>
97123
> The action will perform a checkout of the repository at the requested reference as part of its work, and therefore does not require the actions/checkout action as a preceding step.

0 commit comments

Comments
 (0)