Badge

获取徽章数据。Get badge data.

根据 commit SHA 和徽章名称获取徽章 SVG 或 JSON 数据。 Get badge SVG or JSON data by commit SHA and badge name. 访问令牌调用此接口需包含以下权限。Required permissions for access token. repo-commit-status:r

get/{repo}/-/badge/git/{sha}/{badge}

Request

  • Base URL: https://api.cnb.cool (the document declares no server; this is the origin it was published from)
  • URL: https://api.cnb.cool/{repo}/-/badge/git/{sha}/{badge}
  • Auth: API key in header Authorization

Path parameters

repostring required

仓库完整路径。Full repository path.

shastring required

latest 或 commit 8 位短 hash(例如 89d48c07)。latest or 8-char short commit hash (e.g. 89d48c07).

badgestring required

徽章名,例如 pr 事件徽章名为:ci/status/pull_request, 如需获取 JSON 数据,可加上 .json 后缀,如:ci/status/pull_request.json

Request body

branchstring

分支名,例如:main。不传则为默认分支,获取默认分支最新徽章。传了分支名,则获取该分支最新提交记录对应的徽章。

Response

OK

Changes

No recorded changes to this operation across all 1 revision of this API.