Skip to content

Commit bd67d48

Browse files
authored
Improve changelog validation
* Cleanup versions in changelog * Refactor changelog to validate. Use nested lists for contents of each version. * Fix internal link in changelog * Refactor action to use 2 jobs
1 parent e912575 commit bd67d48

File tree

2 files changed

+392
-379
lines changed

2 files changed

+392
-379
lines changed

.github/workflows/changelog-validator.yml

+28-1
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,41 @@ on:
77
- 'docs/changelog.md'
88

99
jobs:
10-
validate:
10+
validate-unreleased:
11+
# Validates changelog and confirms that an Unreleased entry exists.
12+
# Only run when the `release` label is not set on a PR.
13+
if: ${{ ! contains(github.event.pull_request.labels.*.name, 'release') }}
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v4
17+
- name: Validate Changelog
18+
id: changelog_reader
19+
uses: mindsers/changelog-reader-action@v2
20+
with:
21+
validation_level: error
22+
path: docs/changelog.md
23+
version: Unreleased
1124

25+
validate-release:
26+
# Validates changelog and confirms an entry exists for version in code.
27+
# Only run when the `release` label is set on a PR.
28+
if: ${{ contains(github.event.pull_request.labels.*.name, 'release') }}
1229
runs-on: ubuntu-latest
1330
steps:
1431
- uses: actions/checkout@v4
32+
- name: Setup Python
33+
uses: actions/setup-python@v4
34+
with:
35+
python-version: 3.11
36+
- name: Install Markdown
37+
run: python -m pip install semver .
38+
- name: Get Markdown Version
39+
id: markdown
40+
run: echo "version=$(python -c 'import markdown, semver; print(semver.Version.parse(markdown.__version__, optional_minor_and_patch=True))')" >> $GITHUB_OUTPUT
1541
- name: Validate Changelog
1642
id: changelog_reader
1743
uses: mindsers/changelog-reader-action@v2
1844
with:
1945
validation_level: error
2046
path: docs/changelog.md
47+
version: ${{ steps.markdown.outputs.version }}

0 commit comments

Comments
 (0)