Skip to content

Fetch CI Nightly Data #58

Fetch CI Nightly Data

Fetch CI Nightly Data #58

name: Fetch CI Nightly Data
run-name: Fetch CI Nightly Data
on:
schedule:
- cron: '0 4 * * *'
workflow_dispatch:
push:
branches:
- main
paths:
- 'scripts/fetch-ci-nightly-data.js'
- '.github/workflows/fetch-ci-nightly-data.yaml'
jobs:
fetch-and-commit-data:
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Update dashboard data
# Use bash to fail fast:
# https://docs.github.com/en/actions/writing-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsshell
shell: bash
run: |
# fetch ci nightly data as temporary file
node scripts/fetch-ci-nightly-data.js | tee tmp-data.json
# switch to a branch specifically for holding latest data
git config --global user.name "GH Actions Workflow"
git config --global user.email "<gha@runner>"
git fetch --all
git checkout latest-dashboard-data
# back out whatever data was there
git reset HEAD~1
# overwrite the old data
mkdir -p data/
mv tmp-data.json data/job_stats.json
# commit
git add data
git commit -m '[skip ci] latest ci nightly data'
git push --force