Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(preview-envs): Look into improving commenting of preview enviro… #4060

Merged
merged 4 commits into from
Jul 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 12 additions & 32 deletions .github/workflows/preview-env-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,21 +28,12 @@ jobs:
secret/data/products/camunda-docs/ci/preview-environment PREVIEW_ENV_BUCKET_NAME;
secret/data/products/camunda-docs/ci/preview-environment PREVIEW_ENV_GCLOUD_SA_KEY;

- name: Find previous deployment or tear-down comment
uses: peter-evans/find-comment@v3
id: find-comment
with:
issue-number: ${{ github.event.number }}
body-includes: <!-- preview-env -->

- name: Upsert comment with build status
uses: peter-evans/create-or-update-comment@v4
uses: mshick/add-pr-comment@v2
with:
comment-id: ${{ steps.find-comment.outputs.comment-id }}
issue-number: ${{ github.event.number }}
body: |
:construction: The preview environment for the commit ${{ github.sha }} is being built. This usually takes 15-20 minutes. <!-- preview-env -->
edit-mode: replace
refresh-message-position: true
message: |
:construction: The preview environment for the commit ${{ github.sha }} is being built. This usually takes 15-20 minutes.

- name: Install Dependencies
run: npm ci
Expand Down Expand Up @@ -73,21 +64,12 @@ jobs:
env: ${{ github.event.repository.name }}
ref: ${{ github.event.pull_request.head.sha }}

- name: Find build status comment
uses: peter-evans/find-comment@v3
id: find-build-comment
with:
issue-number: ${{ github.event.number }}
body-includes: <!-- preview-env -->

- name: Update comment with upload status
uses: peter-evans/create-or-update-comment@v4
uses: mshick/add-pr-comment@v2
with:
comment-id: ${{ steps.find-build-comment.outputs.comment-id }}
issue-number: ${{ github.event.number }}
body: |
:arrow_up: The preview environment build results for commit ${{ github.sha }} is being uploaded. This usually takes 3-4 minutes. <!-- preview-env -->
edit-mode: replace
refresh-message-position: true
message: |
:arrow_up: The preview environment build results for commit ${{ github.sha }} are being uploaded. This usually takes 3-4 minutes.

- name: Upload files to Google bucket
env:
Expand All @@ -105,12 +87,10 @@ jobs:
env_url: https://${{ steps.secrets.outputs.PREVIEW_ENV_BUCKET_NAME }}/pr-${{ github.event.number }}/index.html

- name: Update comment with deployment status
uses: peter-evans/create-or-update-comment@v4
uses: mshick/add-pr-comment@v2
env:
BUCKET_NAME: ${{ steps.secrets.outputs.PREVIEW_ENV_BUCKET_NAME }}
with:
comment-id: ${{ steps.find-build-comment.outputs.comment-id }}
issue-number: ${{ github.event.number }}
body: |
The preview environment relating to the commit ${{ github.sha }} has successfully been deployed. You can access it at [https://${{ env.BUCKET_NAME }}/pr-${{ github.event.number }}/index.html](https://${{ env.BUCKET_NAME }}/pr-${{ github.event.number }}/index.html) <!-- preview-env -->
edit-mode: replace
refresh-message-position: true
message: |
The preview environment relating to the commit ${{ github.sha }} has successfully been deployed. You can access it at [https://${{ env.BUCKET_NAME }}/pr-${{ github.event.number }}/index.html](https://${{ env.BUCKET_NAME }}/pr-${{ github.event.number }}/index.html)
27 changes: 8 additions & 19 deletions .github/workflows/preview-env-teardown.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,21 +29,12 @@ jobs:
with:
credentials_json: ${{ steps.secrets.outputs.PREVIEW_ENV_GCLOUD_SA_KEY }}

- name: Find deployment status comment
uses: peter-evans/find-comment@v3
id: find-comment
with:
issue-number: ${{ github.event.number }}
body-includes: <!-- preview-env -->

- name: Update comment with tear-down warning
if: steps.find-comment.outputs.comment-id != ''
uses: peter-evans/create-or-update-comment@v4
uses: mshick/add-pr-comment@v2
with:
comment-id: ${{ steps.find-comment.outputs.comment-id }}
body: |
:warning: Preview environment for commit ${{ github.sha }} is being deleted. This usually takes 2-3 minutes. <!-- preview-env -->
edit-mode: replace
refresh-message-position: true
message: |
:warning: Preview environment for commit ${{ github.sha }} is being deleted. This usually takes 2-3 minutes.

- name: Set up Cloud SDK
uses: google-github-actions/setup-gcloud@v2
Expand All @@ -64,10 +55,8 @@ jobs:
ref: ${{ github.event.pull_request.head.sha }}

- name: Update comment with tear-down status
if: steps.find-comment.outputs.comment-id != ''
uses: peter-evans/create-or-update-comment@v4
uses: mshick/add-pr-comment@v2
with:
comment-id: ${{ steps.find-comment.outputs.comment-id }}
body: |
:broom: Preview environment for this PR has been torn down. <!-- preview-env -->
edit-mode: replace
refresh-message-position: true
message: |
:broom: Preview environment for this PR has been torn down.
Loading