GitFlow — OpenClaw Skill
Overview
GitFlow is an OpenClaw skill that automates code pushes and provides real-time CI/CD pipeline status monitoring for GitHub and GitLab repositories. It streamlines developer workflows by reducing context switching between repositories and pipeline dashboards.
The skill can automatically push changes and report pipeline results, enabling faster feedback and smoother deployments.
Features
GitFlow can:
- - Push local commits automatically
- Trigger remote CI/CD pipelines
- Fetch pipeline status and results
- Report build success or failure
- Display pipeline URLs and logs
- Monitor multiple repositories
Typical Workflow
- 1. Developer commits changes locally.
- GitFlow pushes changes automatically or on command.
- CI/CD pipeline runs remotely.
- Skill reports pipeline status.
- Developer receives build/deploy feedback instantly.
GitHub CLI Commands
Use the gh CLI tool to fetch workflow status after pushing:
Check Workflow Run Status
gh run list
Lists recent workflow runs for the repository.
View Latest Run for Current Branch
gh run list --branch $(git branch --show-current) --limit 1
Shows the most recent workflow run for the current branch.
View Run Details
gh run view <run-id>
Displays detailed information about a specific workflow run.
Watch Run in Real-Time
gh run watch
Watches the most recent run until completion, streaming status updates.
View Run Logs
gh run view <run-id> --log
Displays the full logs for a workflow run.
View Failed Job Logs
gh run view <run-id> --log-failed
Shows only the logs from failed jobs.
Rerun Failed Jobs
gh run rerun <run-id> --failed
Reruns only the failed jobs from a workflow run.
GitLab CLI Commands
Use the glab CLI tool to fetch pipeline status after pushing:
Check Pipeline Status
glab ci status
Shows the status of the most recent pipeline on the current branch.
View Pipeline Details
glab ci view
Opens an interactive view of the current pipeline with job details.
List Recent Pipelines
glab ci list
Lists recent pipelines for the repository.
View Specific Pipeline
glab ci view <pipeline-id>
View details of a specific pipeline by ID.
Watch Pipeline in Real-Time
glab ci status --live
Continuously monitors the pipeline status until completion.
Get Pipeline Job Logs
glab ci trace <job-id>
Streams the logs of a specific job.
Post-Push Hook Example
Git doesn't have a native post-push hook, but you can create a git alias to automatically monitor pipeline status after pushing.
Add this to your ~/.gitconfig:
CODEBLOCK13
Usage
CODEBLOCK14
GitFlow — OpenClaw 技能
概述
GitFlow 是一项 OpenClaw 技能,可自动执行代码推送,并为 GitHub 和 GitLab 仓库提供实时的 CI/CD 流水线状态监控。它通过减少在仓库和流水线面板之间的上下文切换,简化了开发者的工作流程。
该技能可以自动推送更改并报告流水线结果,从而实现更快的反馈和更顺畅的部署。
功能特性
GitFlow 可以:
- - 自动推送本地提交
- 触发远程 CI/CD 流水线
- 获取流水线状态和结果
- 报告构建成功或失败
- 显示流水线 URL 和日志
- 监控多个仓库
典型工作流程
- 1. 开发者在本地提交更改。
- GitFlow 自动或按命令推送更改。
- CI/CD 流水线在远程运行。
- 技能报告流水线状态。
- 开发者即时收到构建/部署反馈。
GitHub CLI 命令
使用 gh CLI 工具在推送后获取工作流状态:
检查工作流运行状态
bash
gh run list
列出仓库最近的工作流运行记录。
查看当前分支的最新运行
bash
gh run list --branch $(git branch --show-current) --limit 1
显示当前分支最近的工作流运行记录。
查看运行详情
bash
gh run view
显示特定工作流运行的详细信息。
实时监控运行
bash
gh run watch
监控最近的运行直至完成,实时流式传输状态更新。
查看运行日志
bash
gh run view --log
显示工作流运行的完整日志。
查看失败任务日志
bash
gh run view --log-failed
仅显示失败任务的日志。
重新运行失败任务
bash
gh run rerun --failed
仅重新运行工作流运行中的失败任务。
GitLab CLI 命令
使用 glab CLI 工具在推送后获取流水线状态:
检查流水线状态
bash
glab ci status
显示当前分支最近流水线的状态。
查看流水线详情
bash
glab ci view
打开当前流水线的交互式视图,包含任务详情。
列出最近流水线
bash
glab ci list
列出仓库最近的流水线记录。
查看特定流水线
bash
glab ci view
按 ID 查看特定流水线的详情。
实时监控流水线
bash
glab ci status --live
持续监控流水线状态直至完成。
获取流水线任务日志
bash
glab ci trace
流式传输特定任务的日志。
推送后钩子示例
Git 没有原生的推送后钩子,但你可以创建一个 git 别名,在推送后自动监控流水线状态。
将此内容添加到你的 ~/.gitconfig 文件中:
ini
[alias]
pushflow = !f() { \
git push \${1:-origin}\ \${2:-$(git branch --show-current)}\; \
url=$(git remote get-url \${1:-origin}\); \
if echo \$url\ | grep -q github.com; then \
sleep 3 && gh run watch; \
elif echo \$url\ | grep -q gitlab; then \
sleep 3 && glab ci status --live; \
fi; \
}; f
使用方法
bash
git pushflow
git pushflow origin main