logo
0
8
WeChat Login

CNB-README-GENERATE

Auth cnb Eryajf HitCount Eryajf Blog Eryajf WeChat Eryajf Awesome Stars

⚗️ 一个可以基于 YAML 元数据文件自动生成 README 文件的CNB插件


👨‍🏫 项目简介

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是保留关键字,表示所有的子项数量

☑️ TODO

  • 等cnb修复repo接口之后,支持最后更新时间,license等信息的展示
  • 支持更多模板中的语法

About

⚗️ 一个可以基于 YAML 元数据文件自动生成 README 文件的CNB插件

Language
Go58.1%
Markdown12.3%
Makefile11.3%
gitignore4%
Others14.3%