Skip to content

Use Changie to manage CHANGELOG #4586

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

Draft
wants to merge 3 commits into
base: development/128.0
Choose a base branch
from
Draft
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,508 changes: 2,508 additions & 0 deletions .changes/128.0.3.md

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions .changes/header.tpl.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Changelog
All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html),
and is generated by [Changie](https://github.com/miniscruff/changie).
Empty file added .changes/unreleased/.gitkeep
Empty file.
5 changes: 5 additions & 0 deletions .changes/unreleased/128.0/Added-20250425-100115.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
kind: Added
body: Use [Changie](https://changie.dev) to manage CHANGELOG generation and management.
time: 2025-04-25T10:01:15.197409405+02:00
custom:
Pull: "4586"
25 changes: 25 additions & 0 deletions .changie.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
changesDir: .changes
unreleasedDir: unreleased/128.0
headerPath: header.tpl.md
changelogPath: CHANGELOG.md
versionExt: md
versionFormat: '## {{.Version}} - {{.Time.Format "2006-01-02"}}'
kindFormat: '### {{.Kind}}'
changeFormat: '* [#{{.Custom.Pull}}](https://github.com/scality/metalk8s/pull/{{.Custom.Pull}}) {{.Body}}'
kinds:
- label: Added
- label: Changed
- label: Deprecated
- label: Removed
- label: Fixed
- label: Security
- label: Enhanced
newlines:
afterChangelogHeader: 1
beforeChangelogVersion: 1
endOfVersion: 1
custom:
- key: Pull
type: int
minInt: 1
envPrefix: CHANGIE_
6 changes: 6 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -111,3 +111,9 @@ RUN curl --fail -L -o /tmp/skopeo.tar.gz https://github.com/containers/skopeo/ar
sudo mv bin/skopeo /usr/local/bin/ && \
cd && \
rm -rf /tmp/skopeo.tar.gz /tmp/skopeo-${SKOPEO_VERSION}

ARG CHANGIE_VERSION=1.21.1

RUN curl --fail -L -o /tmp/changie.deb https://github.com/miniscruff/changie/releases/download/v${CHANGIE_VERSION}/changie_${CHANGIE_VERSION}_linux_amd64.deb && \
sudo dpkg -i /tmp/changie.deb && \
rm -f /tmp/changie.deb
97 changes: 97 additions & 0 deletions .github/workflows/changie-add-changelog.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
---
name: "create changelog"

on:
issue_comment:
types: [created]

permissions:
pull-requests: write
contents: write
packages: write

jobs:
create-changelog:
runs-on: ubuntu-latest
if: ${{ startsWith(github.event.comment.body, '/changie') && github.event.issue.pull_request }}
steps:
- name: Like comment
uses: actions/github-script@v7
with:
script: |
const {owner, repo} = context.issue
github.rest.reactions.createForIssueComment({
owner,
repo,
comment_id: context.payload.comment.id,
content: "+1",
});

- uses: actions/github-script@v7
id: get-pr
with:
script: |
const request = {
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: context.issue.number
}
core.info(`Getting PR #${request.pull_number} from ${request.owner}/${request.repo}`)
try {
const result = await github.rest.pulls.get(request)
return result.data
} catch (err) {
core.setFailed(`Request failed with error ${err}`)
}

- name: Setup outputs
id: setup
run: |
KIND=$(echo $COMMENT | cut -d " " -f2)
BODY=$(echo $COMMENT | cut -d " " -f3-)
echo "Creating change of kind: $KIND and body: $BODY"
echo "kind=$KIND" >> $GITHUB_OUTPUT
echo "body=$BODY" >> $GITHUB_OUTPUT
env:
COMMENT: ${{ github.event.comment.body }}

- uses: actions/checkout@v4
with:
persist-credentials: false
fetch-depth: 0
ref: ${{ fromJSON(steps.get-pr.outputs.result).head.ref }}

- name: Configure git repository
run: git config --global --add safe.directory "$GITHUB_WORKSPACE"

- name: New changie changes
uses: miniscruff/[email protected]
with:
version: latest
args: >
new
--kind="${{env.KIND}}"
--body="${{env.BODY}}"
--custom Issue="${{env.ISSUE}}"
env:
KIND: ${{ steps.setup.outputs.kind }}
BODY: ${{ steps.setup.outputs.body }}
ISSUE: ${{ github.event.issue.number }}

- name: Commit changes
run: |
git config --local user.email "${{ github.actor }}@users.noreply.github.com"
git config --local user.name "${{ github.actor }}"
git add .changes/unreleased
git commit -m '${{ steps.setup.outputs.body }}'
- uses: actions/create-github-app-token@v2
id: app-token
with:
app-id: ${{ vars.ACTIONS_APP_ID }}
private-key: ${{ secrets.ACTIONS_APP_PRIVATE_KEY }}
owner: ${{ github.repository_owner }}
- name: Push changes
uses: ad-m/[email protected]
with:
github_token: ${{ steps.app-token.outputs.token }}
branch: ${{ fromJSON(steps.get-pr.outputs.result).head.ref }}
67 changes: 67 additions & 0 deletions .github/workflows/changie-check-changelog.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
---
name: "check changelog"

on:
pull_request:
types:
# On by default if you specify no types.
- "opened"
- "reopened"
- "synchronize"
# For `skip-label` only.
- "labeled"
- "unlabeled"
env:
PR_COMMENT: |-
# Missing a changelog file.

To create a new changelog file, write a comment in the PR
using the `/changie` command: `/changie <kind> <change description>`

Supported kind are:

* Added
* Changed
* Deprecated
* Removed
* Fixed
* Security
* Enhanced

Examples:

* `/changie Added new FAQ question`
* `/changie Fixed typo in a blog post`
* `/changie Removed outdated section`
* `/changie Changed website layout`

> Note: If no changelog is needed on this PR, label it with
`skip changelog` to bypass this check.

jobs:
check-changelog:
runs-on: ubuntu-latest
if: "!contains(github.event.pull_request.labels.*.name, 'skip changelog')"
steps:
- name: "Clone repository"
uses: actions/checkout@v4
with:
lfs: true
fetch-depth: 0
- name: Get changed files in the docs folder
id: changelogs
uses: tj-actions/changed-files@v46
with:
files: |
.changes/unreleased/**.yaml
CHANGELOG.md

- name: Missing Changelog PR notification
if: "steps.changelogs.outputs.any_changed == 'false'"
uses: actions-cool/maintain-one-comment@v3
with:
body: ${{ env.PR_COMMENT }}

- name: Fail as the changelog is missing
if: steps.changelogs.outputs.any_changed == 'false'
run: exit 1
8 changes: 6 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# CHANGELOG
# Changelog
All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html),
and is generated by [Changie](https://github.com/miniscruff/changie).

## Release 128.0.4 (in development)

## Release 128.0.3

Expand Down
Loading