fix(ci): do not delete instances from `main` branch on merge (#4206)
* fix(ci): do not delete instances from `main` branch on merge * fix(ci): do not delete instances on merge This was creating an unintended behavior, and so far instances are being cleaned up in its corresponding workflow.
This commit is contained in:
parent
4f92df42b0
commit
46642eb487
|
@ -1,42 +0,0 @@
|
|||
name: Clean
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
types: [closed]
|
||||
|
||||
env:
|
||||
NETWORK: Mainnet
|
||||
PROJECT_ID: zealous-zebra
|
||||
REGION: us-central1
|
||||
ZONE: us-central1-a
|
||||
|
||||
jobs:
|
||||
delete:
|
||||
name: Delete test deployments
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: 'read'
|
||||
id-token: 'write'
|
||||
steps:
|
||||
- name: Inject slug/short variables
|
||||
uses: rlespinasse/github-slug-action@v4
|
||||
with:
|
||||
short-length: 7
|
||||
|
||||
# Setup gcloud CLI
|
||||
- name: Authenticate to Google Cloud
|
||||
id: auth
|
||||
uses: google-github-actions/auth@v0.7.1
|
||||
with:
|
||||
workload_identity_provider: 'projects/143793276228/locations/global/workloadIdentityPools/github-actions/providers/github-oidc'
|
||||
service_account: 'github-service-account@zealous-zebra.iam.gserviceaccount.com'
|
||||
token_format: 'access_token'
|
||||
|
||||
- name: Delete test instance
|
||||
continue-on-error: true
|
||||
run: |
|
||||
TEST_INSTANCES=$(gcloud compute instances list --filter="${{ env.GITHUB_REF_SLUG_URL }}" --format='value(NAME)')
|
||||
for instance in ${TEST_INSTANCES}; do gcloud compute instances delete $instance --zone "${{ env.ZONE }}" --delete-disks all --quiet; done
|
Loading…
Reference in New Issue