Changelog CI 项目使用教程
1. 项目的目录结构及介绍
Changelog CI 是一个用于自动生成变更日志的 GitHub Action。以下是其基本的目录结构:
changelog-ci/
├── .github/
│ └── workflows/
│ └── changelog-ci.yml
├── config/
│ ├── changelog-ci-config.json
│ └── changelog-ci-config.yaml
├── src/
│ ├── entrypoint.sh
│ └── main.py
├── CHANGELOG.md
├── README.md
└── .gitignore
目录结构介绍
- .github/workflows/: 包含 GitHub Actions 的工作流配置文件。
- config/: 包含项目的配置文件,如
changelog-ci-config.json
和changelog-ci-config.yaml
。 - src/: 包含项目的源代码文件,如
entrypoint.sh
和main.py
。 - CHANGELOG.md: 项目的变更日志文件。
- README.md: 项目的说明文档。
- .gitignore: 指定 Git 忽略的文件和目录。
2. 项目的启动文件介绍
Changelog CI 的启动文件主要是 entrypoint.sh
和 main.py
。
entrypoint.sh
entrypoint.sh
是一个 shell 脚本,用于启动和配置 Changelog CI 的运行环境。它包含了一些初始化和配置命令,确保项目能够正确运行。
main.py
main.py
是 Python 脚本,包含了 Changelog CI 的主要逻辑。它负责处理输入参数、生成变更日志并输出结果。
3. 项目的配置文件介绍
Changelog CI 支持通过 JSON 或 YAML 格式的配置文件进行自定义配置。以下是一个示例配置文件的内容:
changelog-ci-config.json
{
"changelog_type": "pull_request",
"header_prefix": "Version:",
"commit_changelog": true,
"comment_changelog": true
}
changelog-ci-config.yaml
changelog_type: pull_request
header_prefix: Version:
commit_changelog: true
comment_changelog: true
配置文件选项
- changelog_type: 指定生成变更日志的方式,可选值为
pull_request
或commit_message
。 - header_prefix: 变更日志版本号的前缀,例如
Version:
。 - commit_changelog: 是否将变更日志提交到仓库,可选值为
true
或false
。 - comment_changelog: 是否在拉取请求中评论变更日志,可选值为
true
或false
。
通过这些配置文件,用户可以灵活地调整 Changelog CI 的行为,以满足不同的需求。