File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ name : Check CHANGELOG Unreleased Section
2+
3+ on :
4+ pull_request :
5+ paths :
6+ - ' CHANGELOG.md'
7+ push :
8+ branches :
9+ - main
10+
11+ jobs :
12+ check-changelog :
13+ runs-on : ubuntu-latest
14+ name : Verify CHANGELOG.md has unreleased entries
15+
16+ steps :
17+ - name : Checkout repository
18+ uses : actions/checkout@v5
19+
20+ - name : Extract and validate Unreleased section
21+ shell : bash
22+ run : |
23+ # Extract content between "## Unreleased" and the next "## " section
24+ unreleased_content=$(cat CHANGELOG.md | \
25+ sed -n '/^## Unreleased$/,/^## /p' | \
26+ sed '$d' | \
27+ tail -n +2 | \
28+ sed '/^$/d' | \
29+ sed '/^[[:space:]]*$/d')
30+
31+ echo "Extracted unreleased content:"
32+ echo "$unreleased_content"
33+ echo "---"
34+
35+ # Check if the content is empty or only contains whitespace
36+ if [ -z "$unreleased_content" ]; then
37+ echo "❌ ERROR: CHANGELOG.md '## Unreleased' section is empty or contains only blank lines"
38+ echo "Please add at least one entry describing the changes in this release."
39+ exit 1
40+ else
41+ echo "✅ SUCCESS: CHANGELOG.md '## Unreleased' section contains entries"
42+ echo "Found $(echo "$unreleased_content" | wc -l) non-blank lines"
43+ fi
You can’t perform that action at this time.
0 commit comments