From dfc542821ff433bdbd9c5227e1ac3d38ee21875d Mon Sep 17 00:00:00 2001 From: Preston Van Loon Date: Tue, 27 Feb 2024 09:53:58 -0600 Subject: [PATCH] Add github action requiring a diff to changelog.md. --- .github/workflows/changelog.yml | 39 +++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 .github/workflows/changelog.yml diff --git a/.github/workflows/changelog.yml b/.github/workflows/changelog.yml new file mode 100644 index 00000000000..a5005cd46d7 --- /dev/null +++ b/.github/workflows/changelog.yml @@ -0,0 +1,39 @@ +name: CI + +on: + pull_request: + branches: + - develop + +jobs: + # ------------------------------------------------------------------------------------------------------------------------------------------------ + # Event `pull_request`: Compare the last commit of the main branch or last remote commit of the PR branch -> to the current commit of a PR branch. + # ------------------------------------------------------------------------------------------------------------------------------------------------ + changed_files: + runs-on: ubuntu-latest + name: Check CHANGELOG.md + steps: + - uses: actions/checkout@v4 + + # ----------------------------------------------------------------------------------------------------------- + # Example 1 + # ----------------------------------------------------------------------------------------------------------- + - name: changelog modified + id: changelog-modified + uses: tj-actions/changed-files@v42 + with: + files: CHANGELOG.md + + - name: List all changed files + env: + ALL_CHANGED_FILES: ${{ steps.changelog-modified.outputs.all_changed_files }} + run: | + if [[ ${ALL_CHANGED_FILES[*]} =~ (^|[[:space:]])"CHANGELOG.md"($|[[:space:]]) ]]; + then + echo "CHANGELOG.md was modified."; + exit 0; + else + echo "CHANGELOG.md was not modified."; + echo $ALL_CHANGED_FILES; + exit 1; + fi