بنقرة واحدة
github
GitHub 操作。用于:(1) 管理 GitHub 仓库 (2) 操作 Pull Request (3) 触发 Actions (4) 管理文件和代码 (5) 管理 Issue
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
القائمة
GitHub 操作。用于:(1) 管理 GitHub 仓库 (2) 操作 Pull Request (3) 触发 Actions (4) 管理文件和代码 (5) 管理 Issue
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
استنادا إلى تصنيف SOC المهني
⚠️ 需要 ZADIG_API_URL + ZADIG_API_KEY | Zadig DevOps 平台 API 客户端
Apache Apisix API 网关操作。用于:(1) 管理 Apisix 路由 (2) 配置上游和服务 (3) 管理插件 (4) 流量管理和灰度发布。环境变量:APISIX_URL, APISIX_ADMIN_KEY
GitLab 操作。用于:(1) 管理 GitLab 项目和仓库 (2) 操作 Merge Request (3) 触发 CI/CD Pipeline (4) 管理文件和代码 (5) 管理用户和权限
Grafana 可视化和监控操作。用于:(1) 查询 Grafana 指标数据 (2) 管理仪表盘和数据源 (3) 创建和编辑图表 (4) 告警配置
Jenkins CI/CD 操作。用于:(1) 触发 Jenkins 任务构建 (2) 查询任务状态和构建历史 (3) 获取构建日志 (4) 操作 Jenkins 节点和配置
Nacos 配置中心操作。用于:(1) 查询 Nacos 配置 (2) 发布/更新配置 (3) 删除配置 (4) 管理命名空间。环境变量:NACOS_URL, NACOS_USERNAME, NACOS_PASSWORD
| name | github |
| description | GitHub 操作。用于:(1) 管理 GitHub 仓库 (2) 操作 Pull Request (3) 触发 Actions (4) 管理文件和代码 (5) 管理 Issue |
GitHub 操作技能:仓库管理、Pull Request、Actions、Issue 和文件操作。
| 变量 | 必填 | 说明 |
|---|---|---|
| GITHUB_TOKEN | 是 | GitHub Personal Access Token |
| GITHUB_OWNER | 是 | 组织名或用户名 |
repo - 完整仓库访问workflow - Actions 权限read:org - 读取组织# ~/.openclaw/workspace/.env
GITHUB_TOKEN=your-token
GITHUB_OWNER=your-org
source ~/.openclaw/workspace/.env
# 列出用户仓库
curl -s -H "Authorization: token $GITHUB_TOKEN" \
"https://api.github.com/user/repos?per_page=100" | jq '.[].name'
# 列出组织仓库
curl -s -H "Authorization: token $GITHUB_TOKEN" \
"https://api.github.com/orgs/$GITHUB_OWNER/repos?per_page=100" | jq '.[].name'
# 获取仓库详情
curl -s -H "Authorization: token $GITHUB_TOKEN" \
"https://api.github.com/repos/$GITHUB_OWNER/REPO_NAME"
# 创建仓库
curl -s -X POST -H "Authorization: token $GITHUB_TOKEN" \
-d '{"name":"new-repo","private":false}' \
"https://api.github.com/user/repos"
# 列出 PR
curl -s -H "Authorization: token $GITHUB_TOKEN" \
"https://api.github.com/repos/$GITHUB_OWNER/REPO/pulls?state=open"
# 创建 PR
curl -s -X POST -H "Authorization: token $GITHUB_TOKEN" \
-d '{"title":"Feature XXX","body":"功能描述","head":"feature-branch","base":"main"}' \
"https://api.github.com/repos/$GITHUB_OWNER/REPO/pulls"
# 获取 PR 详情
curl -s -H "Authorization: token $GITHUB_TOKEN" \
"https://api.github.com/repos/$GITHUB_OWNER/REPO/pulls/PR_NUMBER"
# 合并 PR
curl -s -X PUT -H "Authorization: token $GITHUB_TOKEN" \
-d '{"merge_method":"squash"}' \
"https://api.github.com/repos/$GITHUB_OWNER/REPO/pulls/PR_NUMBER/merge"
# 添加 Reviewer
curl -s -X POST -H "Authorization: token $GITHUB_TOKEN" \
-d '{"reviewers":["username"]}' \
"https://api.github.com/repos/$GITHUB_OWNER/REPO/pulls/PR_NUMBER/requested_reviewers"
# 列出 Issue
curl -s -H "Authorization: token $GITHUB_TOKEN" \
"https://api.github.com/repos/$GITHUB_OWNER/REPO/issues?state=open"
# 创建 Issue
curl -s -X POST -H "Authorization: token $GITHUB_TOKEN" \
-d '{"title":"Bug: 问题描述","body":"详细信息"}' \
"https://api.github.com/repos/$GITHUB_OWNER/REPO/issues"
# 添加标签
curl -s -X POST -H "Authorization: token $GITHUB_TOKEN" \
-d '{"labels":["bug","help-wanted"]}' \
"https://api.github.com/repos/$GITHUB_OWNER/REPO/issues/ISSUE_NUMBER"
# 分配用户
curl -s -X POST -H "Authorization: token $GITHUB_TOKEN" \
-d '{"assignees":["username"]}' \
"https://api.github.com/repos/$GITHUB_OWNER/REPO/issues/ISSUE_NUMBER"
# 关闭 Issue
curl -s -X PATCH -H "Authorization: token $GITHUB_TOKEN" \
-d '{"state":"closed"}' \
"https://api.github.com/repos/$GITHUB_OWNER/REPO/issues/ISSUE_NUMBER"
# 列出 Workflow
curl -s -H "Authorization: token $GITHUB_TOKEN" \
"https://api.github.com/repos/$GITHUB_OWNER/REPO/actions/workflows"
# 触发 Workflow
curl -s -X POST -H "Authorization: token $GITHUB_TOKEN" \
-d '{"ref":"main"}' \
"https://api.github.com/repos/$GITHUB_OWNER/REPO/actions/workflows/WORKFLOW_ID/dispatches"
# 触发指定 Workflow(通过文件名)
curl -s -X POST -H "Authorization: token $GITHUB_TOKEN" \
-d '{"ref":"main","inputs":{"env":"production"}}' \
"https://api.github.com/repos/$GITHUB_OWNER/REPO/actions/workflows/ci.yml/dispatches"
# 列出最近运行
curl -s -H "Authorization: token $GITHUB_TOKEN" \
"https://api.github.com/repos/$GITHUB_OWNER/REPO/actions/runs"
# 获取运行详情
curl -s -H "Authorization: token $GITHUB_TOKEN" \
"https://api.github.com/repos/$GITHUB_OWNER/REPO/actions/runs/RUN_ID"
# 取消运行
curl -s -X POST -H "Authorization: token $GITHUB_TOKEN" \
"https://api.github.com/repos/$GITHUB_OWNER/REPO/actions/runs/RUN_ID/cancel"
# 重新运行
curl -s -X POST -H "Authorization: token $GITHUB_TOKEN" \
"https://api.github.com/repos/$GITHUB_OWNER/REPO/actions/runs/RUN_ID/rerun"
# 获取文件内容
curl -s -H "Authorization: token $GITHUB_TOKEN" \
"https://api.github.com/repos/$GITHUB_OWNER/REPO/contents/PATH?ref=BRANCH"
# 获取文件内容(Base64 解码)
curl -s -H "Authorization: token $GITHUB_TOKEN" \
"https://api.github.com/repos/$GITHUB_OWNER/REPO/contents/PATH" | \
jq -r '.content' | base64 -d
# 创建/更新文件
curl -s -X PUT -H "Authorization: token $GITHUB_TOKEN" \
-d '{"message":"Update config","content":"'$(base64 -w0 file.txt)'","branch":"main"}' \
"https://api.github.com/repos/$GITHUB_OWNER/REPO/contents/PATH"
# 删除文件
curl -s -X DELETE -H "Authorization: token $GITHUB_TOKEN" \
-d '{"message":"Delete file","sha":"FILE_SHA","branch":"main"}' \
"https://api.github.com/repos/$GITHUB_OWNER/REPO/contents/PATH"
# 安装: brew install gh
# 配置: gh auth login
# 仓库操作
gh repo list
gh repo create new-repo --public
# PR 操作
gh pr list
gh pr create --title "Feature" --body "描述"
gh pr merge --admin --squash
# Issue 操作
gh issue list
gh issue create --title "Bug" --body "描述"
gh issue close #1
# Actions 操作
gh run list
gh run view RUN_ID
gh run rerun RUN_ID
当分支开发完成后自动创建 PR:
source ~/.openclaw/workspace/.env
# 创建 PR
PR_URL=$(curl -s -X POST -H "Authorization: token $GITHUB_TOKEN" \
-d '{
"title":"Feature: 新功能",
"body":"实现 xxx 功能\n\nCloses #123",
"head":"feature-xxx",
"base":"main"
}' \
"https://api.github.com/repos/$GITHUB_OWNER/REPO/pulls" | \
jq -r '.html_url')
echo "PR created: $PR_URL"
触发部署流水线并等待结果:
source ~/.openclaw/workspace/.env
# 触发 Workflow
curl -s -X POST -H "Authorization: token $GITHUB_TOKEN" \
-d '{"ref":"main"}' \
"https://api.github.com/repos/$GITHUB_OWNER/REPO/actions/workflows/deploy.yml/dispatches"
# 等待 Run 完成
RUN_ID=$(curl -s -H "Authorization: token $GITHUB_TOKEN" \
"https://api.github.com/repos/$GITHUB_OWNER/REPO/actions/runs?status=in_progress" | \
jq -r '.workflow_runs[0].id')
while true; do
STATUS=$(curl -s -H "Authorization: token $GITHUB_TOKEN" \
"https://api.github.com/repos/$GITHUB_OWNER/REPO/actions/runs/$RUN_ID" | \
jq -r '.conclusion')
[[ "$STATUS" == "success" || "$STATUS" == "failure" ]] && break
sleep 15
done
echo "Run $STATUS"
批量修改多个仓库的配置文件:
source ~/.openclaw/workspace/.env
REPOS=("repo1" "repo2" "repo3")
for REPO in "${REPOS[@]}"; do
# 获取当前文件 SHA
SHA=$(curl -s -H "Authorization: token $GITHUB_TOKEN" \
"https://api.github.com/repos/$GITHUB_OWNER/$REPO/contents/.github/workflows/ci.yml" | \
jq -r '.sha')
# 更新文件
curl -s -X PUT -H "Authorization: token $GITHUB_TOKEN" \
-d '{"message":"Update CI","content":"'$(base64 -w0 ci.yml)'","sha":"'$SHA'","branch":"main"}' \
"https://api.github.com/repos/$GITHUB_OWNER/$REPO/contents/.github/workflows/ci.yml"
echo "Updated $REPO"
done
新 Issue 创建时自动分配标签和负责人:
source ~/.openclaw/workspace/.env
# 添加标签
curl -s -X POST -H "Authorization: token $GITHUB_TOKEN" \
-d '{"labels":["needs-review"]}' \
"https://api.github.com/repos/$GITHUB_OWNER/REPO/issues/ISSUE_NUMBER"
# 分配用户
curl -s -X POST -H "Authorization: token $GITHUB_TOKEN" \
-d '{"assignees":["username"]}' \
"https://api.github.com/repos/$GITHUB_OWNER/REPO/issues/ISSUE_NUMBER"
source ~/.openclaw/workspace/.env
# 创建 Release
curl -s -X POST -H "Authorization: token $GITHUB_TOKEN" \
-d '{
"tag_name":"v1.0.0",
"target_commitish":"main",
"name":"Release v1.0.0",
"body":"版本说明",
"draft":false,
"prerelease":false
}' \
"https://api.github.com/repos/$GITHUB_OWNER/REPO/releases"
A: 确保 Token 勾选了 repo(仓库权限)和 workflow(Actions 权限)。
A: 未认证请求每小时 60 次,认证后每小时 5000 次。使用 Authorization header 可以提高限制。
curl -s -H "Authorization: token $GITHUB_TOKEN" \
-H "Accept: application/vnd.github+json" \
"https://api.github.com/rate_limit" | jq '.rate'
gh auth login
# 选择 GitHub.com
# 选择 HTTPS
# 登录认证