Add workflow for linting CHANGELOG.md #6
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: lint-changelog | |
on: | |
pull_request: | |
paths: | |
- CHANGELOG.md | |
jobs: | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: '0' | |
- name: Install dependencies | |
run: | | |
pip install parse-changelog | |
- name: Parse changelog to JSON | |
run: | | |
parse-changelog --changelog ./CHANGELOG.md > _changelog.json | |
- name: Print parsed changelog | |
run: | | |
jq . _changelog.json | |
- name: Check if introduction is present | |
run: | | |
jq -e 'has("introduction")' _changelog.json || (echo "::error file=CHANGELOG.md,line=1,col=1::Missing introduction" && exit 1) | |
- name: Check if introduction title is present | |
run: | | |
jq -e '.introduction | has("title")' _changelog.json || (echo "::error file=CHANGELOG.md,line=1,col=1::Missing introduction title" && exit 1) | |
- name: Check if introduction content is present | |
run: | | |
jq -e '.introduction | has("content")' _changelog.json || (echo "::error file=CHANGELOG.md,line=1,col=1::Missing introduction content" && exit 1) |