ci: Add check for modification of changelog

This commit is contained in:
Lars Toenning
2026-06-28 12:34:20 +02:00
parent aea556c927
commit 8a2e0e5cf3

View File

@@ -59,12 +59,45 @@ jobs:
checks:
runs-on: ubuntu-22.04
needs: preBuild
permissions:
pull-requests: read
contents: read
steps:
- name: Checkout repository
uses: actions/checkout@v6
with:
fetch-depth: '0'
- name: Check for CHANGELOG or no-changelog label
if: github.event_name == 'pull_request'
env:
GH_TOKEN: ${{ github.token }}
run: |
set -e
BASE_SHA="${{ github.event.pull_request.base.sha }}"
HEAD_SHA="${{ github.event.pull_request.head.sha }}"
echo "Checking changed files..."
if git diff --name-only "$BASE_SHA" "$HEAD_SHA" | grep -qx "CHANGELOG.md"; then
echo "✅ CHANGELOG.md was modified."
exit 0
fi
echo "CHANGELOG.md not modified. Checking labels..."
LABELS=$(gh api \
repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}/labels \
--jq '.[].name')
if echo "$LABELS" | grep -qx "no-changelog"; then
echo "✅ no-changelog label found."
exit 0
fi
echo "::error::This PR must either modify CHANGELOG.md or have the 'no-changelog' label."
exit 1
- name: Install gitlint
run: |
pip install gitlint==0.19.1