Skip to content

Commit f124ae8

Browse files
committed
Added check-changelogs script to CI
1 parent 9952bfb commit f124ae8

File tree

2 files changed

+40
-0
lines changed

2 files changed

+40
-0
lines changed

.github/workflows/haskell.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,3 +188,22 @@ jobs:
188188
run: |
189189
./scripts/check-stylish.sh
190190
git diff --exit-code
191+
192+
check-changelogs:
193+
name: Check changelogs
194+
runs-on: ubuntu-latest
195+
defaults:
196+
run:
197+
shell: bash
198+
199+
steps:
200+
- name: Install dependencies
201+
run: sudo apt install -y fd-find
202+
203+
- uses: actions/checkout@v3
204+
205+
- name: git fetch
206+
run: git fetch origin main:main
207+
208+
- name: Check changelogs
209+
run: ./scripts/check-changelogs.sh

scripts/check-changelogs.sh

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/usr/bin/env bash
2+
3+
FD="$(which fdfind 2>/dev/null || which fd 2>/dev/null)"
4+
5+
set -eo pipefail
6+
7+
function check_project () {
8+
project=$1
9+
n=$()
10+
if [[ -n $(git diff --name-only origin/main..HEAD -- $project) ]];then
11+
if [[ -z $(git diff --name-only origin/main..HEAD -- $project/CHANGELOG.md) ]]; then
12+
echo "$project was modified but its CHANGELOG was not updated"
13+
exit 1
14+
fi
15+
fi
16+
}
17+
18+
for cbl in $($FD -e 'cabal'); do
19+
check_project $(dirname $cbl)
20+
done
21+

0 commit comments

Comments
 (0)