Skip to content

Feat/location form

Feat/location form #64

Workflow file for this run

# This action will cleanup the azure resources, github secret, and github environment created for the PR once it's closed.
name: Destroy PR
on:
pull_request:
types: [closed]
branches: main
env:
AZURE_WEBAPP_NAME: gccollab-dev-pr-${{ github.event.number }}
ACCESS_TOKEN: ${{ secrets.BOT_ACCESS_TOKEN }}
SECRET_NAME: PR_${{ github.event.number }}
jobs:
azure:
name: Delete Azure Resources
runs-on: ubuntu-latest
if: ${{ !contains(github.event.pull_request.title, vars.IGNORE_DEPLOY) }}
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 }} --yes
secret:
name: Delete GitHub Secret
runs-on: ubuntu-latest
if: ${{ !contains(github.event.pull_request.title, vars.IGNORE_DEPLOY) }}
steps:
- name: GitHub Auth Login
shell: bash
run: gh auth login --with-token <<< ${{ env.ACCESS_TOKEN }}
- uses: actions/checkout@v3
- name: Delete Secret
run: gh secret delete "${{ env.SECRET_NAME }}"
environment:
name: Delete GitHub Environment
runs-on: ubuntu-latest
if: ${{ !contains(github.event.pull_request.title, vars.IGNORE_DEPLOY) }}
steps:
- name: Delete Environment
shell: bash
run: |
curl -X DELETE "https://api.github.com/repos/gctools-outilsgc/gccollab-frontend/environments/PR%20${{ github.event.number }}" \
-H "Authorization: token ${{ env.ACCESS_TOKEN }}" \
-H "Accept: application/vnd.github.v3+json"