-
Notifications
You must be signed in to change notification settings - Fork 0
55 lines (45 loc) · 1.22 KB
/
acr-housekeeping.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
name: acr-housekeeping
on:
schedule:
- cron: '0 1 * * *'
workflow_dispatch:
permissions: {}
env:
FORCE_COLOR: 3
TERM: xterm
jobs:
purge:
name: 'purge-${{ matrix.repository }}'
runs-on: ubuntu-latest
environment:
name: azure
permissions:
id-token: write
strategy:
fail-fast: false
max-parallel: 2
matrix:
repository:
- adventofcode
- alexa-london-travel-site
- api
- applepayjssample
- costellobot
- dependabot-helper
- home
- signinwithapplesample
- website
steps:
- name: Azure log in
uses: azure/login@a65d910e8af852a8061c627c456678983e180302 # v2.2.0
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
- name: Purge old images
shell: pwsh
env:
REPOSITORY: '${{ github.repository_owner }}/${{ matrix.repository }}'
run: |
$purgeCommand = "acr purge --filter '${env:REPOSITORY}:.*' --ago 1d --keep 2 --untagged"
az acr run --cmd $purgeCommand --registry ${env:GITHUB_REPOSITORY_OWNER} /dev/null