在本地运行你的 GitHub Actions
- Notifications You must be signed in to change notification settings
- Fork 1.6k
- Star 61.6k
用本地方式运行你的 GitHub Actions 🚀 nektosact.com
License
MIT license 61.6k stars 1.6k forks Branches Tags Activity
nektos/act
Go to file
Folders and files
Name| Name| Last commit message| Last commit date ---|---|---|--- .github|.github .vscode|.vscode cmd|cmd pkg|pkg .actrc|.actrc .codespellrc|.codespellrc .editorconfig|.editorconfig .gitignore|.gitignore .gitleaksignore|.gitleaksignore .golangci.yml|.golangci.yml .goreleaser.yml|.goreleaser.yml .markdownlint.yml|.markdownlint.yml .mega-linter.yml|.mega-linter.yml .mergify.yml|.mergify.yml .prettierignore|.prettierignore .prettierrc.yml|.prettierrc.yml CONTRIBUTING.md|CONTRIBUTING.md IMAGES.md|IMAGES.md LICENSE|LICENSE Makefile|Makefile README.md|README.md VERIFICATION|VERIFICATION VERSION|VERSION act-cli.nuspec|act-cli.nuspec codecov.yml|codecov.yml go.mod|go.mod go.sum|go.sum install.sh|install.sh main.go|main.go main_test.go|main_test.go
Latest commit
History
概述
"Think globally,
act
locally"
在本地运行你的 GitHub Actions! 为什么要这样做? 有两个原因:
- 快速反馈 - 你不用每次都提交/推送来测试你对
.github/workflows/
文件所做的更改(或者对嵌入的 GitHub actions 所做的任何更改),你可以使用act
在本地运行这些 actions。环境变量和文件系统都配置为与 GitHub 提供的内容相匹配。 - 本地任务运行器 - 我喜欢 make。 但是,我也讨厌重复我自己。 使用
act
,你可以使用在.github/workflows/
中定义的 GitHub Actions 来替换你的Makefile
!
提示
现在可以直接从 VS Code 管理和运行 Act! 查看 GitHub Local Actions Visual Studio Code 扩展,它允许你利用 act
的强大功能在本地运行和测试工作流程,而无需离开你的编辑器。
它是如何工作的?
当你运行 act
时,它会从 .github/workflows/
中读取你的 GitHub Actions,并确定需要运行的 actions 集合。 它使用 Docker API 来拉取或构建必要镜像,这些镜像在你的工作流程文件中定义,并最终根据定义的依赖关系确定执行路径。 一旦它有了执行路径,它就会使用 Docker API 基于先前准备的镜像为每个 action 运行容器。环境变量和文件系统都配置为与 GitHub 提供的内容相匹配。
让我们用一个示例仓库来看看它的实际效果!
Act 用户指南
请查看 act user guide 以获取更多文档。
支持
需要帮助吗? 在 Gitter 上提问!
贡献
想要为 act 做出贡献? 太棒了! 查看贡献指南以参与其中。
手动从源码构建
- 安装 Go 工具 1.20+ - (https://golang.org/doc/install)
- 克隆此仓库
git clone git@github.com:nektos/act.git
- 运行单元测试
make test
- 构建并安装: `make install