logo
1
3
Login

No-Square 项目

no-squre 是一个 CNB 插件,用于统计组织下所有的开源仓库 star 总数,并将 star 数量作为徽章附着在您的组织头像上。

效果展示: https://cnb.cool/looc

使用方式

由于 star 的数量变化往往不是那么频繁,因此推荐使用 crontab 事件或自定义按钮手动触发,以便节约您的构建核时。

配置参考: https://cnb.cool/looc/no-square/-/blob/main/.cnb.yml

由于更新组织头像的 API 需要的 token 权限比较大,建议使用密钥仓库来保存,格式如下:

NO_SQUARE_TOKEN: f******************G

TOKEN 需要如下权限:

  • group-resource:r
  • group-manage:rw
  • repo-code:rw

自定义按钮触发

.cnb/web_trigger.yml

branch: - buttons: - name: 组织头像加星 description: 组织头像加星 event: web_trigger_no_square

.cnb.yml

"**": web_trigger_no_square: - imports: https://cnb.cool/looc/secret/-/blob/main/envs.yml stages: - name: 组织头像加星 jobs: - name: 获取第一个 commitID script: git rev-list --max-parents=0 HEAD exports: info: FIRST_COMMIT_ID - name: 更新组织头像 image: docker.cnb.cool/looc/no-square:latest script: /app/no-square

定时任务触发

比如每天凌晨 2 点触发一次

.cnb.yml

main: "crontab: 0 2 * * *": - imports: https://cnb.cool/looc/secret/-/blob/main/envs.yml stages: - name: 组织头像加星 jobs: - name: 获取第一个 commitID script: git rev-list --max-parents=0 HEAD exports: info: FIRST_COMMIT_ID - name: 更新组织头像 image: docker.cnb.cool/looc/no-square:latest script: /app/no-square

About

不仅仅是个正方形

Language
Go97.9%
Dockerfile2.1%