Skip to content

build(deps): bump docker/build-push-action from 6.4.1 to 6.6.1 #42

build(deps): bump docker/build-push-action from 6.4.1 to 6.6.1

build(deps): bump docker/build-push-action from 6.4.1 to 6.6.1 #42

name: Delete Cloud Run instances on PR closed by merged
on:
pull_request:
branches:
- master
types: [closed]
jobs:
delete-cloud-run:
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest
steps:
- name: Inject slug/short variables
uses: rlespinasse/[email protected]
- id: 'auth'
name: 'Authenticate to Google Cloud'
uses: 'google-github-actions/auth@v2'
with:
credentials_json: '${{ secrets.GAR_JSON_KEY }}'
- name: 'Set up Cloud SDK'
uses: 'google-github-actions/setup-gcloud@v2'
- name: 'Display information about the current gcloud environment'
run: 'gcloud info'
- name: Check if Cloud Run service exists
id: check_service
run: |
SERVICE_NAME=${{ env.GITHUB_REPOSITORY_NAME_PART_SLUG }}-${{ env.GITHUB_HEAD_REF_SLUG || env.GITHUB_REF_SLUG }}
if gcloud run services describe $SERVICE_NAME --region=${{ vars.GCP_REGION }} > /dev/null 2>&1; then
echo "service_exists=true" >> $GITHUB_ENV
else
echo "service_exists=false" >> $GITHUB_ENV
fi
- name: 'Delete service'
if: env.service_exists == 'true'
run: gcloud run services delete ${{ env.GITHUB_REPOSITORY_NAME_PART_SLUG }}-${{ env.GITHUB_HEAD_REF_SLUG || env.GITHUB_REF_SLUG }} --region=${{ vars.GCP_REGION }} --quiet