2023-11-03 07:53:29 +00:00
|
|
|
name: Changelog
|
|
|
|
|
|
|
|
on:
|
|
|
|
pull_request:
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
check-changelog:
|
|
|
|
name: Check for changelog entry
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
# dependabot PRs are automerged if CI passes; we shouldn't block these
|
|
|
|
if: github.actor != 'dependabot[bot]'
|
|
|
|
env:
|
|
|
|
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
|
2023-12-01 11:18:10 +00:00
|
|
|
|
|
|
|
# cannot use `github.actor`: the triggering commit may be authored by a maintainer
|
|
|
|
- name: Get PR submitter
|
|
|
|
id: get-submitter
|
|
|
|
run: curl -sSfL https://api.github.com/repos/sharkdp/bat/pulls/${PR_NUMBER} | jq -r '"submitter=" + .user.login' | tee -a $GITHUB_OUTPUT
|
|
|
|
|
2023-11-03 07:53:29 +00:00
|
|
|
- name: Search for added line in changelog
|
2023-12-01 11:18:10 +00:00
|
|
|
env:
|
|
|
|
PR_SUBMITTER: ${{ steps.get-submitter.outputs.submitter }}
|
2023-11-03 07:53:29 +00:00
|
|
|
run: |
|
|
|
|
ADDED=$(git diff -U0 "origin/${PR_BASE}" HEAD -- CHANGELOG.md | grep -P '^\+[^\+].+$')
|
|
|
|
echo "Added lines in CHANGELOG.md:"
|
|
|
|
echo "$ADDED"
|
2024-02-24 22:58:20 +00:00
|
|
|
echo "Grepping for PR info (see CONTRIBUTING.md):"
|
2023-11-03 07:53:29 +00:00
|
|
|
grep "#${PR_NUMBER}\\b.*@${PR_SUBMITTER}\\b" <<< "$ADDED"
|