mirror of
https://github.com/gravitl/netmaker.git
synced 2025-09-10 23:24:32 +08:00
delete droplets on completion of tests
This commit is contained in:
parent
f602eb1a79
commit
0feb1b958a
1 changed files with 38 additions and 0 deletions
38
.github/workflows/deletedroplets.yml
vendored
Normal file
38
.github/workflows/deletedroplets.yml
vendored
Normal file
|
@ -0,0 +1,38 @@
|
|||
name: Delete Droplets
|
||||
|
||||
on:
|
||||
workflows_run:
|
||||
workflows: [Run All Test on Branch]
|
||||
types:
|
||||
- completed
|
||||
|
||||
jobs:
|
||||
on-success:
|
||||
runs-on: ubuntu-latest
|
||||
if: ${{ github.event.workflow_run.conclusion == 'success' }}
|
||||
steps:
|
||||
- name: delete droplets
|
||||
run: |
|
||||
sleep 15m
|
||||
curl -X GET \
|
||||
-H "Content-Type: application/json" \
|
||||
-H "Authorization: Bearer $DIGITALOCEAN_TOKEN" \
|
||||
"https://api.digitalocean.com/v2/droplets?tag_name=$TAG"
|
||||
env:
|
||||
DIGITALOCEAN_TOKEN: ${{ secrets.DIGITALOCEAN_TOKEN }}
|
||||
TAG: ${{ github.event.workflow_run.run_id }}-${{ github.event.workflow_run.run_attempt }}
|
||||
|
||||
on-failure:
|
||||
runs-on: ubuntu-latest
|
||||
if: ${{ github.event.workflow_run.conclusion == 'failure' }}
|
||||
steps:
|
||||
- name: delete droplets
|
||||
run: |
|
||||
sleep 6h
|
||||
curl -X GET \
|
||||
-H "Content-Type: application/json" \
|
||||
-H "Authorization: Bearer $DIGITALOCEAN_TOKEN" \
|
||||
"https://api.digitalocean.com/v2/droplets?tag_name=$TAG"
|
||||
env:
|
||||
DIGITALOCEAN_TOKEN: ${{ secrets.DIGITALOCEAN_TOKEN }}
|
||||
TAG: ${{ github.event.workflow_run.run_id }}-${{ github.event.workflow_run.run_attempt }}
|
Loading…
Add table
Reference in a new issue