-
Notifications
You must be signed in to change notification settings - Fork 7
58 lines (53 loc) · 1.43 KB
/
list-modules.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
name: List modules
on:
push:
tags-ignore:
- '*'
branches:
- 'mainline'
pull_request:
workflow_dispatch:
jobs:
list-modules:
runs-on: self-hosted
env:
SEARCH_PATH: .
MAX_DEPTH: 2
outputs:
module-tree: ${{ steps.generate-tree.outputs.tree }}
steps:
- uses: actions/checkout@v3
- id: generate-tree
uses: adairrr/file-tree-to-json-action@v1-alpha
with:
search-path: ${{ env.SEARCH_PATH }}
max-depth: ${{ env.MAX_DEPTH }}
only-dirs: true
end-with-array: true
write-modules:
needs: list-modules
runs-on: self-hosted
env:
OUT_FILE: modules.json
steps:
- uses: actions/checkout@v3
- name: Write modules output file
uses: "DamianReeves/write-file-action@master"
with:
path: ${{ env.OUT_FILE }}
write-mode: overwrite
contents: ${{needs.list-modules.outputs.module-tree}}
- name: Compare the modules output file
id: diff
run: |
if [ "$(git diff --ignore-space-at-eol ${{ env.OUT_FILE }} | wc -l)" -eq "0" ]; then
echo "No changes detected in ${{ env.OUT_FILE }}."
exit 0
fi
- name: Commit & Push
uses: Andro999b/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: main
force: true
message: 'Update modules list.'