-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(changelog): new way to maintain the changelog (#11279)
Summary Maintaining changelogs in a single markdown file in the repo is one of the easy ways to maintain and also keep consistency. Since Kong has multiple release versions, sometimes a bug fix needs to be backported to all the supported versions after it gets merged to the master branch. The backport bot is currently broken because of the git conflict. We're Introducing a new way to maintain Kong's changelog, which makes the changelog item become an individual file. The idea is, that you don't get the conflict if you don't edit the same file. --------- Co-authored-by: Hans Hübner <[email protected]> Co-authored-by: Wangchong Zhou <[email protected]> (cherry picked from commit 17c971b)
- Loading branch information
1 parent
e32df85
commit 574f1b0
Showing
10 changed files
with
562 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
name: Changelog | ||
|
||
on: | ||
pull_request: | ||
types: [ "opened", "synchronize", "labeled", "unlabeled" ] | ||
|
||
jobs: | ||
require-changelog: | ||
name: Is changelog required? | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 2 | ||
|
||
- name: Retrives changed files in CHANGELOG/unreleased/**/*.yaml | ||
id: changelog-check | ||
uses: tj-actions/changed-files@5817a9efb0d7cc34b917d8146ea10b9f32044968 # v37 | ||
with: | ||
files: 'CHANGELOG/unreleased/**/*.yaml' | ||
|
||
- name: Requires a changelog file if 'skip-changelog' label is not added | ||
if: ${{ !contains(github.event.*.labels.*.name, 'skip-changelog') }} | ||
run: > | ||
if [ "${{ steps.changelog-check.outputs.added_files_count }}" = "0" ]; then | ||
echo "PR should contain a changelog file" | ||
exit 1 | ||
fi | ||
validate-changelog: | ||
name: Validate changelog | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Validate changelogs | ||
uses: thiagodnf/yaml-schema-checker@228a5be72029114e3cd6301e0aaeef6b557fa033 # v0.0.8 | ||
with: | ||
jsonSchemaFile: CHANGELOG/schema.json | ||
yamlFiles: | | ||
CHANGELOG/unreleased/*/*.yaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
install_dependencies: | ||
luarocks install penlight --local | ||
luarocks install lyaml --local |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
# CHANGELOG | ||
|
||
The CHANGELOG directory is used for individual changelog file practice. | ||
The `kong/CHANGELOG.md` now is deprecated. | ||
|
||
|
||
## How to add a changelog file for your PR? | ||
|
||
1/ Copy the `changelog-template.yaml` file and rename with your PR number or a short message as the filename. For example, `11279.yaml`, `introduce-a-new-changelog-system.yaml`. (Prefer using PR number as it's already unique and wouldn't introduce conflict) | ||
|
||
2/ Fill out the changelog template. | ||
|
||
|
||
The description of the changelog file field, please follow the `schema.json` for more details. | ||
|
||
- message: Message of the changelog | ||
- type: Changelog type. (`feature`, `bugfix`, `dependency`, `deprecation`, `breaking_change`) | ||
- scope: Changelog scope. (`Core`, `Plugin`, `PDK`, `Admin API`, `Performance`, `Configuration`, `Clustering`) | ||
- prs: List of associated GitHub PRs | ||
- issues: List of associated GitHub issues | ||
- jiras: List of associated Jira tickets for internal track | ||
|
||
Sample 1 | ||
```yaml | ||
message: Introduce the request id as core feature. | ||
type: feat | ||
scope: Core | ||
prs: | ||
- 11308 | ||
``` | ||
Sample 2 | ||
```yaml | ||
message: Fix response body gets repeated when `kong.response.get_raw_body()` is called multiple times in a request lifecycle. | ||
type: bugfix | ||
scope: PDK | ||
prs: | ||
- 11424 | ||
jiras: | ||
- "FTI-5296" | ||
``` | ||
## changelog command | ||
The `changelog` command tool provides `preview`, and `release` commands. | ||
|
||
### Prerequisites | ||
|
||
You can skip this part if you're at Kong Bazel virtual env. | ||
|
||
Install luajit | ||
|
||
Install luarocks libraries | ||
|
||
``` | ||
luarocks install penlight --local | ||
luarocks install lyaml --local | ||
``` | ||
### Usage | ||
```shell | ||
$ ./changelog -h | ||
Usage: changelog <command> [options] | ||
Commands: | ||
release <version> release a release note based on the files in the CHANGELOG/unreleased directory. | ||
preview <version> preview a release note based on the files in the CHANGELOG/unreleased directory. | ||
Options: | ||
-h, --help display help for command | ||
Examples: | ||
changelog preview 1.0.0 | ||
changelog release 1.0.0 | ||
``` | ||
|
||
**Preview a release note** | ||
```shell | ||
./changelog preview 1.0.0 | ||
``` | ||
|
||
**Release a release note** | ||
```shell | ||
./changelog release 1.0.0 | ||
``` |
Oops, something went wrong.