Skip to content

Commit

Permalink
Add check for CHANGELOG.md change when changelog label applied to PR (s…
Browse files Browse the repository at this point in the history
…olana-labs#33675)

* Add check for CHANGELOG.md change when changelog label applied to PR

* Update changelog
  • Loading branch information
willhickey authored Oct 20, 2023
1 parent 59cb3b5 commit e5dfc9c
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 0 deletions.
10 changes: 10 additions & 0 deletions .github/scripts/check-changelog.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash
set -uo pipefail

CHANGELOG_FILE="CHANGELOG.md"
echo "Checking: git diff --exit-code origin/${BASE_REF} -- ${CHANGELOG_FILE}"

if git diff --exit-code "origin/${BASE_REF}" -- "${CHANGELOG_FILE}"; then
>&2 echo "Error: this pull request requires an entry in $CHANGELOG_FILE, but no entry was found"
exit 1
fi
20 changes: 20 additions & 0 deletions .github/workflows/changelog-label.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Require changelog entry

on:
pull_request:
types: [opened, synchronize, reopened, labeled, unlabeled]

jobs:
check-changelog:
if: contains(github.event.pull_request.labels.*.name, 'changelog')
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Check if changes to CHANGELOG.md
shell: bash
env:
BASE_REF: ${{ github.event.pull_request.base.ref }}
run: .github/scripts/check-changelog.sh
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ Release channels have their own copy of this changelog:
<a name="edge-channel"></a>
## [1.18.0] - Unreleased
* Changes
* Added a github check to support `changelog` label
* Upgrade Notes

## [1.17.0]
Expand Down

0 comments on commit e5dfc9c

Please sign in to comment.