Update daily_README.yaml

This commit is contained in:
Alexandre
2022-12-02 14:11:18 +01:00
committed by GitHub
parent bd205b589b
commit 44a4043c0b

View File

@@ -1,12 +1,10 @@
# yamllint disable rule:line-length # yamllint disable rule:line-length
--- ---
name: Generate README name: Generate README
on: on:
schedule: schedule:
- cron: '0 17 * * *' - cron: 0 17 * * *
workflow_dispatch: workflow_dispatch: null
jobs: jobs:
README_updater: README_updater:
runs-on: ubuntu-20.04 runs-on: ubuntu-20.04
@@ -40,18 +38,24 @@ jobs:
# Sort yaml # Sort yaml
sort -t= ".github/paths-filter.yml" -o ".github/paths-filter.yml" sort -t= ".github/paths-filter.yml" -o ".github/paths-filter.yml"
- name: Create README file - name: Create README file
run: | run: >
# Init # Init
echo "Starting" echo "Starting"
# Prepare template # Prepare template
cp .templates/.README.md README2.md cp .templates/.README.md README2.md
ADDONSLINE=$(sed -n '/%%ADDONS_LIST%%/=' README2.md) ADDONSLINE=$(sed -n '/%%ADDONS_LIST%%/=' README2.md)
sed -i "/**ADDONS_LIST%%/d" README2.md sed -i "/**ADDONS_LIST%%/d" README2.md
# Sort folders by addon name # Sort folders by addon name
for f in $( find -- * -maxdepth 0 -type d | sort -r ); do for f in $( find -- * -maxdepth 0 -type d | sort -r ); do
if [ -f "$f"/config.json ]; then if [ -f "$f"/config.json ]; then
NAME=$(jq -r '.name' "$f"/config.json) NAME=$(jq -r '.name' "$f"/config.json)
@@ -62,7 +66,9 @@ jobs:
fi fi
done done
# Populate template # Populate template
find -- * -maxdepth 0 -type d | sort -r | while read -r f; do find -- * -maxdepth 0 -type d | sort -r | while read -r f; do
# $f is an addon directory # $f is an addon directory
if [ -f "$f/config.json" ]; then if [ -f "$f/config.json" ]; then
@@ -122,7 +128,9 @@ jobs:
sed -i "$ADDONSLINE"'a ✓ '"$ICON"' ['"$NAME"']('"$FOLDERNAME"'/) : '"$DESCRIPTION ($DOWNLOADS users)\\n" README2.md sed -i "$ADDONSLINE"'a ✓ '"$ICON"' ['"$NAME"']('"$FOLDERNAME"'/) : '"$DESCRIPTION ($DOWNLOADS users)\\n" README2.md
fi fi
done done
# Restore folders name # Restore folders name
find -- * -maxdepth 0 -type d | sort -r | while read -r f; do find -- * -maxdepth 0 -type d | sort -r | while read -r f; do
if [ -f "$f/oldname" ]; then if [ -f "$f/oldname" ]; then
NAME="$(cat "$f/oldname")" NAME="$(cat "$f/oldname")"
@@ -130,7 +138,9 @@ jobs:
mv "$f" "$NAME" mv "$f" "$NAME"
fi fi
done done
# Replace template if change # Replace template if change
if [[ "$(stat -c%s "README2.md")" == "$(stat -c%s "README.md")" ]]; then if [[ "$(stat -c%s "README2.md")" == "$(stat -c%s "README.md")" ]]; then
echo "no changes" echo "no changes"
rm README2.md rm README2.md