Skip to content

Commit

Permalink
Add finding existing comments to preview deployment workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
Aleksander Fidelus committed Aug 16, 2024
1 parent 2398b59 commit aba72b1
Showing 1 changed file with 39 additions and 4 deletions.
43 changes: 39 additions & 4 deletions .github/workflows/preview-site.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,51 @@ jobs:
projectName: ${{ vars.CLOUDFLARE_PROJECT_NAME }}
directory: 'public/'
branch: ${{ github.event.pull_request.head.ref }}
- name: Comment on PR
- name: Echo all outputs of cloudflare/pages-action
run: echo "${{ toJson(steps.deploy.outputs) }}"

- name: Find Comment
uses: peter-evans/find-comment@v3
id: fc
with:
issue-number: ${{ github.event.pull_request.number }}
comment-author: 'github-actions[bot]'
body-includes: preview environment

- name: Create comment
if: steps.fc.outputs.comment-id == ''
uses: peter-evans/create-or-update-comment@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: ${{ github.event.pull_request.number }}
body: |
:sparkles: Your changes have been deployed to a preview environment! :sparkles:
Please visit ${{ steps.deploy.outputs.alias }}) to see how your changes are reflected on the site.
Please verify everything looks as expected. Thank you for your contribution :rocket:!
### :eyes: Preview Environment :eyes:
Your changes have been successfully deployed to a preview environment! :tada:
:heavy_check_mark: We kindly ask you to visit this **[LINK](${{ steps.deploy.outputs.alias }})** to verify that everything looks as expected. :heavy_check_mark:
_Your contribution is greatly appreciated! :rocket:_
reactions: rocket

- name: Update comment
if: steps.fc.outputs.comment-id != ''
uses: peter-evans/create-or-update-comment@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: ${{ github.event.pull_request.number }}
comment-id: ${{ steps.fc.outputs.comment-id }}
body: |
### :eyes: Preview Environment :eyes:
Your changes have been successfully deployed to a preview environment! :tada:
:heavy_check_mark: We kindly ask you to visit this **[LINK](${{ steps.deploy.outputs.alias }})** to verify that everything looks as expected. :heavy_check_mark:
_Your contribution is greatly appreciated! :rocket:_
reactions: hooray
edit-mode: 'replace'

- name: Remove Label
uses: actions/github-script@v5
with:
Expand Down

0 comments on commit aba72b1

Please sign in to comment.