-
Notifications
You must be signed in to change notification settings - Fork 1
52 lines (44 loc) · 1.47 KB
/
destroy-pr.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# Docs for the Azure Web Apps Deploy action: https://github.com/Azure/webapps-deploy
# More GitHub Actions for Azure: https://github.com/Azure/actions
name: Destroy PR
on:
pull_request:
types: [closed]
branches: master
env:
AZURE_WEBAPP_NAME: gccollab-dev-pr-${{ github.event.number }}
ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }}
SECRET_NAME: PR_${{ github.event.number }}
jobs:
azure:
name: Delete Azure Resources
runs-on: ubuntu-latest
steps:
- uses: azure/login@v1
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}
- name: Delete Resources
uses: azure/CLI@v1
with:
azcliversion: 2.30.0
inlineScript: az group delete --name ${{ env.AZURE_WEBAPP_NAME }}
secret:
name: Delete GitHub Secret
runs-on: ubuntu-latest
steps:
- name: GitHub Auth Login
shell: bash
run: gh auth login --with-token <<< ${{ env.ACCESS_TOKEN }}
- uses: actions/checkout@master
- name: Delete Secret
run: gh secret delete "${{ env.SECRET_NAME }}"
environment:
name: Delete GitHub Environment
runs-on: ubuntu-latest
steps:
- name: Delete Environment
shell: bash
run: |
curl -X DELETE "https://api.github.com/repos/gctools-outilsgc/gccollab-frontend/environments" \
-H "Authorization: token ${{ env.ACCESS_TOKEN }}" \
-H "Accept: application/vnd.github.v3+json"