Skip to content

Commit

Permalink
Use GitHub API to get correct PR submitter (#2791)
Browse files Browse the repository at this point in the history
  • Loading branch information
cyqsimon authored Dec 1, 2023
1 parent 96cef9a commit 51203ff
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
9 changes: 8 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,21 @@ jobs:
# dependabot PRs are automerged if CI passes; we shouldn't block these
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
- Upgrade to Rust 2021 edition #2748 (@cyqsimon)
- Refactor and cleanup build script #2756 (@cyqsimon)
- Checks changelog has been written to for PRs in CI #2766 (@cyqsimon)
- Use GitHub API to get correct PR submitter #2791 (@cyqsimon)
- Minor benchmark script improvements #2768 (@cyqsimon)
- Update and improve `zsh` completion, see #2772 (@okapia)

Expand Down

0 comments on commit 51203ff

Please sign in to comment.