你的 CI 跑了三年,今天才知道 GitHub 一直在免费替你多存十个月的数据——从 10 月 1 日起,这个好事结束了
导语
从 2026 年 10 月 1 日起,GitHub Actions 的 retention 政策发生了一个不大不小的变化——但这个变化,足以让很多团队的 CI 历史记录管理方式被迫重构。
发生了什么? 之前,GitHub 上 checks、workflow runs 和 commit statuses 的保留时间是独立于你设置的 retention 政策的,默认存留 400+ 天,不管你在仓库设置里把 artifact 和 log 的 retention 设成多少。从 10 月 1 日起,这三个类型的数据正式纳入同一个 retention 管控,默认 90 天 自动清理,超期即删,不可恢复。
Before / After:这次到底变了什么
| 10 月 1 日之前 | 10 月 1 日之后 | |
|---|---|---|
| checks / workflow runs / statuses | 独立保留,默认 400+ 天 | 纳入统一 retention 政策,默认 90 天 |
| artifacts / logs | 跟你设置的 retention 一致(默认 90 天) | 不变 |
| UI 设置项名称 | “Artifact and log retention” | “Check, workflow run, status, artifact and log retention” |
| 公库(public repo)上限 | 无正式上限(~400 天) | 90 天,不可超出 |
| 私库(private repo)上限 | ~400 天 | 最高 400 天(受组织和 enterprise cap 限制) |
| 是否追溯 | 否 | 否——已删数据无法恢复 |
一句话总结:之前 GitHub 悄悄多替你存了大半年,现在统一按你的 retention 设置来了。
三类团队最受影响
1. 有合规审计需求的团队(SOC2 / ISO 27001 等)
很多安全认证要求 CI 流水线的运行记录保留 6 个月以上。之前 GitHub 默认保留 400+ 天,这个需求基本自动满足。现在默认变成 90 天,如果不主动调整 retention 设置,审计时想调取半年前的 pipeline 记录会直接拿到 404。
2. 依赖长期 run 历史做故障复盘的团队
出了生产事故去翻 CI history 是很多工程师的日常工作。之前的 400+ 天默认意味着你总能在 GitHub 上找到三个月前那次部署的完整记录。10 月 1 日之后,超过 90 天的 run 直接消失——如果你的 incident review 流程需要查历史 CI,这个变化会直接卡住。
3. 做 DORA 指标或工程效能分析的团队
DORA(DevOps Research and Assessment)指标依赖部署频率、变更前置时间、变更失败率等历史数据。GitHub Actions 的 API 正好能批量拉取这些信息。如果你的分析需要 90 天以上的数据窗口,现在必须先把数据导出,否则窗口一过永久缺失。
你需要做什么:4 步检查清单
步骤 1:检查当前 retention 设置
进入你的仓库 → Settings → Actions → General,找到 “Check, workflow run, status, artifact and log retention” 选项,看当前设置是多少天。
步骤 2:判断 90 天是否够用
- 够用(默认 90 天即可): 无需任何操作,10 月 1 日起系统自动按 90 天清理
- 不够用: 私库可将 retention 最高调至 400 天(需组织/enterprise 授权);公库最高仍为 90 天,不可超出
步骤 3:10 月 1 日前导出需要保留的历史数据
数据一旦被清理,GitHub 无法恢复。如果团队有合规保留需求,在 10 月 1 日之前导出:
步骤 4:通知团队成员
超过 retention 期限的 runs 和 checks 在 10 月 1 日后会自动消失,团队成员不能再从 GitHub UI 查询 90 天前的 CI 历史记录。提前告知,避免事后才发现”那个 run 去哪了”。
存储费用有什么变化?
关键澄清: checks、workflow runs 和 commit statuses 的元数据本身不计费。真正计费的是 artifacts 和 logs(GitHub Actions 存储计费项)。
因此,这次 retention 政策收严对存储费用的影响是潜在的:
- 如果你之前把 artifact/log retention 设得很长,现在系统会自动清理——可能降低你的 Actions 存储费用
- 如果你需要更长的 retention 来满足合规,可以将 artifact/log retention 调高,但代价是存储费用增加
Retention 缩短并不直接省钱,它只是让你不会因为 retention 设置过长而在不知不觉中积累大量 artifact/log。
结尾下一步
现在就去做这件事:
- 打开你的 GitHub 仓库 → Settings → Actions → General
- 找到 “Check, workflow run, status, artifact and log retention” 设置项
- 确认当前值是否满足团队需求(私库可调,公库上限 90 天)
- 有合规要求 → 在 10 月 1 日前导出历史数据
- 把这个变更告知团队里负责 CI / DevOps 的同事
从 10 月 1 日起,超过 retention 设置的 CI 运行记录会自动消失,别等到查历史时才发现数据已经不在了。
参考来源
- GitHub Blog: “Actions retention now covers checks, runs, and statuses”(2026-10-01)https://github.blog/changelog/2026-10-01-actions-retention-now-covers-checks-runs-and-statuses/
- GitHub Docs: “Configuring the retention period for checks, workflow runs, commit statuses, artifacts, and logs” https://docs.github.com/repositories/managing-your-repositorys-settings-and-features/enabling-features-for-your-repository/managing-github-actions-settings-for-a-repository
- daily.dev 深度解读(2026-08-27)https://daily.dev/posts/actions-retention-will-cover-checks-workflow-runs-and-statuses-jchpbzx1f
评论区
登录后可评论。