关于 local-action-verification
此技能为代码仓库配置使用 act 在本地运行 GitHub Actions 工作流的脚本和说明,供 Jules 或其他 Agent 在推送前验证代码。它提供安装脚本,以及后台运行并轮询日志的脚本。
主要功能
- 01按需安装 act
- 02后台运行 act 工作流
- 03轮询日志以避免超时
- 04提供 AGENTS.md 使用说明
- 05配置忽略 CI 产物
适用场景
- 01推送前在本地验证 CI
- 02为仓库配置 Jules 的验证流程
- 03查看失败日志并重新运行工作流
安装
复制下面的命令,在终端中运行。
$
npx skills add https:/ / github.com/ google-labs-code/ jules-skills --skill local-action-verification安装后在 Claude Code 中输入/local-action-verification确认已加载。
包含的文件
除 SKILL.md 外,安装时一起下载的参考资料和脚本。
README.mdresources/troubleshooting.mdscripts/install-act.shrun-act.sh详细介绍
使用 act 在本地验证操作
你正在配置一个代码仓库,以便 Jules(或任何 Agent)可以使用 act 在本地运行 GitHub Actions 工作流,在推送前验证代码更改是否通过 CI。
配置内容
两个脚本和一个 agents.md 章节,可用于本地 CI 验证:
- install-act.sh — 如果尚未安装,则安装
act(识别平台,必要时使用 sudo) - run-act.sh — 在后台运行
act并轮询日志,避免 Agent 超时 - AGENTS.md 章节 — Jules 读取的说明,告知其如何使用这些脚本
设置步骤
步骤 1:将脚本复制到代码仓库
将此技能中的 scripts/ 目录复制到目标代码仓库的 scripts/act/:
Target structure:
scripts/act/
├── install-act.sh
└── run-act.sh
确保脚本可执行:
chmod +x scripts/act/install-act.sh scripts/act/run-act.sh
步骤 2:将说明添加到 AGENTS.md
将以下章节追加到代码仓库的 AGENTS.md 文件中(如果文件不存在,则创建)。Jules 会通过此文件发现本地验证功能:
## Local CI Verification
Before pushing code or opening a PR, verify changes pass CI locally using `act`.
### Prerequisites
- Docker must be running
- If `act` is not installed, run: `bash scripts/act/install-act.sh`
### How to Verify
1. Read `.github/workflows/` to find the CI workflow and identify the job ID
2. Run the verification script:
```bash
bash scripts/act/run-act.sh "push -j <JOB_ID>"
使用矩阵:bash scripts/act/run-act.sh "push -j <JOB_ID> --matrix <KEY>:<VALUE>"
3. 如果运行失败,请查看日志输出、修复代码并重新运行
4. 验证完成后,进行清理:
rm -f act_output.log
git checkout <any unintended file changes>
配置
- 超时时间:
ACT_TIMEOUT=900 bash scripts/act/run-act.sh "..."(默认:600s) - 轮询间隔:
ACT_POLL=15 bash scripts/act/run-act.sh "..."(默认:10s) - 自定义镜像:在参数中传入
-P ubuntu-latest=node:20-bookworm,以加快拉取速度
### Step 3: Update .gitignore
Append these entries to `.gitignore` if they don't already exist:
act artifacts
act_output.log .secrets
### Step 4: Print next steps for the user
Tell the user:
1. Docker must be installed and running on any machine (or Jules VM) where verification runs
2. `act` will be auto-installed on first use via `scripts/act/install-act.sh`
3. If workflows require secrets, create a `.secrets` file (KEY=VALUE format) — never commit it
4. Commit all generated files
## Troubleshooting
- **Docker not running**: `act` requires Docker. Ensure the Docker daemon is started.
- **Image pull slow**: First run downloads ~2GB+. Use `-P ubuntu-latest=node:20-bookworm` for faster pulls.
- **ARM64 issues**: On Apple Silicon, add `--container-architecture linux/amd64` to act arguments.
- **Secrets required**: Create a `.secrets` file and pass `--secret-file .secrets` in the act arguments.
- **Timeout**: Increase with `ACT_TIMEOUT=1200 bash scripts/act/run-act.sh "..."`.
## Resource References
- [Troubleshooting Guide](resources/troubleshooting.md) — Detailed solutions for common issues
评论
支持 Markdown