From a927335f8ae6caf2ac471a5fa4de5e3dfe26ae81 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=CE=B6eh=20Matt?= <5415177+ZehMatt@users.noreply.github.com> Date: Wed, 20 Dec 2023 18:27:06 +0200 Subject: [PATCH] Update CI workflow --- .github/workflows/ci.yml | 11 +++++++++++ scripts/check-changelog-formatting | 23 +++++++++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100755 scripts/check-changelog-formatting diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 13054f3e45..157a126ec1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -58,6 +58,17 @@ jobs: uses: actions/checkout@v3 - name: Run clang-format run: scripts/check-code-formatting + check-changelog-formatting: + name: Check changelog formatting + runs-on: ubuntu-latest + defaults: + run: + shell: bash + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Run check-changelog-formatting + run: scripts/check-changelog-formatting windows: name: Windows runs-on: windows-latest diff --git a/scripts/check-changelog-formatting b/scripts/check-changelog-formatting new file mode 100755 index 0000000000..6c2dfbaa50 --- /dev/null +++ b/scripts/check-changelog-formatting @@ -0,0 +1,23 @@ +#!/usr/bin/env bash + +# Run the script and capture the output +output=$(node scripts/format-changelog.js distribution/changelog.txt) + +# Check if the script ran successfully +if [ $? -eq 0 ]; then + echo "Script ran successfully. Running diff..." + # Run diff on the original file and the output + diff --color=always -b <(echo "$output") distribution/changelog.txt + # If diff finds differences, exit with a non-zero status + if [ $? -ne 0 ]; then + echo "Differences found. Exiting with status 1." + exit 1 + else + echo "No differences found. Exiting with status 0." + exit 0 + fi +else + echo "Script encountered an error:" + echo "$output" + exit 1 +fi \ No newline at end of file