Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Backport release/3.4.x] chore(changelog): new way to maintain the changelog #11473

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ https://github.com/Kong/kong/blob/master/CONTRIBUTING.md#contributing
### Checklist

- [ ] The Pull Request has tests
- [ ] There's an entry in the CHANGELOG
- [ ] A changelog file has been added to `CHANGELOG/unreleased/kong` or adding `skip-changelog` label on PR if unnecessary. [README.md](https://github.com/Kong/kong/CHANGELOG/README.md) (Please ping @vm-001 if you need help)
- [ ] There is a user-facing docs PR against https://github.com/Kong/docs.konghq.com - PUT DOCS PR HERE

### Full changelog
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ on:
# ignore markdown files (CHANGELOG.md, README.md, etc.)
- '**/*.md'
- '.github/workflows/release.yml'
- 'changelog/**'
push:
paths-ignore:
# ignore markdown files (CHANGELOG.md, README.md, etc.)
Expand Down
43 changes: 43 additions & 0 deletions .github/workflows/changelog.yaml
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
3 changes: 3 additions & 0 deletions CHANGELOG/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
install_dependencies:
luarocks install penlight --local
luarocks install lyaml --local
88 changes: 88 additions & 0 deletions CHANGELOG/README.md
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
```
Loading
Loading