文章摘要
作者强烈表达了对GitHub Actions的厌恶,认为这是自己最讨厌的技术工具。虽然也曾吐槽过PHP等语言,但都不及对GitHub Actions的憎恶程度。作者以开发tmplr项目时遇到的构建问题为例,暗示GitHub Actions使用体验极差。
文章总结
我痛恨GitHub Actions
2026年1月14日
地狱之路
作者在为tmplr项目实现build.rs文件时,使用CUE语言生成文档。虽然开发过程很顺利,但第二天发现CI构建失败。问题出在需要为四个平台(Linux ARM、macOS ARM、Linux x8664、macOS x8664)构建时,GitHub Actions在Linux ARM平台上隐藏了x86_64二进制文件,导致构建失败。
恶性循环
作者陷入了一个痛苦的调试循环: 1. 搜索可能的解决方案 2. 修改ci.yml文件 3. 提交并推送更改 4. 等待构建结果 5. 发现失败后重复上述步骤
每次循环需要2-3分钟,效率极低,让作者感到极度沮丧。
解决方案
最终作者采纳了互联网上的建议:不让GitHub Actions管理逻辑,而是将脚本控制权掌握在自己手中。于是:
1. 删除了原本很满意的build.rs文件
2. 将所有生成逻辑移到GNU Makefile中
3. 将生成文件直接提交到仓库
4. 简化CI配置
总结
尽管GitHub Actions提供了便利的macOS构建支持,但其隔离机制和调试效率问题让开发者损失了大量时间。作者认为这是开发者不得不使用的"必要之恶",但建议将核心逻辑控制在本地脚本中,仅让Actions负责调用。
(注:原文中的图片引用、脚注和个人签名等非核心内容已省略)
评论总结
以下是评论内容的总结:
1. 推荐使用本地调试工具
- 多位用户推荐使用
act工具(如nektos/act)在本地运行 GitHub Actions 工作流,以减少在线调试的依赖。- "Would a tool like act help here?" (spockz)
- "Not by GitHub, but isn't act supposed to be that?" (Hamuko)
2. 避免在 Actions 中嵌入逻辑
- 普遍建议将逻辑封装在独立脚本中,Actions 仅调用这些脚本,以方便本地测试和移植。
- "An ideal action has 2 steps: (1) check out the code, (2) invoke a sane script that you can test locally." (iamcalledrob)
- "Don’t have logic in your workflows. Workflows should be dumb and simple." (1a527dd5)
3. 调试困难与反馈循环问题
- 用户抱怨 GitHub Actions 缺乏本地调试能力,反馈循环缓慢。
- "GHA’s componentized architecture is appealing, but it’s astonishing... no way to actually debug workflows." (skywhopper)
- "The lack of a tight feedback loop is the main issue." (woodruffw)
4. 环境一致性与工具建议
- 推荐使用容器、Nix 或工具(如
mise)确保开发与 CI 环境一致。- "I deal with all these terrible CI platforms... do my entire CI process in a container." (Nextgrid)
- "Adopting Nix... makes it super easy to work with Github Actions." (arximboldi)
5. 对 GitHub Actions 的批评与替代方案
- 部分用户强烈批评 GitHub Actions,推荐其他工具(如 OneDev 的实时调试功能)。
- "GitHub action is a totally broken piece of s !!" (QuiCasseRie)
- "GHA is terrible." (thewillowcat)
6. 其他观点
- 中立/辩护:有用户认为问题源于使用方式而非工具本身,或认为 GitHub Actions 对开源项目仍有价值。
- "Its not Github Actions' fault but the horrors people create in it." (smetj)
- "For OSS projects it’s a super valuable free resource." (arximboldi)
- 质疑文章表达:有评论指出文章过于情绪化,缺乏清晰结构。
- "This one seems to diverge into rant a bit too much." (g947o)
关键引用保留
- 工具推荐:
"https://github.com/nektos/act" (spockz, Hamuko) - 逻辑分离:
"Keep your scripts under your own damn control" (iamcalledrob) - 调试痛点:
"No way to debug workflows locally" (skywhopper)
总结呈现了工具推荐、最佳实践、批评与辩护等多元观点,保留了原始评论的核心论据和代表性引用。