You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* `comment` - a text that bot will post when it won't find tests in the PR
29
+
* `fileExtensions` - extensions of the files that should be treated as a `source code`. Bot will do nothing if you just updating `README.md` because usually no tests are required to cover such change.
30
+
* `testDir` - folder, where tests are located. Make sure to set it correctly, otherwise bot will not be able to understand whether the test file was added or not.
31
+
* `testPattern` - a shell glob pattern that should match test files. For example, you can set it to `testPattern: *_test.go` and Bot will be able to understand, that added test has this pattern instead of located in `testDir`. `testDir` and `testPattern` are alternatives, however can be used together.
32
+
33
+
Both `testDir` and `testPattern` may be specified in a custom configuration, both settings will be used to locate test files.
34
+
If you want to change any of the settings, just add `.github/tests_checker.yml`:
35
+
36
+
How to override? You can configure the action by overriding any of the settings listed below
37
+
38
+
```yaml
39
+
- name: Require tests if source code is changed
40
+
uses: infection/tests-checker-action@v1
41
+
with:
42
+
fileExtensions: '.ts,.js'
43
+
testDir: '__tests__'
44
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
45
+
```
46
+
47
+
## Developing and contributing
18
48
19
49
> First, you'll need to have a reasonably modern version of `node` handy. This won't work with versions older than 9, for instance.
20
50
21
51
Install the dependencies
52
+
22
53
```bash
23
54
$ npm install
24
55
```
25
56
26
57
Build the typescript and package it for distribution
58
+
27
59
```bash
28
60
$ npm run build && npm run package
29
61
```
30
62
31
63
Run the tests :heavy_check_mark:
64
+
32
65
```bash
33
66
$ npm test
34
67
35
68
PASS ./index.test.js
36
-
✓ throws invalid number (3ms)
37
-
✓ wait 500 ms (504ms)
38
69
✓ test runs (95ms)
39
70
40
71
...
41
72
```
42
73
43
-
## Change action.yml
44
-
45
-
The action.yml defines the inputs and output for your action.
46
-
47
-
Update the action.yml with your name, description, inputs and outputs for your action.
48
-
49
-
See the [documentation](https://help.github.com/en/articles/metadata-syntax-for-github-actions)
50
-
51
-
## Change the Code
52
-
53
-
Most toolkit and CI/CD operations involve async operations so the action is run in an async function.
54
-
55
-
```javascript
56
-
import*ascorefrom'@actions/core';
57
-
...
58
-
59
-
asyncfunctionrun() {
60
-
try {
61
-
...
62
-
}
63
-
catch (error) {
64
-
core.setFailed(error.message);
65
-
}
66
-
}
67
-
68
-
run()
69
-
```
70
-
71
-
See the [toolkit documentation](https://github.com/actions/toolkit/blob/master/README.md#packages) for the various packages.
72
-
73
74
## Publish to a distribution branch
74
75
75
76
Actions are run from GitHub repos so we will checkin the packed dist folder.
@@ -87,19 +88,3 @@ Note: We recommend using the `--license` option for ncc, which will create a lic
87
88
Your action is now published! :rocket:
88
89
89
90
See the [versioning documentation](https://github.com/actions/toolkit/blob/master/docs/action-versioning.md)
90
-
91
-
## Validate
92
-
93
-
You can now validate the action by referencing `./` in a workflow in your repo (see [test.yml](.github/workflows/test.yml))
94
-
95
-
```yaml
96
-
uses: ./
97
-
with:
98
-
milliseconds: 1000
99
-
```
100
-
101
-
See the [actions tab](https://github.com/actions/typescript-action/actions) for runs of this action! :rocket:
102
-
103
-
## Usage:
104
-
105
-
After testing you can [create a v1 tag](https://github.com/actions/toolkit/blob/master/docs/action-versioning.md) to reference the stable and latest V1 action
0 commit comments