-
Notifications
You must be signed in to change notification settings - Fork 40
65 lines (60 loc) · 2.37 KB
/
_changelog-entry-check.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
name: "Changelog entry check"
# this cannot be tested via workflow_dispatch
# dorny/paths-filter inspects the current trigger to determine how to compare branches
on:
workflow_call:
inputs:
package:
description: "Choose the package to test"
type: string
default: "dbt-adapters"
pull-request:
description: "The PR number"
type: string
required: true
permissions:
contents: read
pull-requests: write
jobs:
package:
uses: ./.github/workflows/_package-directory.yml
with:
package: ${{ inputs.package }}
changelog-check:
needs: package
if: ${{ !contains(github.event.pull_request.labels.*.name, 'Skip Changelog') }}
outputs:
exists: ${{ steps.changelog.outputs.exists }}
runs-on: ${{ vars.DEFAULT_RUNNER }}
steps:
- id: changelog
uses: dorny/paths-filter@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
filters: |
exists:
- added|modified: '${{ needs.package.outputs.directory }}.changes/unreleased/**.yaml'
comment:
needs: changelog-check
if: needs.changelog-check.outputs.exists == false
runs-on: ${{ vars.DEFAULT_RUNNER }}
env:
AUTHOR: "github-actions[bot]"
COMMENT: >-
Thank you for your pull request! We could not find a changelog entry for this change in the ${{ inputs.package }} package.
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.pull-request }}
comment-author: ${{ env.AUTHOR }}
body-includes: ${{ env.COMMENT }}
- if: steps.comment.outputs.comment-body == ''
run: gh issue comment ${{ inputs.pull-request }} --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.')