Skip to content

Commit

Permalink
add: workflow to assert changelog updates
Browse files Browse the repository at this point in the history
  • Loading branch information
carsakiller committed May 23, 2024
1 parent 87abc42 commit e0a376a
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 0 deletions.
16 changes: 16 additions & 0 deletions .github/scripts/check-changelog.sh
Original file line number Diff line number Diff line change
@@ -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
24 changes: 24 additions & 0 deletions .github/workflows/changelog.yml
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit e0a376a

Please sign in to comment.