Skip to content

Proto ImageをOptionalに変更 #21

Proto ImageをOptionalに変更

Proto ImageをOptionalに変更 #21

name: Delete Cloud Run (PR closed)
on:
pull_request:
branches:
- main
types:
- closed
jobs:
build-and-deploy:
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
pull-requests: write
steps:
- name: Login to Google Cloud
id: auth
uses: google-github-actions/auth@v2
with:
token_format: access_token
workload_identity_provider: 'projects/218648927193/locations/global/workloadIdentityPools/default-pool/providers/provider-github'
service_account: '[email protected]'
- name: setup gcloud
uses: google-github-actions/setup-gcloud@v2
with:
version: '>= 363.0.0'
- name: Delete Cloud Run
id: delete-cloudrun-service
continue-on-error: true
run: |
gcloud run services delete frontend-stg-pr-${{ github.event.number }} --region=asia-northeast1 --quiet
- name: Delete from Artifact Registry
id: delete-artifact-registry
continue-on-error: true
run: |
gcloud artifacts docker images delete asia-northeast1-docker.pkg.dev/openhacku-team-a/staging/frontend-pr-${{ github.event.number }} --quiet
- name: Notify Failure on Pull Request
if: ${{ steps.delete-cloudrun-service.outcome != 'success' || steps.delete-artifact-registry.outcome != 'success' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh pr comment ${{ github.event.number }} -b "Failed to delete resources, CloudRun: ${{ steps.delete-cloudrun-service.outcome }}, Artifact Registry: ${{ steps.delete-artifact-registry.outcome }}"
exit 1