Check Updates #11
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: Check Updates | |
on: | |
schedule: | |
- cron: "0 20 * * *" | |
jobs: | |
check_updates: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Fetch JSON data | |
env: | |
BYPASS_HEADER: ${{ secrets.BYPASS_HEADER }} | |
run: | | |
curl -v -H "x-test: $BYPASS_HEADER" -o optimalfraction.json https://charts-core.peercoinexplorer.net/optimalfraction.json | |
- name: Check if yesterday is included | |
run: | | |
jq empty optimalfraction.json || { echo "Invalid JSON"; exit 1; } | |
TODAY=$(date -u +"%Y-%m-%d") | |
YESTERDAY=$(date -u -d "$TODAY - 1 day" +"%Y-%m-%d") | |
if grep -q "$YESTERDAY" optimalfraction.json; then | |
echo "Yesterday ($YESTERDAY) is included in the JSON data." | |
else | |
echo "Yesterday ($YESTERDAY) is NOT included in the JSON data." | |
exit 1 | |
fi |