diff --git a/.github/workflows/daily_README.yaml b/.github/workflows/daily_README.yaml index 5bc5f9061..4965e135e 100644 --- a/.github/workflows/daily_README.yaml +++ b/.github/workflows/daily_README.yaml @@ -49,30 +49,34 @@ jobs: # Go through all folders, add to filters if not existing for f in $( find -- * -maxdepth 0 -type d | sort -r ); do + DOWNLOADS=0 if [ -f "$f"/config.json ]; then SLUG=$(jq -r '.image' "$f/config.json" | awk -F 'alexbelgium/|-{arch' '{print $2}') if [[ $(jq '.arch[]' "$f/config.json") == *"armv7"* ]]; then ARCH=armv7 && COUNT="$(curl -f -s -L https://github.com/alexbelgium/hassio-addons/pkgs/container/$SLUG-$ARCH/latest | awk '/Total downloads/{getline; print}' | awk -F '<|>' '{print $3}')" if [ -z "$COUNT" ]; then echo "$(curl -f -s -L https://github.com/alexbelgium/hassio-addons/pkgs/container/$SLUG-$ARCH/latest | awk '/Total downloads/{getline; print}')"; fi COUNT1="$COUNT" - echo "$COUNT $ARCH users with $SLUG" && DOWNLOADS="$(( DOWNLOADS + COUNT))"; fi + echo "$COUNT $ARCH users with $SLUG" && DOWNLOADS="$(( DOWNLOADS + COUNT))" + else COUNT1="-"; fi if [[ $(jq '.arch[]' "$f/config.json") == *"amd64"* ]]; then ARCH=amd64 && COUNT="$(curl -f -s -L https://github.com/alexbelgium/hassio-addons/pkgs/container/$SLUG-$ARCH/latest | awk '/Total downloads/{getline; print}' | awk -F '<|>' '{print $3}')" until [ ! -z "$COUNT" ]; do COUNT="$(curl -f -s -L https://github.com/alexbelgium/hassio-addons/pkgs/container/$SLUG-$ARCH/latest | awk '/Total downloads/{getline; print}' | awk -F '<|>' '{print $3}')" && sleep 5; done COUNT2="$COUNT" - echo "$COUNT $ARCH users with $SLUG" && DOWNLOADS="$(( DOWNLOADS + COUNT))"; fi + echo "$COUNT $ARCH users with $SLUG" && DOWNLOADS="$(( DOWNLOADS + COUNT))" + else COUNT2="-"; fi if [[ $(jq '.arch[]' "$f/config.json") == *"aarch64"* ]]; then ARCH=aarch64 && COUNT="$(curl -f -s -L https://github.com/alexbelgium/hassio-addons/pkgs/container/$SLUG-$ARCH/latest | awk '/Total downloads/{getline; print}' | awk -F '<|>' '{print $3}')" if [ -z "$COUNT" ]; then echo "$(curl -f -s -L https://github.com/alexbelgium/hassio-addons/pkgs/container/$SLUG-$ARCH/latest | awk '/Total downloads/{getline; print}')"; fi COUNT3="$COUNT" - echo "$COUNT $ARCH users with $SLUG" && DOWNLOADS="$(( DOWNLOADS + COUNT))";fi + echo "$COUNT $ARCH users with $SLUG" && DOWNLOADS="$(( DOWNLOADS + COUNT))" + else COUNT3="-";fi echo "$SLUG $DOWNLOADS $COUNT1 $COUNT2 $COUNT3" >> Stats fi done # Make stats - sort -k2,2 -n Stats > tmp && mv tmp Stats + sort -k2,2 -r -n Stats > tmp && mv tmp Stats sed -i "1i Name Total armv7 amd64 aarch64" Stats TOTAL="$(awk '{SUM+=$2}END{print SUM}' Stats)" TOTAL1="$(awk '{SUM+=$2}END{print SUM}' Stats)"