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

chore(changelog): make it more usable #11519

Closed
wants to merge 2 commits into from
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
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ jobs:
with:
fetch-depth: 2

- name: Retrives changed files in CHANGELOG/unreleased/**/*.yaml
- name: Retrives changed files in CHANGELOG/unreleased/**/*.yml
id: changelog-check
uses: tj-actions/changed-files@2f7246cb26e8bb6709b6cbfc1fec7febfe82e96a # v37
with:
files: 'CHANGELOG/unreleased/**/*.yaml'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we have open PRs using the .yaml extension instead of yml, could we support both file extensions for a while (until everyone is using the new system)? Then we can rename everything to .yml and stop supporting yaml.

files: 'CHANGELOG/unreleased/**/*.yml'

- name: Requires a changelog file if 'skip-changelog' label is not added
if: ${{ !contains(github.event.*.labels.*.name, 'skip-changelog') }}
Expand All @@ -44,4 +44,4 @@ jobs:
with:
jsonSchemaFile: CHANGELOG/schema.json
yamlFiles: |
CHANGELOG/unreleased/*/*.yaml
CHANGELOG/unreleased/*/*.yml
5 changes: 5 additions & 0 deletions CHANGELOG/Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
.PHONY: new install_dependencies

new:
./new.sh

install_dependencies:
luarocks install penlight --local
luarocks install lyaml --local
4 changes: 2 additions & 2 deletions CHANGELOG/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ 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)
1/ Copy the `changelog-template.yml` file and rename with your PR number or a short message as the filename. For example, `11279.yml`, `introduce-a-new-changelog-system.yml`. (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`)
- type: Changelog type. (`feature`, `bugfix`, `dependency`, `deprecation`, `breaking_change`, `performance`)
- scope: Changelog scope. (`Core`, `Plugin`, `PDK`, `Admin API`, `Performance`, `Configuration`, `Clustering`)
- prs: List of associated GitHub PRs
- issues: List of associated GitHub issues
Expand Down
3 changes: 1 addition & 2 deletions CHANGELOG/changelog
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,7 @@ end


local function is_yaml(filename)
return pl_stringx.endswith(filename, ".yaml") or
pl_stringx.endswith(filename, ".yml")
return pl_stringx.endswith(filename, ".yml")
end

local function is_empty_table(t)
Expand Down
79 changes: 79 additions & 0 deletions CHANGELOG/new.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
#!/bin/bash
set -e

echo "What is this changelog for (kong, kong-ee, kong-manager)?"
select component in kong kong-ee kong-manager; do
case $component in
kong|kong-ee|kong-manager) break;;
*) echo "Invalid option. Please select again.";;
esac
done

echo

read -p "What is the title of the change? " title

echo

echo "What is the type of the change (feature, bugfix, dependency, deprecation, breaking_change, performance)?"
select type in feature bugfix dependency deprecation breaking_change performance; do
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The enum of type and scope are defined in the CHANGELOG/schema.json, Do you think removing hard code(feature|bugfix|dependency|deprecation|breaking_change|performance) here would make things more consistent?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Temporary measure, let's discuss later. We need something more reasonable immediately.

case $type in
feature|bugfix|dependency|deprecation|breaking_change|performance) break;;
*) echo "Invalid option. Please select again.";;
esac
done

echo

echo "What is the scope of the change (Core, Plugin, PDK, Admin API, Performance, Configuration, Clustering)?"
select scope in Core Plugin PDK "Admin API" Performance Configuration Clustering; do
case $scope in
Core|Plugin|PDK|"Admin API"|Performance|Configuration|Clustering) break;;
*) echo "Invalid option. Please select again.";;
esac
done

echo

read -p "What are the associated PRs? (comma-separated, without spaces e.g. 123,124,125) " pr_input
IFS=',' read -ra prs <<< "$pr_input"

SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
file_name="$SCRIPT_DIR/unreleased/$component/${prs[0]:-unknown}.yml"

echo

echo "New changelog will be created at $file_name"

echo

read -p "What are the associated Jira tickets? (comma-separated, without spaces e.g. FTI-123,FTI-124) " jira_input
IFS=',' read -ra jiras <<< "$jira_input"

echo

read -p "What are the associated issues? (comma-separated, without spaces e.g. 123,124,125) " issue_input
IFS=',' read -ra issues <<< "$issue_input"

echo "message: $title" > $file_name
echo "type: $type" >> $file_name
echo "scope: $scope" >> $file_name
echo "prs:" >> $file_name
for pr in "${prs[@]}"; do
echo " - $pr" >> $file_name
done
echo "jiras:" >> $file_name
for jira in "${jiras[@]}"; do
echo " - \"$jira\"" >> $file_name
done
echo "issues:" >> $file_name
for issue in "${issues[@]}"; do
echo " - $issue" >> $file_name
done

echo

echo "Changelog file generated as $file_name:"
echo "Be sure to \"git add\" and \"git commit\" this file"
echo "================================================================"
cat $file_name