Skip to content

Add workflow for linting CHANGELOG.md #7

Add workflow for linting CHANGELOG.md

Add workflow for linting CHANGELOG.md #7

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 valid
run: |
jq -e '.introduction | has("title")' _changelog.json || (echo "::error file=CHANGELOG.md,line=1,col=1::Missing introduction title" && exit 1)
[ -z "$(jq -r '.introduction.title' _changelog.json)" && (echo "::error file=CHANGELOG.md,line=1,col=1::Empty introduction title" && exit 1)
- name: Check if introduction content is valid
run: |
jq -e '.introduction | has("content")' _changelog.json || (echo "::error file=CHANGELOG.md,line=1,col=1::Missing introduction content" && exit 1)
[ -z "$(jq -r '.introduction.content' _changelog.json)" && (echo "::error file=CHANGELOG.md,line=1,col=1::Empty introduction content" && exit 1)