Skip to content

Commit cbfc5fd

Browse files
authored
ci(clean-dev): skip delete when the dev service doesn't exist (#29)
chore-clean-dev fired 'gcloud run services delete' on every PR close / branch delete, failing for branches that never deployed a preview Kuma (config, dependabot, main). Check existence first and skip instead of erroring.
1 parent 983a0cb commit cbfc5fd

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

.github/workflows/chore-clean-dev.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,12 @@ jobs:
3030

3131
- name: Removing CR service
3232
run: |
33-
gcloud run services delete ${{ vars.APP_NAME }}-${{ env.GITHUB_HEAD_REF_SLUG || env.GITHUB_REF_SLUG }} --region=${{ vars.GCP_REGION }} --quiet
33+
svc="${{ vars.APP_NAME }}-${{ env.GITHUB_HEAD_REF_SLUG || env.GITHUB_REF_SLUG }}"
34+
# Only branches that deployed a preview Kuma have a service; skip the rest
35+
# (config/dependabot PRs, branch deletes) instead of failing on "not found".
36+
if gcloud run services describe "$svc" --region="${{ vars.GCP_REGION }}" >/dev/null 2>&1; then
37+
gcloud run services delete "$svc" --region="${{ vars.GCP_REGION }}" --quiet
38+
echo "deleted $svc"
39+
else
40+
echo "no dev service '$svc' — nothing to clean"
41+
fi

0 commit comments

Comments
 (0)