mirror of
https://github.com/gravitl/netmaker.git
synced 2024-11-11 01:54:34 +08:00
38 lines
1.2 KiB
YAML
38 lines
1.2 KiB
YAML
name: Delete Droplets
|
|
|
|
on:
|
|
workflow_run:
|
|
workflows: [Deploy and Test 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 }}
|