Skip to content

Commit 441c8a2

Browse files
Update CONTRIBUTING.md with instructions for local checks
1 parent c9e7520 commit 441c8a2

File tree

1 file changed

+25
-14
lines changed

1 file changed

+25
-14
lines changed

CONTRIBUTING.md

Lines changed: 25 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -58,29 +58,40 @@ A good patch is:
5858
3. Documented, adding API documentation as needed to cover new functions and properties.
5959
4. Accompanied by a great commit message, using our commit message template.
6060

61-
### Run `./scripts/soundness.sh`
61+
## Running CI workflows locally
6262

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

66-
Please make sure to `./scripts/soundness.sh` before pushing a change upstream, otherwise it is likely the PR validation will fail
67-
on minor changes such as a missing `self.` or similar formatting issues.
67+
```bash
68+
% act pull_request
69+
```
6870

69-
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:
71+
To run just a single job, use `workflow_call -j <job>`, and specify the inputs
72+
the job expects. For example, to run just shellcheck:
7073

7174
```bash
72-
cat << EOF > .git/hooks/pre-push
73-
74-
if [[ -f "scripts/soundness.sh" ]]; then
75-
scripts/soundness.sh
76-
fi
77-
EOF
75+
% act workflow_call -j soundness --input shell_check_enabled=true
7876
```
7977

80-
Which makes the script execute, and only allow the `git push` to complete if the check has passed.
78+
To bind-mount the working directory to the container, rather than a copy, use
79+
`--bind`. For example, to run just the formatting, and have the results
80+
reflected in your working directory:
81+
82+
```bash
83+
% act --bind workflow_call -j soundness --input format_check_enabled=true
84+
```
8185

82-
In the case of formatting issues, you can then `git add` the formatting changes, and attempt the push again.
86+
If you'd like `act` to always run with certain flags, these can be be placed in
87+
an `.actrc` file either in the current working directory or your home
88+
directory, for example:
8389

90+
```bash
91+
--container-architecture=linux/amd64
92+
--remote-name upstream
93+
--action-offline-mode
94+
```
8495
## How to contribute your work
8596

8697
Please open a pull request at https://github.com/apple/swift-openapi-urlsession. Make sure the CI passes, and then wait for code review.

0 commit comments

Comments
 (0)