Skip to content

Commit 9b85f24

Browse files
MikeMcC399AtofStrykeremilyrohrbough
authored
docs: update submission instructions in DEVELOPMENT.md (#853)
Co-authored-by: Bill Glesias <[email protected]> Co-authored-by: Emily Rohrbough <[email protected]>
1 parent 2ff56a1 commit 9b85f24

File tree

1 file changed

+79
-34
lines changed

1 file changed

+79
-34
lines changed

DEVELOPMENT.md

+79-34
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,82 @@
11
# Development
22

3-
## Testing via examples
4-
5-
1. Add a new example project in `examples` folder. It is a regular NPM package with its own `package.json` and Cypress dev dependency.
6-
1. Add a corresponding `.github/workflows` YAML file that uses this action and runs inside `examples/X` working directory. The example should demonstrate the feature
7-
1. Add workflow badge to README if needed
8-
9-
## Testing against another repo
10-
11-
1. Create a new local branch for any development, for example `git checkout -b featureA`
12-
1. Update the source code in [index.js](index.js)
13-
1. Build `dist` file(s) using `npm run build`
14-
1. Commit any changed files, note the SHA of the commit
15-
1. Push the local branch to GitHub
16-
1. In a test repository, create a test branch, change the action to point at the new commit. Example
17-
18-
```yml
19-
name: End-to-end tests
20-
on: push
21-
jobs:
22-
cypress-run:
23-
runs-on: 22.04
24-
steps:
25-
- uses: actions/checkout@v3
26-
# use specific commit pushed to GitHub
27-
- uses: cypress-io/github-action@<full commit SHA>
3+
This document describes topics useful to contributors to this repository. The repository's purpose is to provide a GitHub JavaScript action which is published to:
4+
5+
1. npm's JavaScript Package Registry as [@cypress/github-action](https://www.npmjs.com/package/@cypress/github-action)
6+
2. GitHub's Marketplace as [cypress-io/github-action](https://github.com/marketplace/actions/cypress-io#cypress-iogithub-action--)
7+
8+
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.
9+
10+
## Providing fixes or features
11+
12+
If you are submitting a Pull Request (PR) to provide a fix or feature for the action, the following is relevant to you:
13+
14+
The main source code elements for the action are:
15+
- [action.yml](action.yml)
16+
- [index.js](index.js)
17+
- [src/ping.js](src/ping.js)
18+
19+
The action runs from the [dist](dist) directory, which requires a `build` step to set up. This step uses [@vercel/ncc](https://github.com/vercel/ncc) to compile the code and modules into one file used for distribution.
20+
21+
To contribute changes, follow these instructions in the order given below:
22+
23+
1. If you are a new external contributor, then first fork the repository (see GitHub documentation [About forks](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/about-forks)).
24+
1. Create a new branch with a meaningful name e.g. `fix/my-bug` based on the current `master` branch.
25+
1. Make the necessary source code changes, including additions or changes to the [README.md](./README.md) documentation if parameters are added or affected.
26+
1. Ensure you are using [Node.js LTS](https://nodejs.org/en).
27+
1. Execute the following in the root directory of the cloned repository
28+
29+
```bash
30+
npm install
31+
npm run format
32+
npm run build
33+
```
34+
35+
6. Commit the change. (If you are working on Microsoft Windows, see [Windows users](#windows-users) below.)
36+
1. Push to the repository.
37+
1. If you are working in a fork, ensure actions are enabled.
38+
1. Refer to [Manually running a workflow](https://docs.github.com/en/actions/managing-workflow-runs/manually-running-a-workflow) to use this to test any particular workflow affected by your change.
39+
1. Open a draft PR with a title which starts with `fix:` or `feat:` if a new release should be triggered by the PR. For more details on the release process, see the section [Merging pull requests](#merging-pull-requests) below.
40+
1. Note that first-time submitters must sign the CLA agreement and be approved to run workflows.
41+
1. Check that all tests which are triggered by the PR were either successful or were skipped.
42+
1. If the PR is showing that the tests were successful mark the PR as Ready for Review.
43+
44+
### Windows users
45+
46+
The repository is set up with a `git` / `Husky` pre-commit hook which ensures that any changes to the core source files are formatted and built consistently before they are committed. This does not work well with [GitHub Desktop](https://docs.github.com/en/desktop). You can disable this function by setting an environment variable `HUSKY=0`. If you do this and then omit to use `npm run format` / `npm run build` before you commit any changes affecting the core source files, you will find that checks fail when you submit a PR. In this case you should run the format and build commands and amend your commit.
47+
48+
## Adding a new example
49+
50+
1. If you are creating a new example, add this as a new project in the `examples` directory. An example project is a regular NPM package with its own `package.json` and Cypress dev dependency. (Note: Legacy `examples/v9` should not be extended.)
51+
2. Add a corresponding `.github/workflows` YAML file that uses this action and runs using your new `examples/X` through the `working-directory` parameter. The example should demonstrate any new feature.
52+
3. Add a workflow status badge to the [README.md](README.md) file (see [Adding a workflow status badge](https://docs.github.com/en/actions/monitoring-and-troubleshooting-workflows/adding-a-workflow-status-badge)), like the following:
53+
54+
[![Chrome example](https://github.com/cypress-io/github-action/workflows/example-chrome/badge.svg?branch=master)](.github/workflows/example-chrome.yml)
55+
56+
## External Testing
57+
58+
The example workflows in [.github/workflows](./.github/workflows) specify
59+
60+
`uses: ./`
61+
62+
which calls the action code from the branch they are running in when the workflow is run directly in the repository here.
63+
64+
From another (external) repository, the production version of the action is called with
65+
66+
```yaml
67+
- uses: cypress-io/github-action@v5
2868
```
2969
30-
You can use [cypress-gh-action-example](https://github.com/bahmutov/cypress-gh-action-example) or [cypress-gh-action-monorepo](https://github.com/bahmutov/cypress-gh-action-monorepo) as test projects.
70+
To test out a branch in development calling it from another repository, replace `v5` by the name of your branch. If your branch is in a fork, then also replace `cypress-io` by your own GitHub username in the form:
71+
72+
`- uses: <your-username>/github-action@<your-branch>`
3173

32-
7. Push the change and make sure the new feature performs correctly. If yes, open a pull request.
74+
## Merging pull requests
3375

34-
**For pull request reviewers:**
76+
This information is for Cypress.io Members or Collaborators who merge pull requests:
3577

36-
1. When merging a pull request, squash all commits into one.
37-
1. Make sure the commit subject and body follow [semantic commit convention](https://semantic-release.gitbook.io/semantic-release/#commit-message-format). For instance, keeping it simple:
78+
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.
79+
1. Make sure the commit subject and body follow [semantic commit convention](https://semantic-release.gitbook.io/semantic-release/#commit-message-format), for instance:
3880

3981
```text
4082
feat: added new parameter
@@ -46,14 +88,15 @@ If you need to bump the major version, mark it as breaking change in the body of
4688
```text
4789
fix: upgrade dependency X
4890
49-
BREAKING CHANGE: requires minimum Node.js 14 to run
91+
BREAKING CHANGE: requires minimum Node.js 16 to run
5092
```
5193

52-
3. New versions of this action will be released automatically by the CI, 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 `/v5` branch. Thus specifying `- uses: cypress-io/github-action@v5` selects the new version automatically.
94+
3. New versions of this action will be released automatically by the CI when merged to master, 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 `v5` branch. Thus specifying `uses: cypress-io/github-action@v5` selects the new version automatically. This **will not** push the latest release to Github Marketplace.
95+
4. 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.
5396

54-
## Updating the latest version in GitHub Marketplace
97+
## GitHub Marketplace publication
5598

56-
Seems to be a manual process right now. After a new release has been created, go to the release and click "Edit"
99+
Publishing a new release to the GitHub Marketplace is a manual process. After a new release has been created, go to the release and click "Edit"
57100

58101
![Edit the release](images/edit-release.png)
59102

@@ -64,3 +107,5 @@ Review the release info, make sure the "publish ..." checkbox is checked
64107
After clicking "Update the release" check that the Marketplace [https://github.com/marketplace/actions/cypress-io](https://github.com/marketplace/actions/cypress-io) has been updated.
65108

66109
![Latest release in marketplace](images/latest-release.png)
110+
111+
See also [Publishing actions in GitHub Marketplace](https://docs.github.com/en/actions/creating-actions/publishing-actions-in-github-marketplace).

0 commit comments

Comments
 (0)