Skip to content

Commit 1ad8cbb

Browse files
kabalinstronk7
authored andcommitted
docs: Add file ignoring configuration example for GHA.
1 parent 217de82 commit 1ad8cbb

File tree

1 file changed

+33
-3
lines changed

1 file changed

+33
-3
lines changed

docs/IgnoringFiles.md

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,9 @@ using specific PHP comments. For details see this
1212
[PHP_CodeSniffer wiki page](https://github.com/squizlabs/PHP_CodeSniffer/wiki/Advanced-Usage).
1313

1414
In addition, you can ignore additional files by defining `IGNORE_PATHS` and/or `IGNORE_NAMES` environment variables
15-
in your `.travis.yml` file. These environment variables wont work for Grunt tasks, but will for everything else.
16-
Example:
15+
in your CI workflow file. These environment variables wont work for Grunt tasks, but will for everything else.
16+
17+
`.travis.yml` example:
1718

1819
```yaml
1920
env:
@@ -26,13 +27,28 @@ env:
2627
- DB=mysqli
2728
```
2829
30+
`.github/workflow/*` example:
31+
32+
```yaml
33+
- name: Install moodle-plugin-ci
34+
run: |
35+
moodle-plugin-ci install --plugin ./plugin --db-host=127.0.0.1
36+
env:
37+
DB: ${{ matrix.database }}
38+
MOODLE_BRANCH: ${{ matrix.moodle-branch }}
39+
IGNORE_PATHS: 'vendor/widget,javascript/min-lib.js'
40+
IGNORE_NAMES: '*-m.js,bad_lib.php'
41+
```
42+
2943
Both environment variables take a CSV value. For `IGNORE_PATHS`, it takes relative file paths to ignore. File paths
3044
can be a simple string like `foo/bar` or a regular expression like `/^foo\/bar/`. For `IGNORE_NAMES`, it takes
3145
file names to ignore. File names can be a simple string like `foo.php`, a glob like `*.php` or a regular expression
3246
like `/\.php$/`.
3347

3448
If you need to specify ignore paths for a specific command, then you can define additional environment variables. The
35-
variable names are the same as above, but prefixed with `COMMANDNAME_`. Example:
49+
variable names are the same as above, but prefixed with `COMMANDNAME_`.
50+
51+
`.travis.yml` example:
3652

3753
```yaml
3854
env:
@@ -46,6 +62,20 @@ env:
4662
- DB=mysqli
4763
```
4864

65+
`.github/workflow/*` example:
66+
67+
```yaml
68+
- name: Install moodle-plugin-ci
69+
run: |
70+
moodle-plugin-ci install --plugin ./plugin --db-host=127.0.0.1
71+
env:
72+
DB: ${{ matrix.database }}
73+
MOODLE_BRANCH: ${{ matrix.moodle-branch }}
74+
CODECHECKER_IGNORE_PATHS: 'vendor/widget,javascript/min-lib.js'
75+
CODECHECKER_IGNORE_NAMES: '*-m.js,bad_lib.php'
76+
MUSTACHE_IGNORE_NAMES: 'broken.mustache'
77+
```
78+
4979
In the above example, we are adding the `cli` path to our ignore paths for the PHPUnit command (this is also how you
5080
can ignore files for code coverage). Please note that this is a complete override and there is no merging with
5181
`IGNORE_PATHS` and `IGNORE_NAMES`. So, in the above, the PHPUnit command would not ignore the file names

0 commit comments

Comments
 (0)