Skip to content

Commit

Permalink
add in changelog entry check
Browse files Browse the repository at this point in the history
  • Loading branch information
mikealfare committed Dec 5, 2024
1 parent 7080796 commit 87f439a
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 1 deletion.
57 changes: 57 additions & 0 deletions .github/workflows/_changelog-entry-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: "Changelog entry check"

on:
workflow_call:
inputs:
package:
description: "Choose the package to test"
type: string
default: "dbt-adapters"
issue:
description: "The issue/PR number"
type: string
required: true

permissions:
contents: read
pull-requests: write

jobs:
changelog-check:
if: ${{ !contains(github.event.pull_request.labels.*.name, 'Skip Changelog') }}
outputs:
exists: ${{ steps.changelog.outputs.exists }}
runs-on: ubuntu-latest
steps:
- id: changelog
uses: dorny/paths-filter@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
filters: |
exists:
- added|modified: '${{ inputs.package }}/.changes/unreleased/**.yaml'
comment:
needs: changelog-check
if: needs.changelog-check.outputs.exists == false
runs-on: ubuntu-latest
env:
COMMENT: >-
Thank you for your pull request! We could not find a changelog entry for this change.
For details on how to document a change, see the
[Contributing Guide](https://github.com/dbt-labs/dbt-adapters/blob/main/CONTRIBUTING.md).
steps:
- id: comment
uses: peter-evans/find-comment@v3
with:
issue-number: ${{ inputs.issue }}
comment-author: "github-actions[bot]"
body-includes: ${{ env.COMMENT }}
- if: steps.comment.outputs.comment-body == ''
run: gh issue comment ${{ inputs.issue }} --repo ${{ github.repository }} --body "${{ env.COMMENT }}"
shell: bash
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/github-script@v7
with:
script: core.setFailed('Changelog entry required to merge.')
7 changes: 6 additions & 1 deletion .github/workflows/pull-request-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,19 @@ name: "Pull request checks"

on:
pull_request_target:
types: [opened, reopened, synchronize]
types: [opened, reopened, synchronize, labeled, unlabeled]

# only run this once per PR at a time
concurrency:
group: ${{ github.workflow }}-${{ github.event.number }}
cancel-in-progress: true

jobs:
changelog-entry:
uses: ./.github/workflows/_changelog-entry-check.yml
with:
issue: ${{ github.event.pull_request.number }}

code-quality:
uses: ./.github/workflows/_code-quality.yml
with:
Expand Down

0 comments on commit 87f439a

Please sign in to comment.