Skip to content

Refresh metrics

Refresh metrics #76

Workflow file for this run

name: Refresh metrics
# Daily refresh of the bot-owned `[metrics]` tables from the source forges and
# crates.io. Validated changes are squash-merged automatically, then the Docker
# deployment workflow is dispatched explicitly. Editorial prose is never touched.
on:
schedule:
- cron: "0 3 * * *"
workflow_dispatch:
permissions:
actions: write
contents: write
pull-requests: write
concurrency:
group: refresh-metrics
cancel-in-progress: false
jobs:
refresh:
name: Refresh tool metrics
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- name: Refresh metrics
env:
# Raises the GitHub API rate limit from 60 to 5000 req/hr.
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: cargo run --release -p generator -- --data-dir data
- name: Validate refreshed catalog
run: |
cargo test --workspace
cargo fmt --all -- --check
cargo clippy --workspace --all-targets --all-features -- -D warnings
- name: Open or update pull request
id: refresh-pr
uses: peter-evans/create-pull-request@v6
with:
branch: bot/refresh-metrics
delete-branch: false
commit-message: "chore: refresh tool metrics"
title: "chore: refresh tool metrics"
labels: automated
body: |
Automated daily refresh of the bot-owned `[metrics]` tables from the
source forges (GitHub/GitLab/Codeberg) and crates.io.
Only the `[metrics]` tables change. Human-authored editorial fields
(`remarks`, `alternatives`, `successors`, …) are never modified.
The refresh workflow validates these changes, squash-merges the PR,
rebuilds the image, and triggers a redeploy automatically.
- name: Merge validated metrics
if: steps.refresh-pr.outputs.pull-request-number != ''
env:
GH_TOKEN: ${{ github.token }}
run: |
gh pr merge "${{ steps.refresh-pr.outputs.pull-request-number }}" \
--repo "${{ github.repository }}" \
--squash \
--delete-branch
# Merges performed with GITHUB_TOKEN do not emit a downstream push workflow,
# so dispatch the deployment explicitly after the merge reaches main.
- name: Build and deploy refreshed index
if: steps.refresh-pr.outputs.pull-request-number != ''
env:
GH_TOKEN: ${{ github.token }}
run: gh workflow run docker.yml --repo "${{ github.repository }}" --ref main