用于在 PR 合并前自动检测 API 接口兼容性变更。该项目是一个 GitCode Actions 插件,克隆 openlibing-api-parser 引擎执行接口扫描,自动派生仓库上下文,结果上传至 openLiBing 平台,作为 CI 门禁阶段的质量卡点。【此简介由AI生成】
文件 最后提交记录 最后更新时间 refactor: rename api-miner to api-scan across repo action.yml name/package.json/package-lock/README/src/zip/示例 workflow 全部 api-miner → api-scan。远端仓已由用户在 GitCode 网页 Rename 路径为 openlibing/api-scan-action,本地 remote 更新到新 URL。dist/index.js 由 ncc 重建。示例 workflow 文件名 api-miner-scan.yml → api-scan.yml。 Co-authored-by: opencode <noreply@opencode.ai> Generated-by: alibaba-cn/glm-5.2
2 个月前 fix(scan): treat upload failure (exit 20) as non-fatal warning The scan script returns exit code 20 (UPLOAD_FAILED) when the result upload to openLiBing fails (e.g. APIG 429 rate limit, 5xx, network errors). Previously the action treated any non-zero exit as fatal via core.setFailed, which turned a successful scan (results.json produced) into a red PR-gate failure solely because the report could not be uploaded. Split the exit-code handling into three branches: - 0 -> success - 20 -> core.warning (non-fatal; step still passes, yellow ⚠) - others -> core.setFailed (real scan/setup failures still block) core.warning only issues ::warning:: and does not set process.exitCode (verified against the bundled @actions/core: setFailed sets ExitCode.Failure=1, warning does not), so the action step exits 0 and the PR check stays green on upload errors. Co-authored-by: opencode <noreply@opencode.ai> Generated-by: glm-5.2
2 个月前 fix(scan): treat upload failure (exit 20) as non-fatal warning The scan script returns exit code 20 (UPLOAD_FAILED) when the result upload to openLiBing fails (e.g. APIG 429 rate limit, 5xx, network errors). Previously the action treated any non-zero exit as fatal via core.setFailed, which turned a successful scan (results.json produced) into a red PR-gate failure solely because the report could not be uploaded. Split the exit-code handling into three branches: - 0 -> success - 20 -> core.warning (non-fatal; step still passes, yellow ⚠) - others -> core.setFailed (real scan/setup failures still block) core.warning only issues ::warning:: and does not set process.exitCode (verified against the bundled @actions/core: setFailed sets ExitCode.Failure=1, warning does not), so the action step exits 0 and the PR check stays green on upload errors. Co-authored-by: opencode <noreply@opencode.ai> Generated-by: glm-5.2
2 个月前 feat: init api-miner action with clone+scan+upload pipeline JS action (node16) 镜像 code-metrics-action 结构:clone openlibing-api-parser 工具仓 → chmod 3 可执行 → pip install requirements → bash openlibing_scan.sh 上传结果到 upload_url。inputs: upload_url/repo_url/merge_id/commit_id 必填,tool_ref/skip_install/exclude 可选;tool_url 写死。含 ncc 打包、zip.js 发布脚本与示例 workflow。 Co-authored-by: opencode <noreply@opencode.ai> Generated-by: alibaba-cn/glm-5.2
2 个月前 feat: init api-miner action with clone+scan+upload pipeline JS action (node16) 镜像 code-metrics-action 结构:clone openlibing-api-parser 工具仓 → chmod 3 可执行 → pip install requirements → bash openlibing_scan.sh 上传结果到 upload_url。inputs: upload_url/repo_url/merge_id/commit_id 必填,tool_ref/skip_install/exclude 可选;tool_url 写死。含 ncc 打包、zip.js 发布脚本与示例 workflow。 Co-authored-by: opencode <noreply@opencode.ai> Generated-by: alibaba-cn/glm-5.2
2 个月前 docs(readme): update context derivation and inputs Co-authored-by: opencode <noreply@opencode.ai> Generated-by: alibaba-cn/glm-5.2
2 个月前 fix(action): pin serverUrl to gitcode.com and add PR_ID diagnostics - serverUrl 硬编码为 https://gitcode.com,不再读 ATOMGIT_SERVER_URL (实测日志 runner 注入 atomgit.com 导致 repo_url 域名错误) - action.yml upload_url 默认值临时切换到华为云 apic 地址 - deriveContext 扩展 ref 正则覆盖 pull/pull-requests/merge-requests 的 merge|head - 新增 logDiagnostics 打印 EVENT_PATH/REF/EVENT_NAME/payload 结构, 定位 GitCode pull_request_target 下 PR_ID 取空根因(需下次运行日志确认) Co-authored-by: opencode <noreply@opencode.ai> Generated-by: alibaba-cn/glm-5.2 2 个月前 refactor: rename api-miner to api-scan across repo action.yml name/package.json/package-lock/README/src/zip/示例 workflow 全部 api-miner → api-scan。远端仓已由用户在 GitCode 网页 Rename 路径为 openlibing/api-scan-action,本地 remote 更新到新 URL。dist/index.js 由 ncc 重建。示例 workflow 文件名 api-miner-scan.yml → api-scan.yml。 Co-authored-by: opencode <noreply@opencode.ai> Generated-by: alibaba-cn/glm-5.2
2 个月前 fix: read ATOMGIT_* env directly, drop @actions/github (GitCode) @actions/github 硬编码读 GITHUB_* env,GitCode Actions 设的是 ATOMGIT_*,context.repo/payload 全失效("requires GITHUB_REPOSITORY" 崩溃)。GitCode 官方不推荐 @actions/github。 改法: - 删 @actions/github 依赖 + require - 新增 readEventPayload() 读 ATOMGIT_EVENT_PATH JSON(pull_request.number/merge_commit_sha) - deriveContext() 从 ATOMGIT_REPOSITORY 推 repo_url,payload 推 merge_id/commit_id,ATOMGIT_SHA 兜底 - workspace 改读 ATOMGIT_WORKSPACE - action.yml 删 repo_url/merge_id/commit_id 三个输入(action 自推导,workflow 无需 with) 参考能跑的 openlibing-pre-commit-action(零依赖、直读 ATOMGIT_*)。 Co-authored-by: opencode <noreply@opencode.ai> Generated-by: alibaba-cn/glm-5.2
2 个月前 refactor: rename api-miner to api-scan across repo action.yml name/package.json/package-lock/README/src/zip/示例 workflow 全部 api-miner → api-scan。远端仓已由用户在 GitCode 网页 Rename 路径为 openlibing/api-scan-action,本地 remote 更新到新 URL。dist/index.js 由 ncc 重建。示例 workflow 文件名 api-miner-scan.yml → api-scan.yml。 Co-authored-by: opencode <noreply@opencode.ai> Generated-by: alibaba-cn/glm-5.2
2 个月前
api-scan-action
API-Scan 接口兼容性扫描插件,克隆 openlibing-api-parser 工具仓并执行接口扫描,结果上传到 openLiBing 平台,用于 PR 门禁阶段的接口兼容性检测。
工作流程
git clone 接口解析与扫描引擎仓 openlibing/openlibing-api-parser(分支由 tool_ref 指定)到 ${WORKSPACE}/.api-parser-tool
chmod 三个可执行:scripts/openlibing_scan.sh、cli.py、tools/api_analysis/linux-x86_64-ubuntu22-llvm15/api_analysis
pip3 install -r requirements.txt(清华源加速)
执行 bash openlibing_scan.sh,带 --source/--exclude/--output/--upload/--upload-header 参数,结果上传到 upload_url
finally 清理 .api-parser-tool 目录
使用方式
name: api-scan
on:
pull_request_target:
branches: [master ]
jobs:
api-scan:
name: api-scan task
runs-on: ["codearts-hosted" , "ubuntu-latest" , "x64" , "large" ]
steps:
- name: checkout repository
uses: checkout
with:
token: ${{ secrets.ROBOT_TOKEN }}
ref: ${{ atomgit.event.pull_request.merge_commit_sha || '' }}
- name: setup-python
uses: setup-python
with:
version: 3.12
- name: api-scan
uses: api-scan-action
输入参数
注:工具仓 URL 写死为 https://gitcode.com/openlibing/openlibing-api-parser.git,不参数化。
上下文派生
action 从 GitCode Actions runner 注入的 ATOMGIT_* 环境变量自动派生以下值(调用方无需配置):
派生项
来源
说明
workspace
ATOMGIT_WORKSPACE (GITHUB_WORKSPACE)
checkout 检出的源代码目录
repo_url
ATOMGIT_REPOSITORY (owner/repo) + 固定 https://gitcode.com
拼成 https://gitcode.com/owner/repo.git
merge_id
event payload pull_request.number;回退正则解析 ATOMGIT_REF (refs/pull|pull-requests|merge-requests/<n>/merge|head)
PR 编号(非 PR 事件为空)
commit_id
event payload pull_request.merge_commit_sha(PR 事件)或 ATOMGIT_SHA(非 PR)
上传 header 用
凭据
凭据通过以下输入参数传入(通过 APIG 网关调用 openLiBing 接口):apig-app-key / apig-app-secret。请在 workflow 的 with 中传入,凭证值使用 ${{ secrets.OPENLIBING_APIG_KEY }} / ${{ secrets.OPENLIBING_APIG_SECRET }} 引用。
依赖
openlibing-api-parser — 接口解析与扫描引擎工具仓(Python + 预编译二进制)
scripts/openlibing_scan.sh — 扫描入口脚本
cli.py — CLI 入口
tools/api_analysis/linux-x86_64-ubuntu22-llvm15/api_analysis — 语言分析二进制
requirements.txt — Python 依赖
构建
npm install
npm run package
dist/index.js 为 ncc 打包产物(已 inline 所有依赖),提交到仓供 GitCode Actions runner 直接执行。
用于在 PR 合并前自动检测 API 接口兼容性变更。该项目是一个 GitCode Actions 插件,克隆 openlibing-api-parser 引擎执行接口扫描,自动派生仓库上下文,结果上传至 openLiBing 平台,作为 CI 门禁阶段的质量卡点。【此简介由AI生成】
定制我的领域 举报项目