Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initalize changelog test workflow #54

Merged
merged 12 commits into from
Jul 24, 2024
56 changes: 56 additions & 0 deletions .github/workflows/changelog_test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Changelog Check

on:
pull_request:
types:
- opened
- synchronize
- reopened

jobs:
changelog-check:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Debug changed files
run: |
echo "Changed files:"
echo "${{ github.event.pull_request.changed_files }}"

- name: Get all changed markdown files
id: changed-markdown-files
uses: tj-actions/changed-files@v44
with:
# Avoid using single or double quotes for multiline patterns
files: |
**.md

- name: List all changed files markdown files
if: steps.changed-markdown-files.outputs.any_changed == 'true'
env:
ALL_CHANGED_FILES: ${{ steps.changed-markdown-files.outputs.all_changed_files }}
run: |
for file in ${ALL_CHANGED_FILES}; do
echo "$file was changed"
done

- name: Check for CHANGELOG.md update
id: changelog-check
run: |
if ! grep -q "CHANGELOG.md" <<< "${{ steps.changed-markdown-files.outputs.all_changed_files }}"; then
echo "Each PR must include an update to the CHANGELOG.md file."
echo "::set-output name=comment::Each PR must include an update to the CHANGELOG.md file."
echo "::set-output name=changelog-updated::false"
else
echo "CHANGELOG.md update found."
echo "::set-output name=changelog-updated::true"
fi

- name: Prevent PR merge if CHANGELOG.md is not updated
if: steps.changelog-check.outputs.changelog-updated == 'false'
run: |
echo "The CHANGELOG.md file must be updated before merging."
exit 1
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Includes New Features, Enhancements, and Bug Fixes.

### Documentation

* Changelog initialization (#26, #39, #40, #46, #47, #48, #50, #51, #52)
* Changelog initialization (#26, #39, #40, #46, #47, #48, #50, #51, #52, #54)
* .gitignore (#21, #34, #38)
* Repo readme (#22)
* Abstract (#12)
Expand Down
Loading