Skip to content

Commit

Permalink
Fix PR submitter detection (#342)
Browse files Browse the repository at this point in the history
  • Loading branch information
cyqsimon authored Dec 8, 2023
1 parent da5fc0b commit 0a89c5a
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion .github/workflows/require-changelog-for-PRs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,22 @@ jobs:
# 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

# 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:"
Expand Down

0 comments on commit 0a89c5a

Please sign in to comment.