Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save lloydjatkinson/651bbd76c5b7f3540d5a7107918a2f90 to your computer and use it in GitHub Desktop.
Save lloydjatkinson/651bbd76c5b7f3540d5a7107918a2f90 to your computer and use it in GitHub Desktop.
name: PR Closed on Development Feature Branch
on:
pull_request:
types: [closed]
branches-ignore:
- master
jobs:
delete-infrastructure:
name: Delete Infrastructure
if: github.head_ref_name != 'development'
runs-on: ubuntu-latest
env:
RESOURCE_GROUP_LOCATION: uksouth
steps:
- name: Get branch information
id: branch-name
uses: tj-actions/[email protected]
- name: Set additional environment variables
run: |
echo "RESOURCE_GROUP_NAME=rg-<your project name>-${{ steps.branch-name.outputs.current_branch }}-dev-001" >> "$GITHUB_ENV"
- name: Login to Azure
uses: azure/login@v1
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}
- name: Delete Azure resource group
uses: azure/cli@v1
with:
inlineScript: |
#!/bin/bash
az group delete --name ${{ env.RESOURCE_GROUP_NAME }} --yes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment