Skip to content

Commit

Permalink
check if deploy preview service exists before attempting delete (#915)
Browse files Browse the repository at this point in the history
  • Loading branch information
robbymilo authored Dec 9, 2024
1 parent fdbc047 commit c4e62ed
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion .github/workflows/deploy-preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,12 @@ jobs:
- name: Delete deploy preview
if: github.event.action == 'closed'
run: |
gcloud run services delete deploy-preview-${{ inputs.repo }}-${{ inputs.event_number }} --region=${{ env.CLOUD_RUN_REGION }} --project=grafanalabs-dev --quiet
SERVICE_NAME=deploy-preview-${{ inputs.repo }}-${{ inputs.event_number }}
if gcloud run services describe $SERVICE_NAME --region=${{ env.CLOUD_RUN_REGION }} --project=grafanalabs-dev > /dev/null 2>&1; then
gcloud run services delete $SERVICE_NAME --region=${{ env.CLOUD_RUN_REGION }} --project=grafanalabs-dev --quiet
else
echo "Service $SERVICE_NAME does not exist. Skipping step."
fi
- name: Send commit status
uses: ouzi-dev/commit-status-updater@26588d166ff273fc4c0664517359948f7cdc9bf1 # v2.0.2
Expand Down

0 comments on commit c4e62ed

Please sign in to comment.