summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcarsakiller <carsakiller@gmail.com>2024-05-23 07:38:16 +0000
committercarsakiller <carsakiller@gmail.com>2024-05-23 07:38:16 +0000
commite0a376ab0377ec86eba6aa42e5f32efa44cac17b (patch)
treeba189965bd92b378f49771830ed6beb2169b2a4d
parent87abc4245f2a24e1cc35851b6464af9588934286 (diff)
downloadlua-language-server-e0a376ab0377ec86eba6aa42e5f32efa44cac17b.zip
add: workflow to assert changelog updates
-rwxr-xr-x.github/scripts/check-changelog.sh16
-rw-r--r--.github/workflows/changelog.yml24
2 files changed, 40 insertions, 0 deletions
diff --git a/.github/scripts/check-changelog.sh b/.github/scripts/check-changelog.sh
new file mode 100755
index 00000000..8484a386
--- /dev/null
+++ b/.github/scripts/check-changelog.sh
@@ -0,0 +1,16 @@
+#!/bin/bash
+
+set -e
+
+CHANGELOG_FILE="changelog.md"
+
+git fetch
+
+# Check if the changelog file was modified in the PR
+if git diff --name-only origin/$GITHUB_BASE_REF..$GITHUB_HEAD_REF | grep -q $CHANGELOG_FILE; then
+ echo "Thank you for updating the changelog!"
+ exit 0
+else
+ echo "Changelog has not been updated. Please update $CHANGELOG_FILE!"
+ exit 1
+fi
diff --git a/.github/workflows/changelog.yml b/.github/workflows/changelog.yml
new file mode 100644
index 00000000..ccf93645
--- /dev/null
+++ b/.github/workflows/changelog.yml
@@ -0,0 +1,24 @@
+name: changelog
+
+on:
+ pull_request:
+ types: [opened, synchronize]
+ branches:
+ - master
+
+jobs:
+ check-changelog:
+ runs-on: ubuntu-latest
+ steps:
+ - name: Checkout code
+ uses: actions/checkout@v3
+ with:
+ fetch-depth: 0 # Need entire git history
+
+ - name: Set up environment
+ run: |
+ echo "GITHUB_HEAD_REF=${{ github.head_ref }}" >> $GITHUB_ENV
+ echo "GITHUB_BASE_REF=${{ github.base_ref }}" >> $GITHUB_ENV
+
+ - name: Check if changelog is updated
+ run: .github/scripts/check-changelog.sh