Skip to content

Routine Data Update #873

Routine Data Update

Routine Data Update #873

Workflow file for this run

name: Routine Data Update
on:
workflow_dispatch:
schedule:
- cron: "45 10 * * *"
defaults:
run:
shell: bash
jobs:
runDataUpdate:
name: Run Data Update
runs-on: ubuntu-latest
env:
REPO_DIR: main
TIMESTAMP: X
steps:
- name: Store timestamp
run: |
echo "TIMESTAMP=$(date -u +"%F-%H")" >> "$GITHUB_ENV"
- name: Checkout
uses: actions/checkout@v6
with:
path: ${{ env.REPO_DIR }}
token: ${{ secrets.GITHUB_TOKEN }}
persist-credentials: false
- name: Setup python
uses: actions/setup-python@v6
with:
python-version: "3.11"
cache: "pip"
cache-dependency-path: "${{ env.REPO_DIR }}/_visualize/scripts/requirements.txt"
- name: Install dependencies
run: pip install -r ${{ env.REPO_DIR }}/_visualize/scripts/requirements.txt
- name: Run update script
env:
GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: ./${{ env.REPO_DIR }}/.github/scripts/update.sh
- name: Create GitHub App Installation Token
uses: actions/create-github-app-token@v2
id: app-token
with:
app-id: ${{ vars.APP_ID }}
private-key: ${{ secrets.PRIVATE_KEY }}
- name: Get GitHub App User ID
id: get-user-id
env:
GH_TOKEN: ${{ steps.app-token.outputs.token }}
run: echo "user-id=$(gh api "/users/${{ steps.app-token.outputs.app-slug }}[bot]" --jq .id)" >> "$GITHUB_OUTPUT"
- name: Configure git
env:
GH_TOKEN: ${{ steps.app-token.outputs.token }}
run: |
gh auth setup-git
git config --global user.name '${{ steps.app-token.outputs.app-slug }}[bot]'
git config --global user.email '${{ steps.get-user-id.outputs.user-id }}+${{ steps.app-token.outputs.app-slug }}[bot]@users.noreply.github.com'
- name: Commit updated data
env:
GH_TOKEN: ${{ steps.app-token.outputs.token }}
run: |
pushd ${{ env.REPO_DIR }}
git stash
git pull --ff-only
git stash pop
git add -A .
git commit -m "${{ env.TIMESTAMP }} Data Update by ${{ steps.app-token.outputs.app-slug }}"
git push
popd
- name: Show health stats
if: ${{ always() }}
run: |
cat ${{ env.REPO_DIR }}/_visualize/LAST_MASTER_UPDATE.txt || true
echo "Warning Count: $(grep -c 'Warning' ${{ env.REPO_DIR }}/_visualize/LAST_MASTER_UPDATE.log)"
echo "From Timeouts: $(grep -c 'but failed' ${{ env.REPO_DIR }}/_visualize/LAST_MASTER_UPDATE.log)"
echo "Limit Reached: $(grep -c 'rate limit exceeded' ${{ env.REPO_DIR }}/_visualize/LAST_MASTER_UPDATE.log)"
- name: Save log files
if: ${{ always() }}
uses: actions/upload-artifact@v6
with:
name: logfiles_${{ env.TIMESTAMP }}_update
path: |
${{ env.REPO_DIR }}/_visualize/LAST_MASTER_UPDATE.txt
${{ env.REPO_DIR }}/_visualize/LAST_MASTER_UPDATE.log