mirror of
https://github.com/imsnif/bandwhich.git
synced 2026-02-09 01:59:18 +08:00
CI: use GitHub API to exempt dependabot from changelog requirement (#378)
* CI: use GitHub API to exempt dependabot from changelog requirement * Write changelog
This commit is contained in:
26
.github/workflows/require-changelog-for-PRs.yml
vendored
26
.github/workflows/require-changelog-for-PRs.yml
vendored
@@ -4,28 +4,34 @@ on:
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
get-submitter:
|
||||
name: Get the username of the PR submitter
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
submitter: ${{ steps.get-submitter.outputs.submitter }}
|
||||
steps:
|
||||
# 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/imsnif/bandwhich/pulls/${PR_NUMBER} | jq -r '"submitter=" + .user.login' | tee -a $GITHUB_OUTPUT
|
||||
|
||||
check-changelog:
|
||||
name: Check for changelog entry
|
||||
runs-on: ubuntu-latest
|
||||
# allow dependabot PRs to have no changelog
|
||||
if: github.actor != 'dependabot[bot]'
|
||||
needs: get-submitter
|
||||
env:
|
||||
PR_NUMBER: ${{ github.event.number }}
|
||||
PR_SUBMITTER: ${{ needs.get-submitter.outputs.submitter }}
|
||||
PR_BASE: ${{ github.base_ref }}
|
||||
runs-on: ubuntu-latest
|
||||
# allow dependabot PRs to have no changelog
|
||||
if: ${{ needs.get-submitter.outputs.submitter != 'dependabot[bot]' }}
|
||||
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/imsnif/bandwhich/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:"
|
||||
|
||||
@@ -8,6 +8,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
|
||||
|
||||
## Fixed
|
||||
* Remove redundant imports #377 - @cyqsimon
|
||||
* CI: use GitHub API to exempt dependabot from changelog requirement #378 - @cyqsimon
|
||||
|
||||
## Added
|
||||
* CI: include generated assets in release archive #359 - @cyqsimon
|
||||
|
||||
Reference in New Issue
Block a user