Elffuss BraidHub

kikocis/utopia public

Commit the chart to its own branch, and keep CI read-only (#183)
Changeset688df4862a7f2234aa660502cc5a4e57879e85734ba73c9fda2dc25b68b9a2cb
AuthorWaylandYang <145302500+WaylandYang@users.noreply.github.com> · 2026-09-02 18:18 +08:00
CommitterGitHub <noreply@github.com> · 2026-09-02 18:18 +08:00
Parents98165df18f10

Browse the files at this changeset

3 files changed

modified .github/workflows/ci.yml +6 −0
@@ -5,6 +5,12 @@
55 branches: [main]
66 pull_request:
77
8+# **显式只读。** 没有这一块时它继承仓库级默认,而那个默认要为
9+# star-history 改成读写——CI 是每次推送、每个 PR 都跑的那个 workflow,
10+# 不该因为别处的需要顺带拿到写权限。写在这里,仓库默认怎么变都与它无关
11+permissions:
12+ contents: read
13+
814 env:
915 CARGO_TERM_COLOR: always
1016
modified .github/workflows/star-history.yml +14 −4
@@ -13,6 +13,9 @@
1313 jobs:
1414 star-history:
1515 runs-on: ubuntu-latest
16+ # 这个 action 用 Puppeteer 渲染,挂住过。没有这一行的话,挂住就是
17+ # 跑满 GitHub 的六小时上限——实测有一次重试了十五分钟才失败
18+ timeout-minutes: 10
1619 steps:
1720 - name: Generate Star History
1821 # 钉到 commit,不是 tag。**这是仓库里第一个有 `contents: write` 的
@@ -26,14 +29,21 @@
2629 # action 走 GraphQL,而 GitHub 的 fine-grained token 不能用于
2730 # GraphQL 认证。试过,报的就是这句话。
2831 #
29- # 一个 scope 都不用勾——只读公开仓库的星标是公开数据。
30- # 代价是 classic token 锁不到单个仓库,它是账户级的;
31- # 那正是上面把 action 钉到 commit 的理由:凭据比想要的宽,
32- # 就把代码的来源钉死。
32+ # **需要 `read:org`**(本仓库属于组织,action 要先把
33+ # `deeplethe` 解析成组织),**外加能读星标的权限**:GitHub 在
34+ # 2026-06-30 把星标时间线限制成只有仓库自己的管理员/协作者可读,
35+ # 零 scope 的 token 从此读不到,自己的仓库也不行。
36+ # 这条限制也是 star-history.com 那类匿名出图现在只回占位图的原因——
37+ # 换句话说,**用我们自己的 token 在 CI 里出图,是现在唯一还成立的路**。
3338 token: ${{ secrets.METRICS_TOKEN }}
3439 # 这个不用配:它管的是把生成的 SVG 提交回仓库那一步,
3540 # 用 workflow 自带的 token,靠上面的 `contents: write`
3641 committer_token: ${{ github.token }}
42+ # **提交到专用分支,不碰默认分支。**
43+ # `dev` 上有分支保护(必须走 PR、`enforce_admins: true`),
44+ # 机器人直推一定被拒;而为了一张图去松保护是本末倒置。
45+ # README 直接引这个分支上的 raw 地址
46+ committer_branch: assets
3747 user: ${{ github.repository_owner }}
3848 repo: ${{ github.event.repository.name }}
3949 template: repository
modified README.md +1 −1
@@ -119,7 +119,7 @@
119119
120120 <div align="center">
121121
122-<img src="assets/star-history.svg" alt="Star History" width="820">
122+<img src="https://raw.githubusercontent.com/deeplethe/utopia/assets/assets/star-history.svg" alt="Star History" width="820">
123123
124124 </div>
125125