-
Notifications
You must be signed in to change notification settings - Fork 0
32 lines (27 loc) · 987 Bytes
/
gcr-cleanup.yaml
File metadata and controls
32 lines (27 loc) · 987 Bytes
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
name: Auto delete old images from GCR
on:
schedule:
- cron: '0 0 */1 * *' # runs daily
workflow_dispatch: # allows for manual invocation
env:
PROJECT_ID: ${{ secrets.PROJECT_ID }}
jobs:
gcr-cleaner:
runs-on: 'ubuntu-latest'
steps:
- name: Google Auth
uses: 'google-github-actions/auth@v1'
with:
credentials_json: '${{ secrets.GOOGLE_CREDENTIALS }}'
- name: Get access token from Cloud SDK
id: gcloud_access_token
run: |
access_token=$(gcloud auth application-default print-access-token --project ${{ env.PROJECT_ID }})
echo "::add-mask::$access_token"
echo "::set-output name=access_token::$access_token"
- uses: 'docker://us-docker.pkg.dev/gcr-cleaner/gcr-cleaner/gcr-cleaner-cli'
with:
args: >-
-repo=gcr.io/${{ env.PROJECT_ID }}/eoapi-risk-ingest
-token=${{ steps.gcloud_access_token.outputs.access_token }}
-keep=3