cliff.toml 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. # git-cliff 配置文件
  2. # https://git-cliff.org/docs/configuration
  3. #
  4. # 以 "#" 开头的行是注释。
  5. # 配置选项按表和键组织。
  6. # 更多可用选项请参阅文档。
  7. [changelog]
  8. # 变更日志的标题模板
  9. header = """
  10. # 变更日志\n
  11. 本文件记录了本项目的所有重要变更。\n
  12. """
  13. # 变更日志的内容模板
  14. # https://keats.github.io/tera/docs/#introduction
  15. body = """
  16. {% if version %}\
  17. ## [{{ version | trim_start_matches(pat="v") }}] - {{ timestamp | date(format="%Y-%m-%d") }}
  18. {% else %}\
  19. ## [未发布]
  20. {% endif %}\
  21. {% for group, commits in commits | group_by(attribute="group") %}
  22. ### {{ group | striptags | trim | upper_first }}
  23. {% for commit in commits %}
  24. - {% if commit.scope %}*({{ commit.scope }})* {% endif %}\
  25. {% if commit.breaking %}[**破坏性变更**] {% endif %}\
  26. {{ commit.message | upper_first }}\
  27. {% endfor %}
  28. {% endfor %}\n
  29. """
  30. # 变更日志的页脚模板
  31. footer = """
  32. <!-- 由 git-cliff 生成 -->
  33. """
  34. # 移除内容前后的空白
  35. trim = true
  36. # 后处理器
  37. postprocessors = [
  38. # { pattern = '<REPO>', replace = "https://github.com/orhun/git-cliff" }, # 替换仓库 URL
  39. ]
  40. # 即使没有发布版本也渲染内容
  41. # render_always = true
  42. # 输出文件路径
  43. output = "CHANGELOG.md"
  44. [git]
  45. # 基于 https://www.conventionalcommits.org 解析提交信息
  46. conventional_commits = true
  47. # 过滤掉不符合规范的提交
  48. filter_unconventional = true
  49. # 将提交的每一行作为单独的提交处理
  50. split_commits = false
  51. # 提交信息的预处理正则表达式
  52. commit_preprocessors = [
  53. # 替换问题编号
  54. #{ pattern = '$(\w+\s)?#([0-9]+)$', replace = "([#${2}](<REPO>/issues/${2}))"},
  55. # 使用 https://github.com/crate-ci/typos 检查提交信息的拼写
  56. # 如果拼写错误,会自动修正。
  57. #{ pattern = '.*', replace_command = 'typos --write-changes -' },
  58. ]
  59. # 提交信息的解析和分组规则
  60. commit_parsers = [
  61. { message = "^feat", group = "🚀 新功能" },
  62. { message = "^fix", group = "🐛 Bug 修复" },
  63. { message = "^docs", group = "📚 文档更新" },
  64. { message = "^style", group = "🎨 代码样式" },
  65. { message = "^refactor", group = "🚜 代码重构" },
  66. { message = "^perf", group = "⚡ 性能优化" },
  67. { message = "^test", group = "🧪 测试相关" },
  68. { message = "^build", group = "📦 构建系统" },
  69. { message = "^ci", group = "🔧 CI 配置" },
  70. { message = "^chore", group = "⚙️ 杂项任务" },
  71. { message = "^revert", group = "◀️ 回滚变更" },
  72. { message = "^security", group = "🛡️ 安全相关" },
  73. { message = "^wip", group = "🚧 进行中" },
  74. { message = "^deps", group = "📦 依赖更新" },
  75. { message = "^init", group = "🎉 初始化" },
  76. { message = "^config", group = "⚙️ 配置变更" },
  77. { message = "^release", group = "🏷️ 版本发布" },
  78. { message = "^hotfix", group = "🔥 紧急修复" },
  79. { message = "^breaking", group = "💥 破坏性变更" },
  80. { message = ".*", group = "💼 其他" },
  81. ]
  82. # 过滤掉未被提交解析器匹配的提交
  83. filter_commits = false
  84. # 按拓扑顺序排序标签
  85. topo_order = false
  86. # 按提交时间排序(oldest 或 newest)
  87. sort_commits = "oldest"