用 act 在本地运行 GitHub Actions

在推送前于本机执行工作流作业,调试 CI。

macOS自动化构建Git低风险
运行 act -l 列出工作流,再运行 act 执行默认事件。

01命令

命令
$ act -l

02作用说明

act 读取 .github/workflows,在模拟 GitHub runner 的 Docker 容器中运行指定作业。可用 act -j build 指定作业,act -n 干跑,显著缩短“推送—等待—修复”的循环。

03风险

风险低风险
系统兼容性macOS with Homebrew installed
!注意: 需要运行中的 Docker daemon,首次会下载较大的 runner 镜像;密钥必须显式提供。

04撤销

✓无需撤销——该命令不会改变持久状态。

05来源

  • Homebrew formula: act
    Homebrew · vendor-doc · 2026-09-20
    依据: Packages act, which runs GitHub Actions workflows in local containers.

最后验证: 2026-09-22 · 分类: 开发者

06相关方案