Support export log

This commit is contained in:
Shiming Zhang 2021-09-15 14:20:38 +08:00
parent 712eb166db
commit c63f681b1b
3 changed files with 11 additions and 6 deletions

View File

@ -23,7 +23,8 @@ jobs:
- name: Update badge
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }} # Generated for update gist
BADGE_PATH: "gist://wzshiming/6e1f67a5184f93cefc5b2c670a5813e5/daocloud-deep-sync-badge.svg"
BADGE_PREFIX: "gist://wzshiming/6e1f67a5184f93cefc5b2c670a5813e5"
run: |
wget https://github.com/wzshiming/putingh/releases/download/v0.6.2/putingh_linux_amd64 -O /usr/local/bin/putingh && chmod +x /usr/local/bin/putingh
GH_TOKEN="${GH_TOKEN}" putingh "${BADGE_PATH}" sync.svg
GH_TOKEN="${GH_TOKEN}" putingh "${BADGE_PREFIX}/daocloud-deep-sync-badge.svg" badge.svg
GH_TOKEN="${GH_TOKEN}" putingh "${BADGE_PREFIX}/daocloud-deep-sync.log" sync.log

View File

@ -23,7 +23,8 @@ jobs:
- name: Update badge
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }} # Generated for update gist
BADGE_PATH: "gist://wzshiming/6e1f67a5184f93cefc5b2c670a5813e5/daocloud-sync-badge.svg"
BADGE_PREFIX: "gist://wzshiming/6e1f67a5184f93cefc5b2c670a5813e5"
run: |
wget https://github.com/wzshiming/putingh/releases/download/v0.6.2/putingh_linux_amd64 -O /usr/local/bin/putingh && chmod +x /usr/local/bin/putingh
GH_TOKEN="${GH_TOKEN}" putingh "${BADGE_PATH}" sync.svg
GH_TOKEN="${GH_TOKEN}" putingh "${BADGE_PREFIX}/daocloud-sync-badge.svg" badge.svg
GH_TOKEN="${GH_TOKEN}" putingh "${BADGE_PREFIX}/daocloud-sync.log" sync.log

View File

@ -67,14 +67,17 @@ for line in $(cat ./mirror.txt); do
}
done
cat "${LOGFILE}" | grep " UNSYNC: " | sort >sync.log
cat "${LOGFILE}" | grep " SYNC: " | sort >>sync.log
sync="$(cat "${LOGFILE}" | grep " SYNC: " | wc -l | tr -d ' ' || :)"
unsync="$(cat "${LOGFILE}" | grep " UNSYNC: " | wc -l | tr -d ' ' || :)"
sum=$(($sync + $unsync))
if [[ "${QUICKLY}" == "true" ]]; then
echo "https://img.shields.io/badge/Sync-${sync}%2F${sum}-blue"
wget "https://img.shields.io/badge/Sync-${sync}%2F${sum}-blue" -O sync.svg
wget "https://img.shields.io/badge/Sync-${sync}%2F${sum}-blue" -O badge.svg
else
echo "https://img.shields.io/badge/Deep%20Sync-${sync}%2F${sum}-blue"
wget "https://img.shields.io/badge/Deep%20Sync-${sync}%2F${sum}-blue" -O sync.svg
wget "https://img.shields.io/badge/Deep%20Sync-${sync}%2F${sum}-blue" -O badge.svg
fi