Skip to content

Commit f9ad9da

Browse files
authored
Merge pull request #5153 from MikeMcC399/gha/version-selection
Recommend use of github-action v5 branch instead of v5.x.x tag
2 parents 0dd9539 + 1e53542 commit f9ad9da

File tree

1 file changed

+34
-32
lines changed

1 file changed

+34
-32
lines changed

docs/guides/continuous-integration/github-actions.mdx

+34-32
Original file line numberDiff line numberDiff line change
@@ -49,19 +49,14 @@ running Cypress tests. This action provides npm, pnpm or yarn installation,
4949
custom caching, additional configuration options and simplifies setup of
5050
advanced workflows with Cypress in the GitHub Actions platform.
5151

52-
### Explicit Version Number
52+
### Version Number Selection
5353

5454
:::info
5555

5656
<strong>GitHub Action Version Number</strong>
5757

58-
We recommend using the explicit version number of the Cypress GitHub Action to
59-
prevent accidentally running tests with a new version of the action that may
60-
have breaking changes.
61-
62-
Read the
63-
[GitHub Action documentation](https://github.com/cypress-io/github-action#explicit-version)
64-
for more information
58+
We recommend binding to the action's latest major version by specifying `v5`
59+
when using the action.
6560

6661
:::
6762

@@ -71,22 +66,29 @@ For Example:
7166
jobs:
7267
cypress-run:
7368
steps:
74-
uses: cypress-io/github-action@v5.1.0
69+
uses: cypress-io/github-action@v5
7570
```
7671
72+
Alternatively, as a mitigation strategy for unforeseen breaks, bind to a
73+
specific
74+
[release version tag](https://github.com/cypress-io/github-action/releases), for
75+
example `cypress-io/[email protected]`. Read the
76+
[Cypress GitHub Action documentation](https://github.com/cypress-io/github-action#action-version)
77+
for more information.
78+
7779
## Basic Setup
7880

7981
<DocsVideo src="https://youtube.com/embed/vVr7DXDdUks" />
8082

81-
The example below is basic CI setup and job using the
83+
The example below is a basic CI setup and job using the
8284
[Cypress GitHub Action](https://github.com/marketplace/actions/cypress-io) to
8385
run Cypress tests within the Electron browser. This GitHub Action configuration
8486
is placed within `.github/workflows/main.yml`.
8587

8688
```yaml
8789
name: Cypress Tests
8890
89-
on: [push]
91+
on: push
9092
9193
jobs:
9294
cypress-run:
@@ -97,7 +99,7 @@ jobs:
9799
# Install NPM dependencies, cache them correctly
98100
# and run all Cypress tests
99101
- name: Cypress run
100-
uses: cypress-io/github-action@v5.x.x # use the explicit version number
102+
uses: cypress-io/github-action@v5
101103
with:
102104
build: npm run build
103105
start: npm start
@@ -116,11 +118,11 @@ example project and place the above GitHub Action configuration in
116118

117119
**How this action works:**
118120

119-
- On _push_ to this repository, this job will provision and start GitHub-hosted
120-
Ubuntu Linux instance for running the outlined `steps` for the declared
121-
`cypress-run` job within the `jobs` section of the configuration.
121+
- On _push_ to this repository, this job will provision and start a
122+
GitHub-hosted Ubuntu Linux instance to run the outlined `steps` for the
123+
declared `cypress-run` job within the `jobs` section of the configuration.
122124
- The [GitHub checkout Action](https://github.com/marketplace/actions/checkout)
123-
is used to checkout our code from our GitHub repository.
125+
is used to check out our code from our GitHub repository.
124126
- Finally, our Cypress GitHub Action will:
125127
- Install npm dependencies
126128
- Build the project (`npm run build`)
@@ -143,7 +145,7 @@ tests in Firefox by passing the `browser: firefox` attribute to the
143145
```yaml
144146
name: Cypress Tests using Cypress Docker Image
145147
146-
on: [push]
148+
on: push
147149
148150
jobs:
149151
cypress-run:
@@ -156,9 +158,9 @@ jobs:
156158
# Install NPM dependencies, cache them correctly
157159
# and run all Cypress tests
158160
- name: Cypress run
159-
uses: cypress-io/github-action@v5.x.x # use the explicit version number
161+
uses: cypress-io/github-action@v5
160162
with:
161-
# Specify Browser since container image is compile with Firefox
163+
# Specify Browser since container image is compiled with Firefox
162164
browser: firefox
163165
```
164166

@@ -185,7 +187,7 @@ action and will save the state of the `build` directory for the worker jobs.
185187
```yaml
186188
name: Cypress Tests with installation job
187189
188-
on: [push]
190+
on: push
189191
190192
jobs:
191193
install:
@@ -203,7 +205,7 @@ jobs:
203205
path: build
204206
205207
- name: Cypress install
206-
uses: cypress-io/github-action@v5.x.x # use the explicit version number
208+
uses: cypress-io/github-action@v5
207209
with:
208210
# Disable running of tests within install job
209211
runTests: false
@@ -218,7 +220,7 @@ below in a worker job.
218220
```yaml
219221
name: Cypress Tests with Dependency and Artifact Caching
220222
221-
on: [push]
223+
on: push
222224
223225
jobs:
224226
# install:
@@ -239,9 +241,9 @@ jobs:
239241
# Install NPM dependencies, cache them correctly
240242
# and run all Cypress tests
241243
- name: Cypress run
242-
uses: cypress-io/github-action@v5.x.x # use the explicit version number
244+
uses: cypress-io/github-action@v5
243245
with:
244-
# Specify Browser since container image is compile with Firefox
246+
# Specify Browser since container image is compiled with Firefox
245247
browser: firefox
246248
build: yarn build
247249
```
@@ -288,7 +290,7 @@ action will save the state of the `build` directory for the worker jobs.
288290
```yaml
289291
name: Cypress Tests with installation job
290292
291-
on: [push]
293+
on: push
292294
293295
jobs:
294296
install:
@@ -299,7 +301,7 @@ jobs:
299301
uses: actions/checkout@v3
300302
301303
- name: Cypress install
302-
uses: cypress-io/github-action@v5.x.x # use the explicit version number
304+
uses: cypress-io/github-action@v5
303305
with:
304306
# Disable running of tests within install job
305307
runTests: false
@@ -336,7 +338,7 @@ action will retrieve the `build` directory saved in the install job.
336338
```yaml
337339
name: Cypress Tests with Install Job and UI Chrome Job x 5
338340
339-
on: [push]
341+
on: push
340342
341343
jobs:
342344
install:
@@ -362,7 +364,7 @@ jobs:
362364
path: build
363365
364366
- name: 'UI Tests - Chrome'
365-
uses: cypress-io/github-action@v5.x.x # use the explicit version number
367+
uses: cypress-io/github-action@v5
366368
with:
367369
# we have already installed all dependencies above
368370
install: false
@@ -486,7 +488,7 @@ identification of each build to avoid confusion when re-running a build.
486488

487489
```
488490
name: Cypress tests
489-
on: [push]
491+
on: push
490492
jobs:
491493
cypress-run:
492494
name: Cypress run
@@ -496,7 +498,7 @@ jobs:
496498
uses: actions/checkout@v3
497499

498500
- name: Cypress run
499-
uses: cypress-io/github-action@v5.x.x # use the explicit version number
501+
uses: cypress-io/github-action@v5
500502
with:
501503
record: true
502504
env:
@@ -513,7 +515,7 @@ details.
513515
514516
```
515517
name: Cypress tests
516-
on: [push]
518+
on: push
517519
jobs:
518520
cypress-run:
519521
name: Cypress run
@@ -523,7 +525,7 @@ jobs:
523525
uses: actions/checkout@v3
524526

525527
- name: Cypress run
526-
uses: cypress-io/github-action@v5.x.x # use the explicit version number
528+
uses: cypress-io/github-action@v5
527529
with:
528530
record: true
529531
env:

0 commit comments

Comments
 (0)