Skip to content

Commit

Permalink
reverted changes in teardown workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
andromaqui committed Jun 19, 2024
1 parent 70f3b16 commit a7ab636
Showing 1 changed file with 26 additions and 6 deletions.
32 changes: 26 additions & 6 deletions .github/workflows/preview-env-teardown.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
name: preview-env-teardown
on:
pull_request:
types: [unlabeled, closed]

jobs:
tear-dowm-preview-env:
if: github.event.label.name == 'deploy' || (github.event.action == 'closed' && contains( github.event.pull_request.labels.*.name, 'deploy') )
runs-on: ubuntu-22.04
timeout-minutes: 20
name: teardown-preview-env
Expand All @@ -30,11 +32,29 @@ jobs:
- name: Set up Cloud SDK
uses: google-github-actions/setup-gcloud@v2

# 124
- name: Delete comment
- name: Remove files from Google bucket
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BUCKET_NAME: ${{ steps.secrets.outputs.PREVIEW_ENV_BUCKET_NAME }}
run: |
var="Preview environment has successfully been deployed. You can access it on https://preview.docs.camunda.cloud/pr-3960/index.html."
response=$(gh api -H "Accept: application/vnd.github+json" -H "X-GitHub-Api-Version: 2022-11-28" /repos/camunda/camunda-docs/issues/comments)
echo "$response" | jq --arg body "$var" '.[] | select(.body == $body)'
gcloud config set pass_credentials_to_gsutil true
gsutil -m rm -r gs://$BUCKET_NAME/pr-${{ github.event.number }}/
- name: Find Comment
uses: peter-evans/find-comment@v1
id: find-comment
env:
BUCKET_NAME: ${{ steps.secrets.outputs.PREVIEW_ENV_BUCKET_NAME }}
with:
issue-number: ${{ github.event.number }}
body-includes: Preview environment has successfully been deployed. You can access it on https://${{ env.BUCKET_NAME }}/pr-${{ github.event.number }}/index.html.

- name: Update comment
if: steps.find-comment.outputs.comment-id != ''
uses: peter-evans/create-or-update-comment@v4
env:
BUCKET_NAME: ${{ steps.secrets.outputs.PREVIEW_ENV_BUCKET_NAME }}
with:
comment-id: ${{ steps.find-comment.outputs.comment-id }}
body: |
Your preview env has been torn down.
edit-mode: replace

0 comments on commit a7ab636

Please sign in to comment.