Update visual-ops.md #259
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |