-
Notifications
You must be signed in to change notification settings - Fork 2
44 lines (37 loc) · 1.11 KB
/
workflow2mermaid.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
# Convert GitHub Actions workflow to Mermaid
name: Convert to Mermaid
on:
push:
branches:
- main
jobs:
convert:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y nodejs
- name: Convert workflow
run: |
echo '```mermaid\ngraph LR\n' > workflow.md
cat .github/workflows/cmake.yml | grep '^name: ' | while read line; do
name=$(echo $line | cut -d' ' -f2)
echo " $name[$name]" >> workflow-cmake.md
done
cat .github/workflows/cmake.yml | grep '^needs: ' | while read line; do
name=$(echo $line | cut -d' ' -f2)
needs=$(echo $line | cut -d' ' -f3-)
for need in $needs; do
echo " $name --> $need" >> workflow-cmake.md
done
done
echo '\n```' >> workflow-cmake.md
- name: Commit changes
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: 'Update Mermaid diagram'
push: true
branch: main