mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-05-24 09:41:50 +02:00
Update weekly_stats.yaml
This commit is contained in:
29
.github/workflows/weekly_stats.yaml
vendored
29
.github/workflows/weekly_stats.yaml
vendored
@@ -3,7 +3,7 @@
|
|||||||
name: Generate weekly stats
|
name: Generate weekly stats
|
||||||
on:
|
on:
|
||||||
schedule:
|
schedule:
|
||||||
- cron: "0 0 * * 0"
|
- cron: "0 23 * * 5"
|
||||||
workflow_dispatch: null
|
workflow_dispatch: null
|
||||||
jobs:
|
jobs:
|
||||||
stats_updater:
|
stats_updater:
|
||||||
@@ -19,14 +19,15 @@ jobs:
|
|||||||
COUNT2=0
|
COUNT2=0
|
||||||
COUNT3=0
|
COUNT3=0
|
||||||
# Make sure file exists
|
# Make sure file exists
|
||||||
touch Stats
|
file=Stats
|
||||||
if ! grep -q "Date" Stats; then
|
touch "$file"
|
||||||
sed -i "1i Date" Stats
|
if ! grep -q "Date" "$file"; then
|
||||||
|
sed -i "1i Date" "$file"
|
||||||
fi
|
fi
|
||||||
# Add new column
|
# Add new column
|
||||||
sed -i 's/^/- /' a
|
sed -i 's/^/- /' "$file"
|
||||||
# Add date
|
# Add date
|
||||||
sed -i "/Date/s|^-|$(date '+%Y-%m-%d')|" a
|
sed -i "/Date/s|^-|$(date '+%Y-%m-%d')|" "$file"
|
||||||
|
|
||||||
# Go through all folders, add to filters if not existing
|
# Go through all folders, add to filters if not existing
|
||||||
# shellcheck disable=SC2086
|
# shellcheck disable=SC2086
|
||||||
@@ -52,24 +53,24 @@ jobs:
|
|||||||
COUNT3="$COUNT"
|
COUNT3="$COUNT"
|
||||||
echo "$COUNT $ARCH users with $SLUG" && DOWNLOADS="$(( DOWNLOADS + COUNT))"
|
echo "$COUNT $ARCH users with $SLUG" && DOWNLOADS="$(( DOWNLOADS + COUNT))"
|
||||||
else COUNT3="-";fi
|
else COUNT3="-";fi
|
||||||
echo "$SLUG $DOWNLOADS $COUNT1 $COUNT2 $COUNT3" >> Stats
|
echo "$SLUG $DOWNLOADS $COUNT1 $COUNT2 $COUNT3" >> "$file"2
|
||||||
# Create line if not existing
|
# Create line if not existing
|
||||||
if ! grep -q "$SLUG" Stats; then
|
if ! grep -q "$SLUG" "$file"; then
|
||||||
sed -ie "\$a$SLUG" Stats
|
sed -ie "\$a$SLUG" "$file"
|
||||||
# shellcheck disable=SC2046
|
# shellcheck disable=SC2046
|
||||||
for i in $(seq $(head -n 1 Stats | tr -cd ' \t' | wc -c )); do
|
for i in $(seq $(head -n 1 $file | tr -cd ' \t' | wc -c )); do
|
||||||
echo "$i"
|
echo "$i"
|
||||||
sed -i "/$slug/s|^|- |" Stats
|
sed -i "/$slug/s|^|- |" "$file"
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
# Add data
|
# Add data
|
||||||
sed -i "/$SLUG/s|^-|$DOWNLOADS|" a
|
sed -i "/$SLUG/s|^-|$DOWNLOADS|" "$file"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
# Make stats
|
# Make stats
|
||||||
sort -k1 -r -n Stats > tmp && mv tmp Stats
|
sort -k1 -r -n "$file" > tmp && mv tmp "$file"
|
||||||
#sed -i "1i Name Total armv7 amd64 aarch64" Stats
|
#sed -i "1i Name Total armv7 amd64 aarch64" "$file"
|
||||||
#TOTAL="$(awk '{SUM+=$2}END{print SUM}' Stats)"
|
#TOTAL="$(awk '{SUM+=$2}END{print SUM}' Stats)"
|
||||||
#TOTAL1="$(awk '{SUM+=$2}END{print SUM}' Stats)"
|
#TOTAL1="$(awk '{SUM+=$2}END{print SUM}' Stats)"
|
||||||
#TOTAL2="$(awk '{SUM+=$2}END{print SUM}' Stats)"
|
#TOTAL2="$(awk '{SUM+=$2}END{print SUM}' Stats)"
|
||||||
|
|||||||
Reference in New Issue
Block a user