-
-
Notifications
You must be signed in to change notification settings - Fork 298
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CI: ensure a changelog entry exists for each PR (#331)
* CI: ensure a changelog entry exists for each PR * Write CHANGELOG * Fix grep by adding `-P`
- Loading branch information
Showing
2 changed files
with
30 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
name: Changelog | ||
|
||
on: | ||
pull_request: | ||
|
||
jobs: | ||
check-changelog: | ||
name: Check for changelog entry | ||
runs-on: ubuntu-latest | ||
# allow dependabot PRs to have no changelog | ||
if: github.actor != 'dependabot[bot]' | ||
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 -P "(#|pull/)${PR_NUMBER}\\b.*@${PR_SUBMITTER}\\b" <<< "$ADDED" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters