ci: fix pr close workflow #7
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Remove Review Resources | |
on: | |
pull_request: | |
types: [closed] | |
branches: [main] | |
env: | |
RESOURCE_GROUP: rg-bds-test | |
jobs: | |
remove: | |
if: github.actor != 'dependabot[bot]' | |
runs-on: ubuntu-latest | |
name: 🗑️ Remove | |
steps: | |
- name: Azure Login | |
uses: azure/login@v2 | |
with: | |
creds: ${{ secrets.AZURE_CREDENTIALS }} | |
- name: Set PR Number | |
run: echo "PR_NUMBER=${{ github.event.pull_request.number }}" >> $GITHUB_ENV | |
- name: Remove resources from test environment | |
run: | | |
echo "Removing resources for PR #$PR_NUMBER..." | |
az resource list --resource-group $RESOURCE_GROUP --query "[].id" --output tsv | | |
xargs -I {} az resource delete --ids {} --subscription ${{ secrets.AZURE_SUBSCRIPTION }} |