Skip to content

Commit ec3ec42

Browse files
authored
docs: prettier format markdown documents (#1375)
* docs: prettier format markdown documents * Change script name check:markdown-links
1 parent f4747db commit ec3ec42

File tree

10 files changed

+61
-42
lines changed

10 files changed

+61
-42
lines changed

.github/workflows/check-markdown.yml

+8-4
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,15 @@ on:
77
workflow_dispatch:
88

99
jobs:
10-
check-markdown-links:
10+
check-markdown:
1111
runs-on: ubuntu-24.04
12-
name: Check links in Markdown files
12+
name: Check Markdown files
1313
steps:
1414
- name: Checkout
1515
uses: actions/checkout@v4
16-
- run: npm ci
17-
- run: npm run check:markdown
16+
- name: Install dependencies
17+
run: npm ci
18+
- name: Check Markdown links
19+
run: npm run check:markdown-links
20+
- name: Check Markdown formatting
21+
run: npm run format:markdown:check

.prettierignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/LICENSE.md

CHANGELOG.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,4 @@ See [Releases](https://github.com/cypress-io/github-action/releases) for full de
3030
| v4.0.0 | Support for Cypress 10 and later versions added. |
3131
| v3 | Action runs under Node.js 16 instead of Node.js 12. |
3232
| v2 | Cypress runs using the [Module API](https://docs.cypress.io/guides/guides/module-api) instead of being started via the command line. |
33-
| v1 | *This version is no longer runnable in GitHub due to security changes.* |
33+
| v1 | _This version is no longer runnable in GitHub due to security changes._ |

CONTRIBUTING.md

+22-16
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
Thanks for taking the time to contribute! :smile:
44

5-
*To contribute to the main Cypress product, please read the related [CONTRIBUTING](https://github.com/cypress-io/cypress/blob/develop/CONTRIBUTING.md) document, which also contains useful general tips.*
5+
_To contribute to the main Cypress product, please read the related [CONTRIBUTING](https://github.com/cypress-io/cypress/blob/develop/CONTRIBUTING.md) document, which also contains useful general tips._
66

77
To contribute to the [cypress-io/github-action](https://github.com/cypress-io/github-action) repository, please continue reading here.
88

@@ -17,7 +17,6 @@ This document describes topics useful to contributors to this repository. The re
1717
1. GitHub's Marketplace as [cypress-io/github-action](https://github.com/marketplace/actions/cypress-io#cypress-iogithub-action--)
1818
2. npm's JavaScript Package Registry as [@cypress/github-action](https://www.npmjs.com/package/@cypress/github-action)
1919

20-
2120
You can read the GitHub document [Creating a JavaScript action](https://docs.github.com/en/actions/creating-actions/creating-a-javascript-action) for background information on how JavaScript actions for GitHub are created and how they work.
2221

2322
### Requirements
@@ -31,6 +30,7 @@ You must have the following installed on your system to contribute locally:
3130
If you are submitting a Pull Request (PR) to provide a fix or feature for the action, the following is relevant to you:
3231

3332
The main source code elements for the action are:
33+
3434
- [action.yml](action.yml)
3535
- [index.js](index.js)
3636
- [src/ping.js](src/ping.js)
@@ -45,11 +45,17 @@ To contribute changes, follow these instructions in the order given below:
4545
1. Make the necessary source code changes, including additions or changes to the [README.md](./README.md) documentation if parameters are added or affected.
4646
1. Execute the following in the root directory of the cloned repository
4747

48-
```bash
49-
npm install
50-
npm run format
51-
npm run build
52-
```
48+
```bash
49+
npm install
50+
npm run format
51+
npm run build
52+
```
53+
54+
1. If you have modified any Markdown documents (`*.md`) then execute
55+
56+
```bash
57+
npm run format:markdown
58+
```
5359

5460
1. Commit the change. (If you are working on Microsoft Windows, see [Windows users](#windows-users) below.)
5561
1. Push to the repository.
@@ -97,18 +103,18 @@ This information is for Cypress.io Members or Collaborators who merge pull reque
97103
1. When merging a pull request, use the [Squash and merge](https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/configuring-pull-request-merges/about-merge-methods-on-github#squashing-your-merge-commits) option to squash all commits into one.
98104
1. Make sure the commit subject and body follow [semantic commit convention](https://semantic-release.gitbook.io/semantic-release/#commit-message-format), for instance:
99105

100-
```text
101-
feat: added new parameter
102-
fix: fixed a bug
103-
```
106+
```text
107+
feat: added new parameter
108+
fix: fixed a bug
109+
```
104110

105-
If you need to bump the major version, mark it as breaking change in the body of the commit's message like:
111+
If you need to bump the major version, mark it as breaking change in the body of the commit's message like:
106112

107-
```text
108-
fix: upgrade dependency X
113+
```text
114+
fix: upgrade dependency X
109115
110-
BREAKING CHANGE: requires minimum Node.js 18 to run
111-
```
116+
BREAKING CHANGE: requires minimum Node.js 18 to run
117+
```
112118

113119
1. New versions of this action will be released automatically by the CI when merged to the `master` branch, see [.github/workflows/main.yml](.github/workflows/main.yml). This will create a new [GitHub release](https://github.com/cypress-io/github-action/releases) and will update the current highest branch from the series `v5`, `v6`, ... etc. Thus specifying `uses: cypress-io/github-action@v6` (or higher version if available) selects the new version automatically. This **will not** push the latest release to GitHub Marketplace.
114120
1. The action's CI is configured to use the [default Angular release rules](https://github.com/semantic-release/commit-analyzer/blob/master/lib/default-release-rules.js). This means that only `feat:`, `fix:` and `perf:` trigger a new release which is then logged to the [releases](https://github.com/cypress-io/github-action/releases) page. Other Angular commit types listed on [Contributing to Angular](https://github.com/angular/angular/blob/main/CONTRIBUTING.md#-commit-message-format) can be used for documentation purposes, however they are ignored by the currently configured release process.

README.md

+15-13
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
# cypress-io/github-action [![Action status][ci-badge]][ci-workflow] [![cypress][cloud-badge]][cloud-project] [![renovate-app badge][renovate-badge]][renovate-bot]
22

3-
> [GitHub Action](https://docs.github.com/en/actions) for running [Cypress](https://www.cypress.io) end-to-end and component tests. Includes npm, pnpm and Yarn installation, custom caching and lots of configuration options.
3+
> [GitHub Action](https://docs.github.com/en/actions) for running [Cypress](https://www.cypress.io) end-to-end and component tests. Includes npm, pnpm and Yarn installation, custom caching and lots of configuration options.
44
5-
Placing `use: cypress-io/github-action@v6` into a GitHub Action workflow gives you a simple way to run Cypress. The action takes the project's npm, pnpm or Yarn package manager lock file, installs dependencies and caches these dependencies for future use. It then proceeds to run Cypress end-to-end tests with the built-in Electron browser and provides a test summary after completion.
5+
Placing `use: cypress-io/github-action@v6` into a GitHub Action workflow gives you a simple way to run Cypress. The action takes the project's npm, pnpm or Yarn package manager lock file, installs dependencies and caches these dependencies for future use. It then proceeds to run Cypress end-to-end tests with the built-in Electron browser and provides a test summary after completion.
66

7-
If you are testing against a running server like the [Cypress Kitchen Sink showcase example](https://example.cypress.io/) on https://example.cypress.io/ no other parameters are necessary. In other cases where you need to fire up a development server, you can add the [start](#start-server) parameter to the workflow. Browse through the examples to find other useful parameters.
7+
If you are testing against a running server like the [Cypress Kitchen Sink showcase example](https://example.cypress.io/) on https://example.cypress.io/ no other parameters are necessary. In other cases where you need to fire up a development server, you can add the [start](#start-server) parameter to the workflow. Browse through the examples to find other useful parameters.
88

99
## Examples
1010

@@ -452,9 +452,11 @@ Please refer to the [default GitHub environment variables](https://docs.github.c
452452
When recording runs to Cypress Cloud, the PR number and URL can be automatically detected if you pass `GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}`
453453
via the workflow `env`. When set, this value enables the Action to perform additional logic that grabs the related PR number and URL (if they
454454
exist) and sets them in the environment variables `CYPRESS_PULL_REQUEST_ID` and `CYPRESS_PULL_REQUEST_URL`, respectively.
455-
* See Cypress' documentation on [CI Build Information](https://on.cypress.io/guides/continuous-integration/introduction#CI-Build-Information)
455+
456+
- See Cypress' documentation on [CI Build Information](https://on.cypress.io/guides/continuous-integration/introduction#CI-Build-Information)
456457

457458
Example workflow using the variables:
459+
458460
```yml
459461
name: Example echo PR number and URL
460462
on: push
@@ -571,7 +573,6 @@ jobs:
571573
runs-on: ubuntu-24.04
572574
name: E2E
573575
steps:
574-
575576
- name: Checkout
576577
uses: actions/checkout@v4
577578
@@ -736,6 +737,7 @@ The Cypress GH Action does not spawn or create any additional containers - it on
736737
If you use the GitHub Actions facility for [Re-running workflows and jobs](https://docs.github.com/en/actions/managing-workflow-runs/re-running-workflows-and-jobs), note that [Re-running failed jobs in a workflow](https://docs.github.com/en/actions/managing-workflow-runs/re-running-workflows-and-jobs?tool=webui#re-running-failed-jobs-in-a-workflow) is not suited for use with parallel recording into Cypress Cloud. Re-running failed jobs in this situation does not simply re-run failed Cypress tests. Instead it re-runs **all** Cypress tests, load-balanced over the containers with failed jobs.
737738

738739
To optimize runs when there are failing tests present, refer to optional [Cypress Cloud Smart Orchestration](https://docs.cypress.io/cloud/features/smart-orchestration/overview/) Premium features:
740+
739741
- [Spec Prioritization](https://docs.cypress.io/cloud/features/smart-orchestration/spec-prioritization)
740742
- [Auto Cancellation](https://docs.cypress.io/guides/cloud/smart-orchestration/run-cancellation). See also [Specify auto cancel after failures](#specify-auto-cancel-after-failures) for details of how to set this option in a Cypress GH Action workflow.
741743

@@ -796,6 +798,7 @@ jobs:
796798
with:
797799
start: npm start
798800
```
801+
799802
**Caution:** use the `start` parameter only to start a server, not to run Cypress, otherwise tests may be run twice. The action runs Cypress tests by default, unless the parameter `runTests` is set to `false`.
800803

801804
**Note:** sometimes on Windows you need to run a different start command. You can use the `start-windows` parameter for this.
@@ -888,8 +891,6 @@ By default, `wait-on` will retry for 60 seconds. You can pass a custom timeout i
888891
wait-on-timeout: 120
889892
```
890893

891-
892-
893894
You can wait for multiple URLs to respond by separating urls with a comma
894895

895896
```yml
@@ -1064,7 +1065,7 @@ repo/
10641065
package-lock.json
10651066
```
10661067

1067-
We use `working-directory: app-test` to match the above example directory structure:
1068+
We use `working-directory: app-test` to match the above example directory structure:
10681069

10691070
```yml
10701071
on: push
@@ -1429,11 +1430,11 @@ jobs:
14291430

14301431
This action installs local dependencies using lock files. Ensure that exactly one type of lock file is used for each project or working-directory from the following supported package managers:
14311432

1432-
| Lock file | Package Manager | Installation command |
1433-
| ------------------- | ------------------------------------------------------------------------------------------------ | -------------------------------- |
1434-
| `package-lock.json` | [npm](https://docs.npmjs.com/cli/v9/commands/npm-ci) | `npm ci` |
1435-
| `pnpm-lock.yaml` | [pnpm](https://pnpm.io/cli/install#--frozen-lockfile) | `pnpm install --frozen-lockfile` |
1436-
| `yarn.lock` | [Yarn Classic](https://classic.yarnpkg.com/en/docs/cli/install#toc-yarn-install-frozen-lockfile) | `yarn --frozen-lockfile` |
1433+
| Lock file | Package Manager | Installation command |
1434+
| ------------------- | ------------------------------------------------------------------------------------------------ | -------------------------------- |
1435+
| `package-lock.json` | [npm](https://docs.npmjs.com/cli/v9/commands/npm-ci) | `npm ci` |
1436+
| `pnpm-lock.yaml` | [pnpm](https://pnpm.io/cli/install#--frozen-lockfile) | `pnpm install --frozen-lockfile` |
1437+
| `yarn.lock` | [Yarn Classic](https://classic.yarnpkg.com/en/docs/cli/install#toc-yarn-install-frozen-lockfile) | `yarn --frozen-lockfile` |
14371438

14381439
See section [Yarn Modern](#yarn-modern) for information about using Yarn version 2 and later.
14391440

@@ -1697,6 +1698,7 @@ Please see our [Contributing Guideline](./CONTRIBUTING.md) which explains how to
16971698
This project is licensed under the terms of the [MIT license][license-file].
16981699

16991700
<!-- badge links follow -->
1701+
17001702
[ci-badge]: https://github.com/cypress-io/github-action/actions/workflows/main.yml/badge.svg
17011703
[ci-workflow]: https://github.com/cypress-io/github-action/actions/workflows/main.yml
17021704
[cloud-badge]: https://img.shields.io/endpoint?url=https://cloud.cypress.io/badge/simple/3tb7jn/master&style=flat&logo=cypress

docs/MAINTENANCE.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ The [examples](../examples) directory contains examples of the use of Cypress (C
88

99
The examples make use of [npm](https://www.npmjs.com/), [pnpm](https://pnpm.io/), [Yarn 1 (Classic)](https://classic.yarnpkg.com/) and [Yarn Modern](https://yarnpkg.com/) to define and install the packages being used. For [Yarn Modern](https://yarnpkg.com/) the recommended [Corepack](https://yarnpkg.com/corepack) is used as a Yarn version manager.
1010

11-
*The previous [examples/v9](https://github.com/cypress-io/github-action/tree/v5/examples/v9) are archived in the [v5](https://github.com/cypress-io/github-action/tree/v5/) branch. This directory contains examples which were set up to use Cypress `9.7.0`, the last version using Legacy Configuration, covering Cypress 9 and below. These `v9` examples are no longer maintained.
11+
_The previous [examples/v9](https://github.com/cypress-io/github-action/tree/v5/examples/v9) are archived in the [v5](https://github.com/cypress-io/github-action/tree/v5/) branch. This directory contains examples which were set up to use Cypress `9.7.0`, the last version using Legacy Configuration, covering Cypress 9 and below. These `v9` examples are no longer maintained._
1212

1313
## Requirements
1414

examples/component-tests/README.md

+8-6
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,18 @@
33
This example was built as follows:
44

55
1. [Vite > Getting Started](https://vitejs.dev/guide/) instructions with the [react](https://vite.new/react) template were used to create the app
6-
```bash
7-
npm create vite@latest component-tests -- --template react
8-
```
9-
The linting `npm` modules and linting script have been removed, since this is out-of-scope for the example.
6+
```bash
7+
npm create vite@latest component-tests -- --template react
8+
```
9+
The linting `npm` modules and linting script have been removed, since this is out-of-scope for the example.
1010
1. The Cypress documentation instructions from [Component Testing > Getting Started](https://on.cypress.io/guides/component-testing/getting-started) were followed to set up component testing, including copying
1111

12-
- `<Stepper />` component: [react/my-awesome-app/src/components/Stepper.jsx](https://github.com/cypress-io/component-testing-quickstart-apps/blob/main/react/my-awesome-app/src/components/Stepper.jsx)
12+
- `<Stepper />` component: [react/my-awesome-app/src/components/Stepper.jsx](https://github.com/cypress-io/component-testing-quickstart-apps/blob/main/react/my-awesome-app/src/components/Stepper.jsx)
13+
14+
from the [Cypress Component Testing Quickstart Apps](https://github.com/cypress-io/component-testing-quickstart-apps) repo to this repo's `examples/component-tests/src/components/` sub-directory.
1315

14-
from the [Cypress Component Testing Quickstart Apps](https://github.com/cypress-io/component-testing-quickstart-apps) repo to this repo's `examples/component-tests/src/components/` sub-directory.
1516
1. The script `"test": "cypress run --component"` was added to `package.json`.
17+
1618
## Execution
1719

1820
Execute the following to change to this directory:

examples/install-only/README.md

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# example: install-only
2+
23
> Do not install _every_ dependency, just Cypress before running tests
34
45
This example has production and development dependencies, but only installs Cypress to test already deployed URL.

examples/recording/README.md

+1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ Access "Project settings" in Cypress Cloud and copy the contents of each of the
1818
| Record Keys | EXAMPLE_RECORDING_KEY | Actions secrets |
1919

2020
Refer to the GitHub documentation
21+
2122
- [Creating encrypted secrets for a repository](https://docs.github.com/en/actions/security-guides/encrypted-secrets#creating-encrypted-secrets-for-a-repository).
2223

2324
When you have done this, the example recording will take the `projectId` from the `EXAMPLE_PROJECT_ID` variable instead of from the [cypress.config.js](cypress.config.js) configuration file.

package.json

+3-1
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,10 @@
1313
"test": "echo \"There are no tests :(\"",
1414
"build": "ncc build -o dist index.js",
1515
"format": "prettier --write index.js src/ping.js action.yml",
16+
"format:markdown": "prettier --write \"**/*.md\"",
17+
"format:markdown:check": "prettier --check \"**/*.md\"",
1618
"lint": "eslint",
17-
"check:markdown": "find *.md docs/*.md -print0 | xargs -0 -n1 markdown-link-check",
19+
"check:markdown-links": "find *.md docs/*.md -print0 | xargs -0 -n1 markdown-link-check",
1820
"update:cypress": "./scripts/update-cypress-latest.sh",
1921
"prepare": "husky"
2022
},

0 commit comments

Comments
 (0)