Skip to content

Commit 379db81

Browse files
authored
Use chloggen go tool for managing the changelog (#637)
1 parent 482cb01 commit 379db81

File tree

10 files changed

+384
-65
lines changed

10 files changed

+384
-65
lines changed

.chloggen/TEMPLATE.yaml

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Use this changelog template to create an entry for release notes.
2+
#
3+
# If your change doesn't affect end users you should instead start
4+
# your pull request title with [chore] or use the "Skip Changelog" label.
5+
6+
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
7+
change_type:
8+
9+
# The name of the area of concern in the attributes-registry, (e.g. http, cloud, db)
10+
component:
11+
12+
# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
13+
note:
14+
15+
# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists.
16+
issues: []
17+
18+
# (Optional) One or more lines of additional information to render under the primary note.
19+
# These lines will be padded with 2 spaces and then inserted directly into the document.
20+
# Use pipe (|) for multiline entries.
21+
subtext:

.chloggen/config.yaml

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# The directory that stores individual changelog entries.
2+
# Each entry is stored in a dedicated yaml file.
3+
# - 'make chlog-new' will copy the 'template_yaml' to this directory as a new entry file.
4+
# - 'make chlog-validate' will validate that all entry files are valid.
5+
# - 'make chlog-update' will read and delete all entry files in this directory, and update 'changelog_md'.
6+
7+
# Specify as relative path from root of repo.
8+
# (Optional) Default: .chloggen
9+
entries_dir: .chloggen
10+
11+
# This file is used as the input for individual changelog entries.
12+
# Specify as relative path from root of repo.
13+
# (Optional) Default: .chloggen/TEMPLATE.yaml
14+
template_yaml: .chloggen/TEMPLATE.yaml
15+
16+
# The CHANGELOG file or files to which 'chloggen update' will write new entries
17+
# (Optional) Default filename: CHANGELOG.md
18+
change_logs:
19+
user: CHANGELOG.md
20+
21+
# The default change_log or change_logs to which an entry should be added.
22+
# If 'change_logs' is specified in this file, and no value is specified for 'default_change_logs',
23+
# then 'change_logs' MUST be specified in every entry file.
24+
default_change_logs: [user]

.github/PULL_REQUEST_TEMPLATE.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,6 @@ Note: if the PR is touching an area that is not listed in the [existing areas](h
99
## Merge requirement checklist
1010

1111
* [ ] [CONTRIBUTING.md](https://github.com/open-telemetry/semantic-conventions/blob/main/CONTRIBUTING.md) guidelines followed.
12-
* [ ] [CHANGELOG.md](https://github.com/open-telemetry/semantic-conventions/blob/main/CHANGELOG.md) updated for non-trivial changes.
12+
* [ ] Change log entry added, according to the guidelines in [When to add a changelog entry](https://github.com/open-telemetry/semantic-conventions/blob/main/CONTRIBUTING.md#when-to-add-a-changelog-entry).
13+
* If your PR does not need a change log, start the PR title with `[chore]`
1314
* [ ] [schema-next.yaml](https://github.com/open-telemetry/semantic-conventions/blob/main/schema-next.yaml) updated with changes to existing conventions.

.github/workflows/changelog.yml

+88
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
# This action requires that any PR targeting the main branch should touch at
2+
# least one CHANGELOG file. If a CHANGELOG entry is not required, add the "Skip
3+
# Changelog" label to disable this action.
4+
5+
name: 'Changelog'
6+
7+
on:
8+
pull_request:
9+
types: [opened, ready_for_review, synchronize, reopened, labeled, unlabeled]
10+
branches:
11+
- main
12+
13+
concurrency:
14+
group: ${{ github.workflow }}-${{ github.head_ref }}
15+
cancel-in-progress: true
16+
17+
jobs:
18+
changelog:
19+
runs-on: ubuntu-latest
20+
if: >-
21+
${{
22+
!contains(github.event.pull_request.labels.*.name, 'dependencies') &&
23+
!contains(github.event.pull_request.labels.*.name, 'Skip Changelog') &&
24+
!contains(github.event.pull_request.title, '[chore]')
25+
}}
26+
env:
27+
PR_HEAD: ${{ github.event.pull_request.head.sha }}
28+
steps:
29+
- name: Checkout Repo
30+
uses: actions/checkout@v4
31+
with:
32+
fetch-depth: 0
33+
- name: Setup Go
34+
uses: actions/setup-go@v4
35+
with:
36+
go-version: ~1.21.6
37+
- name: Cache Go
38+
id: go-cache
39+
uses: actions/cache@v3
40+
with:
41+
path: |
42+
~/go/bin
43+
~/go/pkg/mod
44+
key: changelog-${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
45+
46+
- name: Ensure no changes to the CHANGELOG.md
47+
run: |
48+
if [[ $(git diff --name-only $(git merge-base origin/main $PR_HEAD) $PR_HEAD ./CHANGELOG*.md) ]]
49+
then
50+
echo "CHANGELOG.md should not be directly modified."
51+
echo "Please add a .yaml file to the ./.chloggen/ directory."
52+
echo "See CONTRIBUTING.md for more details."
53+
echo "Alternately, add either \"[chore]\" to the title of the pull \ request or add the \"Skip Changelog\" label if this job should be skipped."
54+
false
55+
else
56+
echo "CHANGELOG.md was not modified."
57+
fi
58+
59+
- name: Ensure ./.chloggen/*.yaml addition(s)
60+
run: |
61+
if [[ 1 -gt $(git diff --diff-filter=A --name-only $(git merge-base origin/main $PR_HEAD) $PR_HEAD ./.chloggen | grep -c \\.yaml) ]]
62+
then
63+
echo "No changelog entry was added to the ./.chloggen/ directory."
64+
echo "Please add a .yaml file to the ./.chloggen/ directory."
65+
echo "See CONTRIBUTING.md for more details."
66+
echo "Alternately, add either \"[chore]\" to the title of the pull request or add the \"Skip Changelog\" label if this job should be skipped."
67+
false
68+
else
69+
echo "A changelog entry was added to the ./.chloggen/ directory."
70+
fi
71+
72+
- name: Validate ./.chloggen/*.yaml changes
73+
run: |
74+
make chlog-validate \
75+
|| { echo "New ./.chloggen/*.yaml file failed validation."; exit 1; }
76+
77+
# In order to validate any links in the yaml file, render the config to markdown
78+
- name: Render .chloggen changelog entries
79+
run: make chlog-preview > changelog_preview.md
80+
- name: Install markdown-link-check
81+
run: npm install -g markdown-link-check
82+
- name: Run markdown-link-check
83+
run: |
84+
markdown-link-check \
85+
--verbose \
86+
--config .markdown_link_check_config.json \
87+
changelog_preview.md \
88+
|| { echo "Check that anchor links are lowercase"; exit 1; }

CHANGELOG.md

+6-4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1+
<!-- #####################################################
2+
THIS FILE IS AUTOGENERATED. DO NOT MODIFY MANUALLY!
3+
See CONTRIBUTING.md for instructions to add an entry.
4+
##################################################### -->
5+
16
# Changelog
27

3-
Please update changelog as part of any significant pull request. Place short
4-
description of your change into "Unreleased" section. As part of release process
5-
content of "Unreleased" section content will generate release notes for the
6-
release.
8+
<!-- next version -->
79

810
## Unreleased
911

0 commit comments

Comments
 (0)