mirror of
https://github.com/mksglu/context-mode.git
synced 2026-11-23 13:11:14 +08:00
26 lines
1.1 KiB
YAML
26 lines
1.1 KiB
YAML
# impl/13 §14.1, ADR-0011 §Metrics. Weekly: merge GitHub's 14-day clone/view traffic into
|
|
# metrics/traffic.json by timestamp; commit only when the file changed.
|
|
# Lives on main (D-M6-arch-7: the owner adds it to main once). DEVIATIONS D-M6-W1-1, D-M6-W1-2.
|
|
name: traffic
|
|
on:
|
|
schedule: [{ cron: "0 3 * * 1" }]
|
|
workflow_dispatch: {}
|
|
permissions:
|
|
contents: write
|
|
jobs:
|
|
traffic:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- env:
|
|
GH_TOKEN: ${{ secrets.TRAFFIC_TOKEN }}
|
|
run: |
|
|
gh api "repos/$GITHUB_REPOSITORY/traffic/clones?per=day" > /tmp/clones.json
|
|
gh api "repos/$GITHUB_REPOSITORY/traffic/views?per=day" > /tmp/views.json
|
|
node scripts/release/merge-traffic.mjs /tmp/clones.json /tmp/views.json metrics/traffic.json
|
|
- run: |
|
|
git add metrics/traffic.json
|
|
git diff --cached --quiet -- metrics/traffic.json && exit 0
|
|
git config user.name "context-mode-bot"; git config user.email "noreply@example.invalid"
|
|
git commit -m "traffic: weekly update" && git push
|