Skip to content

Commit 3d1db6e

Browse files
authored
Add GitHub Action to ensure changelog was modified (#536)
1 parent 0b8207b commit 3d1db6e

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

.github/workflows/changelog.yaml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: changelog
2+
3+
on: [pull_request]
4+
5+
jobs:
6+
check:
7+
runs-on: ubuntu-latest
8+
9+
steps:
10+
- name: Checkout
11+
uses: actions/checkout@v2
12+
with:
13+
fetch-depth: 0
14+
15+
- name: Ensure Changelog.md was modified
16+
shell: pwsh
17+
run: |
18+
$merge_base = git merge-base HEAD origin/${{ github.base_ref }}
19+
$changes = git --no-pager diff --name-only HEAD $merge_base
20+
21+
echo 'Changed files:'
22+
echo $changes
23+
24+
$contains_changelog = $changes -split '\n' -contains 'CHANGELOG.md'
25+
26+
if (-not $contains_changelog) {
27+
echo '::error::Changelog has not been modified!'
28+
exit 1
29+
}
30+
31+
exit 0

0 commit comments

Comments
 (0)