Skip to content

Commit

Permalink
tests/provider: Ensure CHANGELOG.md changes properly comment on forke…
Browse files Browse the repository at this point in the history
…d pull requests (hashicorp#15396)

Follows similar updates to dependencies.yml which switched to the `pull_request_target` event for correct permissions.
  • Loading branch information
bflad authored Sep 30, 2020
1 parent 9a88bb5 commit d722fd4
Showing 1 changed file with 29 additions and 6 deletions.
35 changes: 29 additions & 6 deletions .github/workflows/changelog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,30 +7,53 @@ on:
pull_request:
paths:
- CHANGELOG.md
pull_request_target:

env:
GO_VERSION: "1.14"
GO111MODULE: on

jobs:
changes:
if: github.event_name == 'pull_request_target' && !contains(fromJSON('["anGie44", "bflad", "breathingdust", "gdavison", "maryelizbeth", "YakDriver"]'), github.actor)
name: Filter Changes
runs-on: ubuntu-latest
outputs:
changed: ${{ steps.filter.outputs.changed }}
steps:
- uses: dorny/paths-filter@v2
id: filter
with:
filters: |
changed:
- CHANGELOG.md
comment:
if: github.event_name == 'pull_request' && !contains(fromJSON('["bflad", "breathingdust", "ewbankkit", "gdavison", "maryelizbeth"]'), github.actor)
needs: changes
if: ${{ needs.changes.outputs.changed == 'true' }}
name: Comment
runs-on: ubuntu-latest
steps:
- name: Find Existing PR Comment
id: prc
uses: peter-evans/find-comment@v1
with:
issue-number: ${{ github.event.pull_request.number }}
comment-author: "github-actions[bot]"
body-includes: "Please note that the `CHANGELOG.md` file contents are handled by the maintainers during merge"
- run: echo ${{ steps.prc.outputs.comment-id }}
- name: PR Comment
uses: unsplash/comment-on-pr@v1.2.0
if: ${{ steps.prc.outputs.comment-id == '' }}
uses: peter-evans/create-or-update-comment@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
msg: |-
issue-number: ${{ github.event.pull_request.number }}
body: |-
Thank you for your contribution! :rocket:
Please note that the `CHANGELOG.md` file contents are handled by the maintainers during merge. This is to prevent pull request merge conflicts, especially for contributions which may not be merged immediately. Please see the [Contributing Guide](https://github.com/terraform-providers/terraform-provider-aws/blob/master/.github/CONTRIBUTING.md) for additional pull request review items.
Please note that the `CHANGELOG.md` file contents are handled by the maintainers during merge. This is to prevent pull request merge conflicts, especially for contributions which may not be merged immediately. Please see the [Contributing Guide](https://github.com/terraform-providers/terraform-provider-aws/blob/master/docs/CONTRIBUTING.md) for additional pull request review items.
Remove any changes to the `CHANGELOG.md` file and commit them in this pull request to prevent delays with reviewing and potentially merging this pull request.
- name: Fail the check
run: exit 1
misspell:
runs-on: ubuntu-latest
steps:
Expand Down

0 comments on commit d722fd4

Please sign in to comment.