-
Notifications
You must be signed in to change notification settings - Fork 528
43 lines (34 loc) · 1.2 KB
/
create-index.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
name: create-index
on:
push:
branches: [ master ]
jobs:
update:
runs-on: ubuntu-20.04
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: update
env:
GITHUB_TOKEN: ${{ secrets.TOKEN }}
run: |
sed -i '/<!-- marker -->/,$ d' README.md
(
echo '<!-- marker -->'
for directory in cheat-sheet examples; do
oldgroup=
printf "\n## %s Index\n\n" $(echo "$directory" | sed -e "s/\b\(.\)/\u\1/g")
while IFS=/ read -r dot group file; do
name="$(basename "$file" .md)"
if [ "$oldgroup" != "$group" ]; then
echo "<br/><span class='group'><b>$group</b></span>"
oldgroup="$group"
fi
echo " | <a class='topic' href='https://lzone.de/$directory/$name'>$name</a>"
done < <(cd $directory/ && find . -mindepth 2 -name "*.md" | sort)
done
) >>README.md
git config user.email "[email protected]"
git config user.name "Create Index Workflow"
git commit -m "Update index." README.md || exit 0
git push