Skip to content

Commit 4a96ad5

Browse files
Add docs to CONTRIBUTING.md on running workflows locally
1 parent 8c12274 commit 4a96ad5

File tree

1 file changed

+32
-5
lines changed

1 file changed

+32
-5
lines changed

CONTRIBUTING.md

Lines changed: 32 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,40 @@ A good patch is:
5454
3. Documented, adding API documentation as needed to cover new functions and properties.
5555
4. Accompanied by a great commit message, using our commit message template.
5656

57-
### Run `./scripts/soundness.sh`
57+
### Run CI checks locally
5858

59-
The scripts directory contains a [soundness.sh script](https://github.com/apple/swift-openapi-generator/blob/main/scripts/soundness.sh)
60-
that enforces additional checks, like license headers and formatting style.
59+
You can run the Github Actions workflows locally using
60+
[act](https://github.com/nektos/act). To run all the jobs that run on a pull
61+
request, use the following command:
6162

62-
Please make sure to `./scripts/soundness.sh` before pushing a change upstream, otherwise it is likely the PR validation will fail
63-
on minor changes such as a missing `self.` or similar formatting issues.
63+
```
64+
% act pull_request
65+
```
66+
67+
To run just a single job, use `workflow_call -j <job>`, and specify the inputs
68+
the job expects. For example, to run just shellcheck:
69+
70+
```
71+
% act workflow_call -j soundness --input shell_check_enabled=true
72+
```
73+
74+
To bind-mount the working directory to the container, rather than a copy, use
75+
`--bind`. For example, to run just the formatting, and have the results
76+
reflected in your working directory:
77+
78+
```
79+
% act --bind workflow_call -j soundness --input format_check_enabled=true
80+
```
81+
82+
If you'd like `act` to always run with certain flags, these can be be placed in
83+
an `.actrc` file either in the current working directory or your home
84+
directory, for example:
85+
86+
```
87+
--container-architecture=linux/amd64
88+
--remote-name upstream
89+
--action-offline-mode
90+
```
6491

6592
For frequent contributors, we recommend adding the script as a [git pre-push hook](https://git-scm.com/book/en/v2/Customizing-Git-Git-Hooks), which you can do via executing the following command in the project root directory:
6693

0 commit comments

Comments
 (0)