gitlab-cli

通过 glab CLI 管理 GitLab 代码仓库、CI/CD Pipeline、Merge Request、Issue 等资源。

Safety Notice

This listing is imported from skills.sh public index metadata. Review upstream SKILL.md and repository scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "gitlab-cli" with this command: npx skills add oldwinter/skills/oldwinter-skills-gitlab-cli

GitLab CLI 管理技能

通过 glab CLI 管理 GitLab 代码仓库、CI/CD Pipeline、Merge Request、Issue 等资源。

环境配置

验证连接状态:

glab auth status

核心功能

  1. 仓库管理

列出项目

glab repo list # 列出所有项目 glab repo list --per-page 50 # 分页列出 glab repo search "keyword" # 搜索项目

创建项目

glab repo create my-project # 在当前用户下创建 glab repo create my-project --group simplexai # 在 group 下创建 glab repo create my-project --private # 创建私有项目

其他操作

glab repo view # 查看当前项目 glab repo view --web # 浏览器打开 glab repo clone simplexai/project # 克隆项目 glab repo clone -g simplexai # 克隆整个 group glab repo delete my-project --yes # 删除项目

  1. CI/CD 管理

Pipeline 操作

glab ci status # 当前分支 pipeline 状态 glab ci list # 列出所有 pipeline glab ci run # 运行新 pipeline glab ci run --branch main # 指定分支运行 glab ci run --variables "KEY:value" # 带变量运行 glab ci cancel # 取消运行中的 pipeline glab ci delete <pipeline-id> # 删除 pipeline

Job 操作

glab ci trace # 查看 job 日志 glab ci trace <job-id> # 实时跟踪指定 job glab ci retry <job-id> # 重试失败的 job glab ci trigger <job-id> # 触发手动 job glab ci artifact <ref> <job-name> # 下载 artifacts

CI 配置验证

glab ci lint # 验证 .gitlab-ci.yml

  1. Merge Request 管理

创建 MR

glab mr create # 交互式创建 glab mr create --fill # 自动填充 glab mr create --draft # 创建草稿 glab mr create --title "feat: xxx" --target-branch main

列出和查看

glab mr list # 列出打开的 MR glab mr list --state all # 所有状态 glab mr view <id> # 查看详情 glab mr diff <id> # 查看 diff

审核和合并

glab mr approve <id> # 批准 glab mr merge <id> # 合并 glab mr merge <id> --squash # Squash 合并 glab mr merge <id> --remove-source-branch

其他操作

glab mr note <id> -m "comment" # 添加评论 glab mr checkout <id> # Checkout 到本地 glab mr close <id> # 关闭 glab mr reopen <id> # 重新打开

  1. Issue 管理

glab issue create --title "Bug: xxx" # 创建 issue glab issue list # 列出 issue glab issue list --label "bug" # 按标签筛选 glab issue view <id> # 查看详情 glab issue note <id> -m "comment" # 添加评论 glab issue close <id> # 关闭 glab issue update <id> --add-label "in-progress"

  1. 变量管理

glab variable list # 列出变量 glab variable get MY_VAR # 获取变量值 glab variable set MY_VAR "value" # 设置变量 glab variable set MY_VAR "value" --protected --masked glab variable delete MY_VAR # 删除变量 glab variable export # 导出所有变量 glab variable list --group simplexai # Group 变量

  1. Release 管理

glab release list # 列出 releases glab release create v1.0.0 --notes "Release notes" glab release view v1.0.0 # 查看 release glab release delete v1.0.0 # 删除 release

跨项目操作

使用 -R 参数指定项目:

glab mr list -R simplexai/other-project glab ci run -R simplexai/other-project --branch main glab issue list -R simplexai/other-project

批量操作脚本

技能提供以下批量操作脚本,位于 scripts/ 目录:

批量触发 Pipeline

scripts/batch_pipeline.sh main simplexai/api simplexai/front

查看多项目 Pipeline 状态

scripts/pipeline_status.sh # 所有项目 scripts/pipeline_status.sh simplexai/api simplexai/front

导出变量

scripts/export_variables.sh --repo simplexai/api vars.env scripts/export_variables.sh --group simplexai group_vars.env

MR 概览

scripts/mr_overview.sh --state opened

API 直接调用

对于 glab 未覆盖的功能,使用 API 直接调用:

glab api projects # 获取项目列表 glab api projects/simplexai%2Fapi # 获取指定项目 (URL 编码) glab api projects --method POST --field name=new-project glab api projects --paginate # 分页获取所有结果

参考文档

详细命令说明请查阅 references/commands.md 。

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

Coding

github-cli

No summary provided by upstream source.

Repository SourceNeeds Review
Coding

aws-cli

No summary provided by upstream source.

Repository SourceNeeds Review
Coding

argocd-cli

No summary provided by upstream source.

Repository SourceNeeds Review