Skip to content

Commit f561175

Browse files
author
naman-msft
committed
Merge branch 'main' of github.com:MicrosoftDocs/executable-docs into test_all
2 parents b801e45 + 9d11db6 commit f561175

File tree

2 files changed

+56
-2
lines changed

2 files changed

+56
-2
lines changed
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: Daily RG Cleanup
2+
3+
on:
4+
schedule:
5+
# runs every day at 11:11 UTC
6+
- cron: '11 11 * * *'
7+
workflow_dispatch:
8+
9+
permissions:
10+
contents: write
11+
id-token: write
12+
issues: write
13+
14+
jobs:
15+
cleanup:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- name: 'Az CLI login'
19+
uses: azure/login@v1
20+
with:
21+
client-id: ${{ secrets.AZURE_CLIENT_ID }}
22+
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
23+
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
24+
25+
- name: Install jq
26+
run: sudo apt-get update && sudo apt-get install -y jq
27+
28+
- name: Cleanup Resource Groups
29+
run: |
30+
echo "Fetching all resource groups in the subscription..."
31+
rgs_json=$(az group list --output json)
32+
33+
# don’t exit on errors in this block
34+
set +e
35+
36+
echo "Attempting to delete all resource groups..."
37+
echo "$rgs_json" |
38+
jq -r '.[] | .name' |
39+
while read -r rg_name; do
40+
if [[ -z "$rg_name" ]]; then
41+
echo "Skipping empty resource group name."
42+
continue
43+
fi
44+
echo -n "Deleting $rg_name… "
45+
az group delete \
46+
--name "$rg_name" \
47+
--yes \
48+
--no-wait \
49+
&& echo "OK" \
50+
|| echo "⚠️ Skipped (deny-assignment or other error)"
51+
done
52+
53+
# restore “exit on error” if you need it later
54+
set -e

.github/workflows/sync.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
name: Sync Markdown Files
22

33
on:
4-
schedule:
5-
- cron: '0 15 * * *'
4+
# schedule:
5+
# - cron: '0 15 * * *'
66
workflow_dispatch:
77

88
permissions:

0 commit comments

Comments
 (0)