Skip to content

Commit 790a035

Browse files
committed
linting extracting the correct module
1 parent c206dda commit 790a035

1 file changed

Lines changed: 39 additions & 15 deletions

File tree

.github/workflows/linting.yaml

Lines changed: 39 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -17,29 +17,53 @@ jobs:
1717
runs-on: ubuntu-latest
1818

1919
outputs:
20-
modules: ${{ steps.filter.outputs.modules_files }}
21-
subworkflows: ${{ steps.filter.outputs.subworkflows_files }}
22-
20+
# https://github.com/dorny/paths-filter?tab=readme-ov-file#custom-processing-of-changed-files
21+
modules: ${{ steps.filter.outputs.modules }}
22+
modules_files: ${{ steps.module_names.outputs.result }}
23+
subworkflows: ${{ steps.filter.outputs.subworkflows }}
24+
subworkflows_files: ${{ steps.subworkflow_names.outputs.result }}
2325
steps:
24-
- uses: actions/checkout@v6
25-
26-
- uses: dorny/paths-filter@v3
26+
- uses: dorny/paths-filter@fbd0ab8f3e69293af611ebaee6363fc25e6d187d # v4
2727
id: filter
2828
with:
2929
filters: |
3030
modules:
31-
- 'modules/ensembl/**'
31+
- added|modified: 'modules/ensembl/**'
3232
subworkflows:
33-
- 'subworkflows/ensembl/**'
33+
- added|modified: 'subworkflows/ensembl/**'
34+
token: ""
3435
list-files: "json"
35-
36-
- name: Extract module names
37-
id: modules
36+
37+
- name: Get module name
38+
id: module_names
39+
with:
40+
script: |
41+
return [...new Set(${{ steps.filter.outputs.modules_files }}
42+
.filter(x => x.endsWith('main.nf') || x.endsWith('.nf.test.snap'))
43+
.map(path => path
44+
.replace('modules/ensembl/', '')
45+
.replace(/\/(main\.nf|tests\/.*)$/, '')
46+
)
47+
)];
48+
49+
- name: Get subworkflow name
50+
id: subworkflow_names
51+
with:
52+
script: |
53+
return [...new Set(${{ steps.filter.outputs.subworkflows_files }}
54+
.filter(x => x.endsWith('main.nf') || x.endsWith('.nf.test.snap'))
55+
.map(path => path
56+
.replace('subworkflows/nf-core/', '')
57+
.replace(/\/(main\.nf|tests\/.*)$/, '')
58+
)
59+
)];
60+
61+
- name: debug
3862
run: |
39-
echo '${{ steps.filter.outputs.modules_files }}' \
40-
| jq -r 'map((split("/")[2] + "/" + split("/")[3])) | unique' \
41-
> modules.json
42-
echo "modules=$(cat modules.json)" >> $GITHUB_OUTPUT
63+
echo ${{ steps.filter.outputs.modules_files }}
64+
echo ${{ steps.module_names.outputs.result }}
65+
echo ${{ steps.filter.outputs.subworkflows_files }}
66+
echo ${{ steps.subworkflow_names.outputs.result }}
4367
4468
nf-core-lint:
4569
name: nf-core lint

0 commit comments

Comments
 (0)