From d229314f17de9e72deb2658c4406555f915a6775 Mon Sep 17 00:00:00 2001 From: Mike Alfare Date: Sat, 7 Dec 2024 14:38:02 -0500 Subject: [PATCH] point the changelog check to the new shared workflow --- .github/workflows/changelog-entry-check.yml | 82 ++------------------- 1 file changed, 6 insertions(+), 76 deletions(-) diff --git a/.github/workflows/changelog-entry-check.yml b/.github/workflows/changelog-entry-check.yml index d470c6b..67b0847 100644 --- a/.github/workflows/changelog-entry-check.yml +++ b/.github/workflows/changelog-entry-check.yml @@ -2,81 +2,11 @@ name: Changelog entry check on: pull_request: - types: - - opened - - reopened - - labeled - - unlabeled - - synchronize - -defaults: - run: - shell: bash - working-directory: ./dbt-postgres - -permissions: - contents: read - pull-requests: write + types: [opened, reopened, labeled, unlabeled, synchronize] jobs: - changelog-entry-check: - name: Check if Changelog Exists - if: ${{ !contains(github.event.pull_request.labels.*.name, 'Skip Changelog') }} - 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 - [dbt-postgres contributing guide](https://github.com/dbt-labs/dbt-postgres/blob/main/CONTRIBUTING.md). - steps: - - name: Check if changelog file was added - # https://github.com/marketplace/actions/paths-changes-filter - # For each filter, it sets output variable named by the filter to the text: - # 'true' - if any of changed files matches any of filter rules - # 'false' - if none of changed files matches any of filter rules - uses: dorny/paths-filter@v3 - id: changelog_check - with: - token: ${{ secrets.GITHUB_TOKEN }} - filters: | - exists: - - added|modified: 'dbt-postgres/.changes/unreleased/**.yaml' - - # this step uses the read permission from the GITHUB_TOKEN it inherits - - name: Check for comment - if: steps.changelog_check.outputs.exists == 'false' - uses: peter-evans/find-comment@v3 - id: changelog_comment - with: - issue-number: ${{ github.event.pull_request.number }} - comment-author: "github-actions[bot]" - body-includes: ${{ env.COMMENT }} - - - name: Set if comment already exists - if: steps.changelog_check.outputs.exists == 'false' - shell: bash - id: comment_check - run: | - if [ '${{ steps.changelog_comment.outputs.comment-body }}' = '' ]; then - echo "exists=false" >> $GITHUB_OUTPUT - echo "Comment does not exist for this PR" - else - echo "exists=true" >> $GITHUB_OUTPUT - echo "Comment already exists for this PR" - fi - - # this step uses the write permission on the PR from the GITHUB_TOKEN it inherits - - name: Create PR comment if changelog entry is missing, required, and does not exist - if: | - steps.changelog_check.outputs.exists == 'false' && - steps.comment_check.outputs.exists == 'false' - run: | - gh issue comment ${{ github.event.pull_request.number }} --repo ${{ github.repository }} --body "${{ env.COMMENT }}" - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - name: Fail job if changelog entry is missing and required - if: steps.changelog_check.outputs.exists == 'false' - uses: actions/github-script@v7 - with: - script: core.setFailed('Changelog entry required to merge.') + changelog-entry: + uses: dbt-labs/dbt-adapters/.github/workflows/_changelog-entry-check.yml@monorepo/shared-workflows + with: + pull-request: ${{ github.event.pull_request.number }} + secrets: inherit