Skip to content

Commit

Permalink
Added changelog item check
Browse files Browse the repository at this point in the history
Fetch the base branch and diff correctly

- See: actions/checkout#160

Improve organisation

Add some echo for easier debugging

Fix bad variable syntax

Clarify the double-print in the success case
  • Loading branch information
cyqsimon committed Nov 3, 2023
1 parent 1296aea commit 367ad2f
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions .github/workflows/require-changelog-for-PRs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Changelog

on:
pull_request:

jobs:
check-changelog:
name: Check for changelog entry
runs-on: ubuntu-latest
env:
PR_SUBMITTER: ${{ github.actor }}
PR_NUMBER: ${{ github.event.number }}
PR_BASE: ${{ github.base_ref }}
steps:
- uses: actions/checkout@v4
- name: Fetch PR base
run: git fetch --no-tags --prune --depth=1 origin
- name: Search for added line in changelog
run: |
ADDED=$(git diff -U0 "origin/${PR_BASE}" HEAD -- CHANGELOG.md | grep -P '^\+[^\+].+$')
echo "Added lines in CHANGELOG.md:"
echo "$ADDED"
echo "Grepping for PR info:"
grep "#${PR_NUMBER}\\b.*@${PR_SUBMITTER}\\b" <<< "$ADDED"

0 comments on commit 367ad2f

Please sign in to comment.