Fetch CI Nightly Data #98
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: 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 | |
env: | |
TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
# 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 |