Skip to content

Commit 24bd461

Browse files
committed
Verify CHANGELOG date on CI
1 parent e56083b commit 24bd461

File tree

1 file changed

+25
-1
lines changed

1 file changed

+25
-1
lines changed

.github/workflows/ci.yml

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,30 @@ jobs:
4545
# Testing #
4646
###########
4747

48+
changelog:
49+
if: ${{ github.event_name == 'push'
50+
&& startsWith(github.ref, 'refs/tags/') }}
51+
runs-on: ubuntu-latest
52+
steps:
53+
- uses: actions/checkout@v4
54+
55+
- name: Parse semver versions from Git tag
56+
id: semver
57+
uses: actions-ecosystem/action-regex-match@v2
58+
with:
59+
text: ${{ github.ref }}
60+
regex: '^refs/tags/((([0-9]+)\.[0-9]+)\.[0-9]+-(.+))$'
61+
62+
- name: Ensure CHANGELOG date is today
63+
run: |
64+
today="$(date '+%Y-%m-%d')"
65+
changelog="$(grep -E '^## \[${{ steps.semver.outputs.group1 }}\] ·' \
66+
CHANGELOG.md \
67+
| cut -d' ' -f4 | tr -d ' ')"
68+
echo "Changelog: $changelog"
69+
echo "Today: $today"
70+
[ "$changelog" = "$today" ]
71+
4872
test:
4973
needs: ["build"]
5074
runs-on: ubuntu-latest
@@ -71,7 +95,7 @@ jobs:
7195
push:
7296
if: ${{ github.event_name == 'push'
7397
&& startsWith(github.ref, 'refs/tags/') }}
74-
needs: ["build", "test"]
98+
needs: ["build", "changelog", "test"]
7599
strategy:
76100
fail-fast: false
77101
matrix:

0 commit comments

Comments
 (0)