mirror of
https://github.com/sharkdp/bat.git
synced 2024-11-01 04:21:01 +01:00
487bed2d95
* Mention changelog requirements in CONTRIBUTING * Refer to CONTRIBUTING in changelog workflow * Clarify when changelog entries are necessary --------- Co-authored-by: Martin Nordholts <martin.nordholts@codetale.se>
34 lines
1.2 KiB
YAML
34 lines
1.2 KiB
YAML
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
|
|
|
|
# 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
|
|
|
|
- name: Search for added line in changelog
|
|
env:
|
|
PR_SUBMITTER: ${{ steps.get-submitter.outputs.submitter }}
|
|
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 (see CONTRIBUTING.md):"
|
|
grep "#${PR_NUMBER}\\b.*@${PR_SUBMITTER}\\b" <<< "$ADDED"
|