Skip to content

Commit

Permalink
chore: periodic azure clean (#6666)
Browse files Browse the repository at this point in the history
## Checklist
fixes: #6650

- [ ] Title matches [Winglang's style guide](https://www.winglang.io/contributing/start-here/pull_requests#how-are-pull-request-titles-formatted)
- [ ] Description explains motivation and solution
- [ ] Tests added (always)
- [ ] Docs updated (only required for features)
- [ ] Added `pr/e2e-full` label if this feature requires end-to-end testing

*By submitting this pull request, I confirm that my contribution is made under the terms of the [Wing Cloud Contribution License](https://github.com/winglang/wing/blob/main/CONTRIBUTION_LICENSE.md)*.
  • Loading branch information
tsuf239 authored Jun 11, 2024
1 parent 2618442 commit 183c164
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions .github/workflows/periodic-azure-clean.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Periodic Azure cleanup

on:
schedule:
- cron: "0 0 * * 1" # Every Saturday at midnight UTC, I assume the main build won't be triggered right before this one
workflow_dispatch: {}

env:
MANUAL: ${{ github.event_name == 'workflow_dispatch' }}

jobs:
azure-cleanup:
runs-on: ubuntu-latest
steps:
- name: test if is maintainer
uses: tspascoal/get-user-teams-membership@v3
id: testUserGroup
if: ${{ env.MANUAL == 'true' }}
with:
username: ${{ github.actor }}
team: "maintainers"
GITHUB_TOKEN: ${{ secrets.GH_GROUPS_READ_TOKEN }}
- name: cancel run if not allowed
if: ${{ env.MANUAL == 'true' && steps.testUserGroup.outputs.isTeamMember == 'false' }}
run: |
echo "User ${{github.actor}} is not allowed to dispatch this action."
exit 1
- name: Configure azure credentials
uses: azure/login@v2
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}
- name: Remove all resources
run: |
for rg in $(az group list --query "[].name" -o tsv); do
az group delete --name $rg --yes --no-wait
done

0 comments on commit 183c164

Please sign in to comment.