|
1 |
| -if (($null -ne $env:LGTM_INDEX_INCLUDE) -or ($null -ne $env:LGTM_INDEX_EXCLUDE) -or ($null -ne $env:LGTM_INDEX_FILTERS)) { |
2 |
| - Write-Output 'Path filters set. Passing them through to the JavaScript extractor.' |
3 |
| -} else { |
4 |
| - Write-Output 'No path filters set. Using the default filters.' |
5 |
| - # Note: We're adding the `reusable_workflows` subdirectories to proactively |
6 |
| - # record workflows that were called cross-repo, check them out locally, |
7 |
| - # and enable an interprocedural analysis across the workflow files. |
8 |
| - # These workflows follow the convention `.github/reusable_workflows/<nwo>/*.ya?ml` |
9 |
| - $DefaultPathFilters = @( |
10 |
| - 'exclude:**/*', |
11 |
| - 'include:.github/workflows/*.yml', |
12 |
| - 'include:.github/workflows/*.yaml', |
13 |
| - 'include:.github/reusable_workflows/**/*.yml', |
14 |
| - 'include:.github/reusable_workflows/**/*.yaml', |
15 |
| - 'include:**/action.yml', |
16 |
| - 'include:**/action.yaml' |
17 |
| - ) |
| 1 | +# Note: We're adding the `reusable_workflows` subdirectories to proactively |
| 2 | +# record workflows that were called cross-repo, check them out locally, |
| 3 | +# and enable an interprocedural analysis across the workflow files. |
| 4 | +# These workflows follow the convention `.github/reusable_workflows/<nwo>/*.ya?ml` |
| 5 | +$DefaultPathFilters = @( |
| 6 | + 'exclude:**/*', |
| 7 | + 'include:.github/workflows/*.yml', |
| 8 | + 'include:.github/workflows/*.yaml', |
| 9 | + 'include:.github/reusable_workflows/**/*.yml', |
| 10 | + 'include:.github/reusable_workflows/**/*.yaml', |
| 11 | + 'include:**/action.yml', |
| 12 | + 'include:**/action.yaml' |
| 13 | +) |
18 | 14 |
|
| 15 | +if ($null -ne $env:LGTM_INDEX_FILTERS) { |
| 16 | + Write-Output 'LGTM_INDEX_FILTERS set. Using the default filters together with the user-provided filters, and passing through to the JavaScript extractor.' |
| 17 | + # Begin with the default path inclusions only, |
| 18 | + # followed by the user-provided filters. |
| 19 | + # If the user provided `paths`, those patterns override the default inclusions |
| 20 | + # (because `LGTM_INDEX_FILTERS` will begin with `exclude:**/*`). |
| 21 | + # If the user provided `paths-ignore`, those patterns are excluded. |
| 22 | + $PathFilters = ($DefaultPathFilters -join "`n") + "`n" + $env:LGTM_INDEX_FILTERS |
| 23 | + $env:LGTM_INDEX_FILTERS = $PathFilters |
| 24 | +} else { |
| 25 | + Write-Output 'LGTM_INDEX_FILTERS not set. Using the default filters, and passing through to the JavaScript extractor.' |
19 | 26 | $env:LGTM_INDEX_FILTERS = $DefaultPathFilters -join "`n"
|
20 | 27 | }
|
21 | 28 |
|
|
0 commit comments