Skip to content

Commit 347566f

Browse files
committed
Thanks Claude
Signed-off-by: Dan Webb <dan.webb@damacus.io>
1 parent 24ea87e commit 347566f

File tree

3 files changed

+50
-34
lines changed

3 files changed

+50
-34
lines changed
Lines changed: 47 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,7 @@
1-
name: Check CHANGELOG Unreleased Section
1+
name: CHANGELOG Unreleased Section
22

3-
on:
4-
pull_request:
5-
paths:
6-
- 'CHANGELOG.md'
7-
push:
8-
branches:
9-
- main
3+
"on":
4+
push: {branches: [main]}
105

116
jobs:
127
check-changelog:
@@ -18,26 +13,47 @@ jobs:
1813
uses: actions/checkout@v5
1914

2015
- 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
16+
uses: actions/github-script@v7
17+
with:
18+
script: |
19+
const fs = require('fs');
20+
21+
// Read CHANGELOG.md
22+
const changelog = fs.readFileSync('CHANGELOG.md', 'utf8');
23+
24+
// Split into lines
25+
const lines = changelog.split('\n');
26+
27+
// Find the "## Unreleased" section
28+
const unreleasedIndex = lines.findIndex(line => line.trim() === '## Unreleased');
29+
30+
if (unreleasedIndex === -1) {
31+
core.setFailed('❌ ERROR: Could not find "## Unreleased" section in CHANGELOG.md');
32+
return;
33+
}
34+
35+
// Find the next "## " section (next version)
36+
const nextSectionIndex = lines.findIndex((line, index) =>
37+
index > unreleasedIndex && line.match(/^## \d+\.\d+\.\d+/)
38+
);
39+
40+
// Extract content between sections
41+
const endIndex = nextSectionIndex === -1 ? lines.length : nextSectionIndex;
42+
const unreleasedLines = lines.slice(unreleasedIndex + 1, endIndex);
43+
44+
// Filter out empty lines and whitespace-only lines
45+
const contentLines = unreleasedLines.filter(line =>
46+
line.trim().length > 0
47+
);
48+
49+
console.log('Extracted unreleased content:');
50+
contentLines.forEach(line => console.log(line));
51+
console.log('---');
52+
53+
// Check if there's any actual content
54+
if (contentLines.length === 0) {
55+
core.setFailed('❌ ERROR: CHANGELOG.md "## Unreleased" section is empty or contains only blank lines\nPlease add at least one entry describing the changes in this release.');
56+
} else {
57+
console.log(`✅ SUCCESS: CHANGELOG.md "## Unreleased" section contains entries`);
58+
console.log(`Found ${contentLines.length} non-blank lines`);
59+
}

.github/workflows/ci.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
name: ci
2+
name: Dokken Integration Tests
33

44
"on":
55
pull_request:
@@ -28,7 +28,7 @@ jobs:
2828
- "ubuntu-2004"
2929
- "ubuntu-2204"
3030
- "centos-stream-9"
31-
- "centos-stream-10"
31+
# - "centos-stream-10" No candidate version available for pcre-devel
3232
# - "fedora-latest"
3333
suite:
3434
- config-2
@@ -128,7 +128,6 @@ jobs:
128128
matrix:
129129
os:
130130
- "centos-stream-9"
131-
- "centos-stream-10"
132131
suite:
133132
- "config-2"
134133
- "config-3"

.github/workflows/labels.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ on:
44
types: [opened, labeled, unlabeled, synchronize]
55
jobs:
66
label:
7+
name: Require Release Label
78
runs-on: ubuntu-latest
89
permissions:
910
issues: write

0 commit comments

Comments
 (0)