build(deps): bump google-github-actions/deploy-cloudrun from 2.6.0 to 2.7.1 #49
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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/github-slug-action@v4.5.0 | |
- 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 |