-
Notifications
You must be signed in to change notification settings - Fork 0
38 lines (34 loc) · 1.04 KB
/
delete_old_images.yml
File metadata and controls
38 lines (34 loc) · 1.04 KB
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
name: "Delete old images"
# Controls when the action will run - in this case triggered manually and on schedule
on:
workflow_dispatch:
schedule:
- cron: "0 1 * * 6"
push:
branches: [main]
jobs:
delete-old-pushed-images:
runs-on: ubuntu-22.04
permissions:
contents: read
packages: write
attestations: write
id-token: write
steps:
- name: Checkout local code
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
with:
ref: ${{ env.BRANCH_NAME }}
fetch-depth: 0
- name: delete unused images
shell: bash
run: |
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
.github/scripts/delete_unused_images.sh --delete-pr
elif [[ "${{ github.event_name }}" == "schedule" ]]; then
.github/scripts/delete_unused_images.sh --delete-ci --delete-untagged
else
.github/scripts/delete_unused_images.sh
fi
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}