Netlify #735
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: "Netlify" | |
on: | |
workflow_dispatch: # allows manual triggering | |
schedule: | |
- cron: '0 3 * * *' # runs daily at 03:00 | |
jobs: | |
netlify-metrics: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checking out main branch | |
uses: actions/checkout@v4 | |
with: | |
path: main | |
- name: Checking out the data branch | |
uses: actions/checkout@v4 | |
with: | |
path: data | |
ref: data | |
- name: Checking out the website branch | |
uses: actions/checkout@v4 | |
with: | |
path: website | |
ref: website | |
- name: Setup | |
uses: ./main/.github/actions/nix-common-setup | |
with: | |
CACHIX_AUTH_TOKEN: ${{ secrets.CACHIX_AUTH_TOKEN }} | |
- name: Scrape nixos.org Netlify metrics | |
run: | | |
mkdir -p data/netlify | |
nix run ./main -- scrape-netlify \ | |
--site-id ${{ secrets.NETLIFY_NIXOS_SITE_ID }} \ | |
--token ${{ secrets.NETLIFY_NIXOS_AUTH_TOKEN }} \ | |
> data/netlify/current.json | |
cp data/netlify/{current,`date +"%Y-m-%d"`}.json | |
- name: Process scraped netlify data | |
run: | | |
nix run ./main -- process-netlify --dir ./data/netlify --graphs-out website/data-netlify.json --victoriametrics-out data/victoriametrics/netlify.jsonl | |
- name: Commit scraped metrics to data branch | |
uses: stefanzweifel/git-auto-commit-action@v5 | |
with: | |
commit_message: Daily scrape of Netlify metrics | |
repository: ./data | |
branch: data | |
file_pattern: 'netlify/* victoriametrics/netlify.jsonl' | |
commit_user_name: NixOS webmaster | |
commit_user_email: [email protected] | |
commit_author: GitHub Actions <[email protected]> | |
if: github.repository == 'NixOS/nixos-metrics' | |
- name: Commit processed data to website branch | |
uses: stefanzweifel/git-auto-commit-action@v5 | |
with: | |
commit_message: Daily generation of netlify graphs | |
repository: ./website | |
branch: website | |
file_pattern: data-netlify.json | |
commit_user_name: NixOS webmaster | |
commit_user_email: [email protected] | |
commit_author: GitHub Actions <[email protected]> | |
if: github.repository == 'NixOS/nixos-metrics' |