Skip to content

Commit cc406a7

Browse files
authored
Merge pull request #54 from nsryan2/changelog
Initalize changelog test workflow
2 parents f7a3e7c + 2e3be60 commit cc406a7

File tree

2 files changed

+57
-1
lines changed

2 files changed

+57
-1
lines changed

.github/workflows/changelog_test.yml

+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: Changelog Check
2+
3+
on:
4+
pull_request:
5+
types:
6+
- opened
7+
- synchronize
8+
- reopened
9+
10+
jobs:
11+
changelog-check:
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- name: Checkout code
16+
uses: actions/checkout@v2
17+
18+
- name: Debug changed files
19+
run: |
20+
echo "Changed files:"
21+
echo "${{ github.event.pull_request.changed_files }}"
22+
23+
- name: Get all changed markdown files
24+
id: changed-markdown-files
25+
uses: tj-actions/changed-files@v44
26+
with:
27+
# Avoid using single or double quotes for multiline patterns
28+
files: |
29+
**.md
30+
31+
- name: List all changed files markdown files
32+
if: steps.changed-markdown-files.outputs.any_changed == 'true'
33+
env:
34+
ALL_CHANGED_FILES: ${{ steps.changed-markdown-files.outputs.all_changed_files }}
35+
run: |
36+
for file in ${ALL_CHANGED_FILES}; do
37+
echo "$file was changed"
38+
done
39+
40+
- name: Check for CHANGELOG.md update
41+
id: changelog-check
42+
run: |
43+
if ! grep -q "CHANGELOG.md" <<< "${{ steps.changed-markdown-files.outputs.all_changed_files }}"; then
44+
echo "Each PR must include an update to the CHANGELOG.md file."
45+
echo "::set-output name=comment::Each PR must include an update to the CHANGELOG.md file."
46+
echo "::set-output name=changelog-updated::false"
47+
else
48+
echo "CHANGELOG.md update found."
49+
echo "::set-output name=changelog-updated::true"
50+
fi
51+
52+
- name: Prevent PR merge if CHANGELOG.md is not updated
53+
if: steps.changelog-check.outputs.changelog-updated == 'false'
54+
run: |
55+
echo "The CHANGELOG.md file must be updated before merging."
56+
exit 1

CHANGELOG.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Includes New Features, Enhancements, and Bug Fixes.
1212

1313
### Documentation
1414

15-
* Changelog initialization (#26, #39, #40, #46, #47, #48, #50, #51, #52)
15+
* Changelog initialization (#26, #39, #40, #46, #47, #48, #50, #51, #52, #54)
1616
* .gitignore (#21, #34, #38)
1717
* Repo readme (#22)
1818
* Abstract (#12)

0 commit comments

Comments
 (0)