Scheduled Data Update #429
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: Scheduled Data Update | |
on: | |
schedule: | |
- cron: "45 10 * * *" | |
env: | |
# GitHub username (owner of BOT_TOKEN, will be credited for updates) | |
BOT_USER: lc-bot | |
# Paths used to store cloned repositories | |
ACTION_REPO: thisrepo | |
DATA_REPO: thisrepo | |
defaults: | |
run: | |
shell: bash | |
jobs: | |
runDataUpdate: | |
name: Run Data Update | |
runs-on: ubuntu-latest | |
env: | |
TIMESTAMP: X | |
steps: | |
- name: Store timestamp | |
run: | | |
echo "TIMESTAMP=$(date -u +"%F-%H")" >> "$GITHUB_ENV" | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
path: ${{ env.ACTION_REPO }} | |
token: ${{ secrets.BOT_TOKEN }} | |
- name: Setup python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.11" | |
cache: "pip" | |
cache-dependency-path: "${{ env.DATA_REPO }}/_visualize/scripts/requirements.txt" | |
- name: Install dependencies | |
run: pip install -r $DATA_REPO/_visualize/scripts/requirements.txt | |
- name: Run update script | |
run: ./$ACTION_REPO/.github/scripts/update.sh | |
env: | |
BOT_TOKEN: ${{ secrets.BOT_TOKEN }} | |
- name: Show health stats | |
if: ${{ always() }} | |
run: | | |
cat $DATA_REPO/_visualize/LAST_MASTER_UPDATE.txt || true | |
echo "Warning Count: $(grep -c 'Warning' $DATA_REPO/_visualize/LAST_MASTER_UPDATE.log)" | |
echo "From Timeouts: $(grep -c 'but failed' $DATA_REPO/_visualize/LAST_MASTER_UPDATE.log)" | |
echo "Limit Reached: $(grep -c 'rate limit exceeded' $DATA_REPO/_visualize/LAST_MASTER_UPDATE.log)" | |
- name: Save log files | |
if: ${{ always() }} | |
uses: actions/upload-artifact@v4 | |
with: | |
name: logfiles_${{ env.TIMESTAMP }}_update | |
path: | | |
${{ env.DATA_REPO }}/_visualize/LAST_MASTER_UPDATE.txt | |
${{ env.DATA_REPO }}/_visualize/LAST_MASTER_UPDATE.log |