Skip to content

Initalize changelog test workflow #11

Initalize changelog test workflow

Initalize changelog test workflow #11

Workflow file for this run

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" <<< "${{ github.event.pull_request.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