Skip to content

disable welcome-scan-optional-info feature on stage for testing Nimbus #82

disable welcome-scan-optional-info feature on stage for testing Nimbus

disable welcome-scan-optional-info feature on stage for testing Nimbus #82

name: Deploy Preview Cleanup
on:
# when pull request is merged or closed
pull_request:
types: [closed]
env:
PROJECT_ID: ${{ secrets.GCP_PROJECT }}
SERVICE: blurts-server
REGION: us-east4
TAG: pr-${{ github.event.pull_request.number }}
DB_HOST: ${{ secrets.PREVIEW_DB_HOST }}
jobs:
deploy:
permissions:
pull-requests: write
# Secrets aren't available for Dependabot PR (because the updated
# dependencies might abuse them), so they don't have enough rights to
# do a preview deployment:
if: github.actor != 'dependabot[bot]'
runs-on: ubuntu-latest
steps:
- name: Setup Cloud SDK
uses: 'google-github-actions/auth@v2'
with:
credentials_json: '${{ secrets.GCP_SA_KEY }}'
- name: Use gcloud CLI
run: 'gcloud info'
- name: Delete created database
id: db_delete
# Delete cloud sql instance
run: 'gcloud sql instances delete blurts-server-${{ env.TAG }}'
- name: Delete created cloud run service
id: cloudrun_delete
run: gcloud run services delete blurts-server-${{ env.TAG }} --region ${{ env.REGION }} --platform managed --quiet
- name: Comment on Pull Request
uses: thollander/actions-comment-pull-request@v2
with:
GITHUB_TOKEN: ${{ github.token }}
message: Cleanup completed - database 'blurts-server-${{ env.TAG }}' destroyed, cloud run service 'blurts-server-${{ env.TAG }}' destroyed