--- name: gitea description: Gitea 代码托管与 CI/CD 管理。用于 Gitea Actions workflow 管理、Runner 管理、PR 操作、仓库配置。当用户提到 Gitea、Actions、Runner、CI/CD workflow、PR 检查相关任务时自动激活。 --- # Gitea Skill Gitea 代码托管平台管理,覆盖 Actions CI/CD、Runner、PR、仓库配置。 ## 服务器信息 | 服务 | 地址 | SSH | |------|------|-----| | Gitea Web | https://gitea.pipexerp.com | — | | Gitea SSH | gitea.pipexerp.com:10022 | `ssh -i ~/.ssh/id_ed25519 git@gitea.pipexerp.com -p 10022` | | Gitea 服务器 | 123.56.89.187 | `ssh -i ~/.ssh/tools.pem root@123.56.89.187` | | Runner 服务器 | 101.200.136.200 (Jenkins 服务器) | `ssh -i ~/.ssh/tools.pem root@101.200.136.200` | ## API 访问 ```bash # Gitea API Token (仓库级) GITEA_TOKEN="483a2b65219625ee382eb6d023cda39238c32e24" # 通用请求格式 curl -s "https://gitea.pipexerp.com/api/v1/repos/pipexerp//..." \ -H "Authorization: token $GITEA_TOKEN" ``` ### 常用 API | 操作 | 方法 | 端点 | |------|------|------| | 创建 PR | POST | `/repos/{owner}/{repo}/pulls` | | 更新 PR | PATCH | `/repos/{owner}/{repo}/pulls/{id}` | | 列出 Runs | GET | `/repos/{owner}/{repo}/actions/runs` | | Run 详情 | GET | `/repos/{owner}/{repo}/actions/runs/{id}` | | Job 详情 | GET | `/repos/{owner}/{repo}/actions/runs/{id}/jobs` | | 手动触发 Workflow | POST | `/repos/{owner}/{repo}/actions/workflows/{file}/dispatches` body: `{"ref":"main"}` | | 获取 Runner Token | POST | `/repos/{owner}/{repo}/actions/runners/registration-token` | | 添加 Secret | PUT | `/repos/{owner}/{repo}/actions/secrets/{name}` body: `{"data":"value"}` | | 删除 Run(仅已完成)| DELETE | `/repos/{owner}/{repo}/actions/runs/{id}` | **注意**: Gitea 1.25 **不支持**通过 API cancel 正在排队/运行的 run。 ## 仓库 | 仓库 | 地址 | 主分支 | |------|------|--------| | coolbuy-paas | pipexerp/coolbuy-paas | main | | dotfiles | huangjun/dotfiles | main | | claude-marketplace | huangjun/claude-marketplace | main | ## Actions Runners ### 主 Runner (lint/test/e2e) | 项目 | 值 | |------|-----| | 名称 | jenkins-runner | | 配置 | `/opt/act_runner/config.yaml` | | Capacity | 3 | | Labels | `ubuntu-latest`, `ubuntu-22.04`, `ubuntu-20.04` | | 进程 | `/usr/local/bin/act_runner daemon --config /opt/act_runner/config.yaml` | ### Deploy Runner (staging 部署专用) | 项目 | 值 | |------|-----| | 名称 | deploy-runner | | 配置 | `/opt/act_runner_deploy/config.yaml` | | Capacity | 1 | | Labels | `deploy:host` | | PID | `/opt/act_runner_deploy/runner.pid` | | 日志 | `/opt/act_runner_deploy/runner.log` | | 启动 | `cd /opt/act_runner_deploy && nohup act_runner daemon --config config.yaml > runner.log 2>&1 &` | ### 注册新 Runner ```bash # 1. 获取 registration token curl -s -X POST "https://gitea.pipexerp.com/api/v1/repos/pipexerp/coolbuy-paas/actions/runners/registration-token" \ -H "Authorization: token $GITEA_TOKEN" # 2. SSH 到 runner 服务器 ssh -i ~/.ssh/tools.pem root@101.200.136.200 # 3. 创建目录和配置 mkdir -p /opt/act_runner_ cat > /opt/act_runner_/config.yaml << 'EOF' log: level: info runner: file: .runner capacity: 1 timeout: 30m labels: - "