CNB README 生成插件,支持基于模板文件灵活自定义。访问:插件市场
一个 awesome 类型的项目,可以将每个项目的信息写入一个 YAML 文件中,规则为 items/*/*.yaml,定义一个 README.tpl 模板,然后通过本插件,自动生成 README 文件。
main: push: - runner: cpus: 8 services: - docker - git-clone-yyds imports: - https://cnb.cool/xxx/env/-/blob/main/env.yaml stages: - name: ⚗️ generate readme image: docker.cnb.cool/znb/cnb-readme-generate settings: token: "${CNB_TOKEN}" template: "README.tpl" resource: "items/*/*.yaml" groupBy: "kind" output: "README.md" printFooter: true - name: 🏧 commit readme image: tencentcom/git-commit:latest settings: add: - README.md commitMessage: "commit by ci" pushCurrent: true
| 参数 | 必须/可选 | 类型 | 说明 |
|---|---|---|---|
| token | 必须 | string | 指定CNB Token |
| template | 必须 | string | 指定模板文件路径 |
| resource | 必须 | string | 指定资源文件路径 |
| groupBy | 可选 | string | 指定分组依据,取值于资源文件中的字段 |
| output | 必须 | string | 指定输出文件路径 |
| printFooter | 可选 | bool | 是否打印底部版权信息,默认为true |
| printFunc | 可选 | bool | 打印项目提供的方法列表,默认为false |
| 方法名 | 用法 | 说明 |
|---|---|---|
| lenItemNum | {{lenItemNum}} | 输出items的数量 |
| lenGroupNum | {{lenGroupNum}} | 输出分组的数量 |
| getRepoStarCount | {{getRepoStarCount $item.repoPath}} | 输出仓库的star数 |
| getRepoForkCount | {{getRepoForkCount $item.repoPath}} | 输出仓库的fork数 |
| getRepoCreateAt | {{getRepoCreateAt $item.repoPath}} | 输出仓库创建时间 |
| updateRepoDesc | {{updateRepoDesc "znb/awesome-cnb" "🤩 记录那些CNB中优秀的仓库,📥 当前收录项目 lenItemNum 个。"}} | 更新仓库的说明信息,其中lenItemNum是保留关键字,表示所有的子项数量 |