-
Notifications
You must be signed in to change notification settings - Fork 0
77 lines (65 loc) · 2.6 KB
/
Copy pathrefresh.yml
File metadata and controls
77 lines (65 loc) · 2.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
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