File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ name: 'Cleanup'
2
2
3
3
on :
4
4
schedule :
5
- - cron : ' 0 */4 * * *'
5
+ - cron : ' 0 */6 * * *'
6
6
workflow_dispatch :
7
7
8
8
permissions :
@@ -25,12 +25,14 @@ jobs:
25
25
26
26
- name : Delete services
27
27
run : |-
28
- BUFFER="$(TZ=GMT+4 date +%Y-%m-%d)"
29
-
30
28
gcloud config set core/project "${{ secrets.PROJECT_ID }}"
31
29
gcloud config set functions/region "us-central1"
32
30
33
- (IFS=$'\n'; for NAME in $(gcloud functions list --format="value(name)" --filter="updateTime.date('%Y-%m-%d', Z) < '${BUFFER}'"); do
31
+ # List and delete all functions that were deployed 30 minutes ago or
32
+ # earlier. The date math here is a little weird, but we're looking for
33
+ # deployments "earlier than" 30 minutes ago, so it's less than since
34
+ # time increases.
35
+ (IFS=$'\n'; for NAME in $(gcloud functions list --format="value(name)" --filter="updateTime < '-pt30m'"); do
34
36
echo "Deleting ${NAME}..."
35
37
gcloud functions delete ${NAME} --quiet
36
38
done)
You can’t perform that action at this time.
0 commit comments