From c28dc1a8f339ba8de7cf91dfaed4065877e49efe Mon Sep 17 00:00:00 2001 From: Alan Forbes Date: Thu, 21 Nov 2024 13:31:53 +0000 Subject: [PATCH 01/38] Add cache clean w/f outline --- .github/workflows/cache_clean.yml | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 .github/workflows/cache_clean.yml diff --git a/.github/workflows/cache_clean.yml b/.github/workflows/cache_clean.yml new file mode 100644 index 000000000..bf1461032 --- /dev/null +++ b/.github/workflows/cache_clean.yml @@ -0,0 +1,27 @@ +# Cache clean workflow + +name: Cache clean + +on: + #schedule: + # # Run Mon-Fri at 7pm + # - cron: '00 19 * * 1-5' + workflow_dispatch: + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +permissions: {} + +jobs: + clean_cache: + name: Cache clean + runs-on: ubuntu-22.04 + steps: + - name: Checkout repo + uses: actions/checkout@v4.1.0 + - name: Cache clean + run: | + ls -l + which gh From 932a4e7ffc544f253e1dde8f0c2323214b892707 Mon Sep 17 00:00:00 2001 From: Alan Forbes Date: Thu, 21 Nov 2024 13:38:14 +0000 Subject: [PATCH 02/38] add pull request --- .github/workflows/cache_clean.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/cache_clean.yml b/.github/workflows/cache_clean.yml index bf1461032..1c4de7d6c 100644 --- a/.github/workflows/cache_clean.yml +++ b/.github/workflows/cache_clean.yml @@ -7,6 +7,8 @@ on: # # Run Mon-Fri at 7pm # - cron: '00 19 * * 1-5' workflow_dispatch: + pull_request: + concurrency: group: ${{ github.workflow }}-${{ github.ref }} From 866db0e6e557b5064af48a70cd5eb8186c211f99 Mon Sep 17 00:00:00 2001 From: Alan Forbes Date: Thu, 21 Nov 2024 14:45:42 +0000 Subject: [PATCH 03/38] first gh cache command --- .github/workflows/cache_clean.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/cache_clean.yml b/.github/workflows/cache_clean.yml index 1c4de7d6c..5acc4c7b4 100644 --- a/.github/workflows/cache_clean.yml +++ b/.github/workflows/cache_clean.yml @@ -27,3 +27,4 @@ jobs: run: | ls -l which gh + gh actions-cache -B main -L 999 --order asc --sort created-at From 3f2626044b42aba717c71aa7680222d2d968dbd2 Mon Sep 17 00:00:00 2001 From: Alan Forbes Date: Thu, 21 Nov 2024 14:51:27 +0000 Subject: [PATCH 04/38] add action install --- .github/workflows/cache_clean.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/cache_clean.yml b/.github/workflows/cache_clean.yml index 5acc4c7b4..1ba81270c 100644 --- a/.github/workflows/cache_clean.yml +++ b/.github/workflows/cache_clean.yml @@ -27,4 +27,5 @@ jobs: run: | ls -l which gh + gh extension install actions/gh-actions-cache gh actions-cache -B main -L 999 --order asc --sort created-at From 7a2bd825a4c9a9744f97e13bc93f0e60565dfed5 Mon Sep 17 00:00:00 2001 From: Alan Forbes Date: Thu, 21 Nov 2024 14:58:02 +0000 Subject: [PATCH 05/38] Add GH token --- .github/workflows/cache_clean.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/cache_clean.yml b/.github/workflows/cache_clean.yml index 1ba81270c..0f22fb411 100644 --- a/.github/workflows/cache_clean.yml +++ b/.github/workflows/cache_clean.yml @@ -24,6 +24,8 @@ jobs: - name: Checkout repo uses: actions/checkout@v4.1.0 - name: Cache clean + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | ls -l which gh From 04456265eff6c5f5ee19d80bd330ca720598a65d Mon Sep 17 00:00:00 2001 From: Alan Forbes Date: Thu, 21 Nov 2024 15:03:54 +0000 Subject: [PATCH 06/38] add subcommand help output --- .github/workflows/cache_clean.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/cache_clean.yml b/.github/workflows/cache_clean.yml index 0f22fb411..f962ad7d6 100644 --- a/.github/workflows/cache_clean.yml +++ b/.github/workflows/cache_clean.yml @@ -30,4 +30,7 @@ jobs: ls -l which gh gh extension install actions/gh-actions-cache - gh actions-cache -B main -L 999 --order asc --sort created-at + gh actions-cache --help + gh actions-cache list --help + gh actions-cache delete --help + gh actions-cache list -B main -L 100 --order asc --sort created-at From 26a26fec01846baceb7f69bf7f4017e3babe8353 Mon Sep 17 00:00:00 2001 From: Alan Forbes Date: Thu, 21 Nov 2024 17:04:32 +0000 Subject: [PATCH 07/38] add grep to find latest caches --- .github/workflows/cache_clean.yml | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/.github/workflows/cache_clean.yml b/.github/workflows/cache_clean.yml index f962ad7d6..bb0232ffa 100644 --- a/.github/workflows/cache_clean.yml +++ b/.github/workflows/cache_clean.yml @@ -19,18 +19,15 @@ permissions: {} jobs: clean_cache: name: Cache clean - runs-on: ubuntu-22.04 + runs-on: ubuntu-latest steps: - - name: Checkout repo - uses: actions/checkout@v4.1.0 - name: Cache clean env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | - ls -l - which gh gh extension install actions/gh-actions-cache gh actions-cache --help gh actions-cache list --help gh actions-cache delete --help gh actions-cache list -B main -L 100 --order asc --sort created-at + gh actions-cache list -B main -L 100 --order asc --sort created-at | egrep -m 1 "^codeql-trap-|^sccache-sccache-" From 323bab192f2d5bc02c203ff5fab5935c140b523a Mon Sep 17 00:00:00 2001 From: Alan Forbes Date: Thu, 21 Nov 2024 17:08:54 +0000 Subject: [PATCH 08/38] restore checkout --- .github/workflows/cache_clean.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/cache_clean.yml b/.github/workflows/cache_clean.yml index bb0232ffa..5f86022e8 100644 --- a/.github/workflows/cache_clean.yml +++ b/.github/workflows/cache_clean.yml @@ -21,6 +21,8 @@ jobs: name: Cache clean runs-on: ubuntu-latest steps: + - name: Checkout repo + uses: actions/checkout@v4.1.0 - name: Cache clean env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} From adf476f074432be31027b7207eb878f18b2ff971 Mon Sep 17 00:00:00 2001 From: Alan Forbes Date: Fri, 22 Nov 2024 10:43:04 +0000 Subject: [PATCH 09/38] update logic to identify cache for deletion --- .github/workflows/cache_clean.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/cache_clean.yml b/.github/workflows/cache_clean.yml index 5f86022e8..9d8f0a274 100644 --- a/.github/workflows/cache_clean.yml +++ b/.github/workflows/cache_clean.yml @@ -31,5 +31,6 @@ jobs: gh actions-cache --help gh actions-cache list --help gh actions-cache delete --help - gh actions-cache list -B main -L 100 --order asc --sort created-at - gh actions-cache list -B main -L 100 --order asc --sort created-at | egrep -m 1 "^codeql-trap-|^sccache-sccache-" + gh actions-cache list -B main -L 100 --order desc --sort created-at + #for cache_prefix in llvm-ubuntu- sccache-sccache- ; do gh actions-cache list -B main -L 100 --order desc --sort created-at | grep -E -o "^${cache_prefix}[^[:space:]]+" | sed '1d' ; done + for cache_prefix in llvm-ubuntu- codeql-trap- sccache-sccache- ; do gh actions-cache list -B main -L 100 --order desc --sort created-at | grep -E -o "^${cache_prefix}[^[:space:]]+" | sed '1d' ; done From ce0289854279136d7e4baf17734dd9afd2e348bc Mon Sep 17 00:00:00 2001 From: Alan Forbes Date: Fri, 22 Nov 2024 10:58:39 +0000 Subject: [PATCH 10/38] Add echo for cache deletions --- .github/workflows/cache_clean.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/cache_clean.yml b/.github/workflows/cache_clean.yml index 9d8f0a274..2ec19b97e 100644 --- a/.github/workflows/cache_clean.yml +++ b/.github/workflows/cache_clean.yml @@ -32,5 +32,5 @@ jobs: gh actions-cache list --help gh actions-cache delete --help gh actions-cache list -B main -L 100 --order desc --sort created-at - #for cache_prefix in llvm-ubuntu- sccache-sccache- ; do gh actions-cache list -B main -L 100 --order desc --sort created-at | grep -E -o "^${cache_prefix}[^[:space:]]+" | sed '1d' ; done - for cache_prefix in llvm-ubuntu- codeql-trap- sccache-sccache- ; do gh actions-cache list -B main -L 100 --order desc --sort created-at | grep -E -o "^${cache_prefix}[^[:space:]]+" | sed '1d' ; done + DELETE_LIST=$(for CACHE_PREFIX in llvm-ubuntu- codeql-trap- sccache-sccache- ; do gh actions-cache list -B main -L 100 --order desc --sort created-at | grep -E -o "^${CACHE_PREFIX}[^[:space:]]+" | sed '1d' ; done) + for CACHE in DELETE_LIST; do echo DELETING $CACHE ; done From b1f0b7894b0dde36347772265ec5d6987aeb4b7d Mon Sep 17 00:00:00 2001 From: Alan Forbes Date: Fri, 22 Nov 2024 11:02:34 +0000 Subject: [PATCH 11/38] Fix delete list --- .github/workflows/cache_clean.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cache_clean.yml b/.github/workflows/cache_clean.yml index 2ec19b97e..fd5433d6d 100644 --- a/.github/workflows/cache_clean.yml +++ b/.github/workflows/cache_clean.yml @@ -33,4 +33,4 @@ jobs: gh actions-cache delete --help gh actions-cache list -B main -L 100 --order desc --sort created-at DELETE_LIST=$(for CACHE_PREFIX in llvm-ubuntu- codeql-trap- sccache-sccache- ; do gh actions-cache list -B main -L 100 --order desc --sort created-at | grep -E -o "^${CACHE_PREFIX}[^[:space:]]+" | sed '1d' ; done) - for CACHE in DELETE_LIST; do echo DELETING $CACHE ; done + for CACHE in $DELETE_LIST; do echo DELETING $CACHE ; done From 19f07226d558d66672724c138ad1ef6433a7ad3f Mon Sep 17 00:00:00 2001 From: Alan Forbes Date: Fri, 22 Nov 2024 11:14:24 +0000 Subject: [PATCH 12/38] Tidy delete list --- .github/workflows/cache_clean.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/cache_clean.yml b/.github/workflows/cache_clean.yml index fd5433d6d..bfa9ceeea 100644 --- a/.github/workflows/cache_clean.yml +++ b/.github/workflows/cache_clean.yml @@ -31,6 +31,8 @@ jobs: gh actions-cache --help gh actions-cache list --help gh actions-cache delete --help - gh actions-cache list -B main -L 100 --order desc --sort created-at - DELETE_LIST=$(for CACHE_PREFIX in llvm-ubuntu- codeql-trap- sccache-sccache- ; do gh actions-cache list -B main -L 100 --order desc --sort created-at | grep -E -o "^${CACHE_PREFIX}[^[:space:]]+" | sed '1d' ; done) + gh actions-cache list -B main -L 100 --order desc --sort created-at > CACHE_LIST + cat CACHE_LIST + PREFIX_LIST="llvm-ubuntu- codeql-trap- sccache-sccache-" + DELETE_LIST=$(for CACHE_PREFIX in $PREFIX_LIST ; do grep -E -o "^${CACHE_PREFIX}[^[:space:]]+" CACHE_LIST| sed '1d' ; done) for CACHE in $DELETE_LIST; do echo DELETING $CACHE ; done From 8539f052b9734dc8265a46161e2ca2cd348c02bb Mon Sep 17 00:00:00 2001 From: Alan Forbes Date: Fri, 22 Nov 2024 12:14:58 +0000 Subject: [PATCH 13/38] Fix ordering --- .github/workflows/cache_clean.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/cache_clean.yml b/.github/workflows/cache_clean.yml index bfa9ceeea..7dff1103e 100644 --- a/.github/workflows/cache_clean.yml +++ b/.github/workflows/cache_clean.yml @@ -31,8 +31,7 @@ jobs: gh actions-cache --help gh actions-cache list --help gh actions-cache delete --help - gh actions-cache list -B main -L 100 --order desc --sort created-at > CACHE_LIST - cat CACHE_LIST + gh actions-cache list -B main -L 100 --order asc --sort created-at | tee CACHE_LIST PREFIX_LIST="llvm-ubuntu- codeql-trap- sccache-sccache-" DELETE_LIST=$(for CACHE_PREFIX in $PREFIX_LIST ; do grep -E -o "^${CACHE_PREFIX}[^[:space:]]+" CACHE_LIST| sed '1d' ; done) for CACHE in $DELETE_LIST; do echo DELETING $CACHE ; done From 84680ee747a48307bcda9c4bd28996ceb9af297c Mon Sep 17 00:00:00 2001 From: Alan Forbes Date: Fri, 22 Nov 2024 12:18:53 +0000 Subject: [PATCH 14/38] add before / after logging --- .github/workflows/cache_clean.yml | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/.github/workflows/cache_clean.yml b/.github/workflows/cache_clean.yml index 7dff1103e..2ff4eb7f1 100644 --- a/.github/workflows/cache_clean.yml +++ b/.github/workflows/cache_clean.yml @@ -28,10 +28,14 @@ jobs: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | gh extension install actions/gh-actions-cache - gh actions-cache --help - gh actions-cache list --help - gh actions-cache delete --help + #gh actions-cache --help + #gh actions-cache list --help + #gh actions-cache delete --help + echo BEFORE gh actions-cache list -B main -L 100 --order asc --sort created-at | tee CACHE_LIST PREFIX_LIST="llvm-ubuntu- codeql-trap- sccache-sccache-" DELETE_LIST=$(for CACHE_PREFIX in $PREFIX_LIST ; do grep -E -o "^${CACHE_PREFIX}[^[:space:]]+" CACHE_LIST| sed '1d' ; done) + echo DELETIONS for CACHE in $DELETE_LIST; do echo DELETING $CACHE ; done + echo AFTER + gh actions-cache list -B main -L 100 --order asc --sort created-at From fcc3c2ec33695b5af871197826379d0b43e040ed Mon Sep 17 00:00:00 2001 From: Alan Forbes Date: Fri, 22 Nov 2024 12:44:03 +0000 Subject: [PATCH 15/38] add dryrun --- .github/workflows/cache_clean.yml | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/.github/workflows/cache_clean.yml b/.github/workflows/cache_clean.yml index 2ff4eb7f1..ef27a71dc 100644 --- a/.github/workflows/cache_clean.yml +++ b/.github/workflows/cache_clean.yml @@ -7,6 +7,11 @@ on: # # Run Mon-Fri at 7pm # - cron: '00 19 * * 1-5' workflow_dispatch: + inputs: + dryrun: + required: true + type: boolean + default: false pull_request: @@ -31,11 +36,12 @@ jobs: #gh actions-cache --help #gh actions-cache list --help #gh actions-cache delete --help - echo BEFORE + echo BEFORE ... gh actions-cache list -B main -L 100 --order asc --sort created-at | tee CACHE_LIST PREFIX_LIST="llvm-ubuntu- codeql-trap- sccache-sccache-" DELETE_LIST=$(for CACHE_PREFIX in $PREFIX_LIST ; do grep -E -o "^${CACHE_PREFIX}[^[:space:]]+" CACHE_LIST| sed '1d' ; done) - echo DELETIONS + echo DELETIONS ... + echo DRYRUN ... ${{ inputs.dryrun }} for CACHE in $DELETE_LIST; do echo DELETING $CACHE ; done - echo AFTER + echo AFTER ... gh actions-cache list -B main -L 100 --order asc --sort created-at From 65e19ce735728dfcf45e112b9d6562a0c12b4fb3 Mon Sep 17 00:00:00 2001 From: Alan Forbes Date: Fri, 22 Nov 2024 12:58:01 +0000 Subject: [PATCH 16/38] add push --- .github/workflows/cache_clean.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/cache_clean.yml b/.github/workflows/cache_clean.yml index ef27a71dc..72ca6fd67 100644 --- a/.github/workflows/cache_clean.yml +++ b/.github/workflows/cache_clean.yml @@ -13,6 +13,7 @@ on: type: boolean default: false pull_request: + push: concurrency: From a6494c98074236e317085887a5621a0bc33c2d2d Mon Sep 17 00:00:00 2001 From: Alan Forbes Date: Fri, 22 Nov 2024 13:00:21 +0000 Subject: [PATCH 17/38] remove push --- .github/workflows/cache_clean.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/cache_clean.yml b/.github/workflows/cache_clean.yml index 72ca6fd67..ef27a71dc 100644 --- a/.github/workflows/cache_clean.yml +++ b/.github/workflows/cache_clean.yml @@ -13,7 +13,6 @@ on: type: boolean default: false pull_request: - push: concurrency: From efe62ebccf24b872d7acf6dd6b2be3e6fe5bec08 Mon Sep 17 00:00:00 2001 From: Alan Forbes Date: Fri, 22 Nov 2024 13:04:45 +0000 Subject: [PATCH 18/38] add input to pr run --- .github/workflows/cache_clean.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/cache_clean.yml b/.github/workflows/cache_clean.yml index ef27a71dc..a26d8e61f 100644 --- a/.github/workflows/cache_clean.yml +++ b/.github/workflows/cache_clean.yml @@ -13,6 +13,11 @@ on: type: boolean default: false pull_request: + inputs: + dryrun: + required: true + type: boolean + default: false concurrency: From f4a1727a726434e3484955c3fecf0115b67873b1 Mon Sep 17 00:00:00 2001 From: Alan Forbes Date: Fri, 22 Nov 2024 13:13:44 +0000 Subject: [PATCH 19/38] add execution on dryrun --- .github/workflows/cache_clean.yml | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/.github/workflows/cache_clean.yml b/.github/workflows/cache_clean.yml index a26d8e61f..40fbdbdd5 100644 --- a/.github/workflows/cache_clean.yml +++ b/.github/workflows/cache_clean.yml @@ -13,12 +13,6 @@ on: type: boolean default: false pull_request: - inputs: - dryrun: - required: true - type: boolean - default: false - concurrency: group: ${{ github.workflow }}-${{ github.ref }} @@ -46,7 +40,6 @@ jobs: PREFIX_LIST="llvm-ubuntu- codeql-trap- sccache-sccache-" DELETE_LIST=$(for CACHE_PREFIX in $PREFIX_LIST ; do grep -E -o "^${CACHE_PREFIX}[^[:space:]]+" CACHE_LIST| sed '1d' ; done) echo DELETIONS ... - echo DRYRUN ... ${{ inputs.dryrun }} - for CACHE in $DELETE_LIST; do echo DELETING $CACHE ; done + for CACHE in $DELETE_LIST; do [ "${{ inputs.dryrun }}" = "true" ] && echo DELETING $CACHE || NOT DELETING CACHE; done echo AFTER ... gh actions-cache list -B main -L 100 --order asc --sort created-at From 45f8ab208912d300bc75a68b35ff19998bd3fdee Mon Sep 17 00:00:00 2001 From: Alan Forbes Date: Fri, 22 Nov 2024 13:17:10 +0000 Subject: [PATCH 20/38] fix dry run logging --- .github/workflows/cache_clean.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cache_clean.yml b/.github/workflows/cache_clean.yml index 40fbdbdd5..0b4b4825e 100644 --- a/.github/workflows/cache_clean.yml +++ b/.github/workflows/cache_clean.yml @@ -40,6 +40,6 @@ jobs: PREFIX_LIST="llvm-ubuntu- codeql-trap- sccache-sccache-" DELETE_LIST=$(for CACHE_PREFIX in $PREFIX_LIST ; do grep -E -o "^${CACHE_PREFIX}[^[:space:]]+" CACHE_LIST| sed '1d' ; done) echo DELETIONS ... - for CACHE in $DELETE_LIST; do [ "${{ inputs.dryrun }}" = "true" ] && echo DELETING $CACHE || NOT DELETING CACHE; done + for CACHE in $DELETE_LIST; do [ "${{ inputs.dryrun }}" = "true" ] && echo DELETING $CACHE || echo \[DRY RUN\] DELETING $CACHE; done echo AFTER ... gh actions-cache list -B main -L 100 --order asc --sort created-at From 3accd0d08237a5a906fb0221dd26f8692deb6747 Mon Sep 17 00:00:00 2001 From: Alan Forbes Date: Fri, 22 Nov 2024 13:20:31 +0000 Subject: [PATCH 21/38] swap dryrun logic --- .github/workflows/cache_clean.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cache_clean.yml b/.github/workflows/cache_clean.yml index 0b4b4825e..2b26ed738 100644 --- a/.github/workflows/cache_clean.yml +++ b/.github/workflows/cache_clean.yml @@ -40,6 +40,6 @@ jobs: PREFIX_LIST="llvm-ubuntu- codeql-trap- sccache-sccache-" DELETE_LIST=$(for CACHE_PREFIX in $PREFIX_LIST ; do grep -E -o "^${CACHE_PREFIX}[^[:space:]]+" CACHE_LIST| sed '1d' ; done) echo DELETIONS ... - for CACHE in $DELETE_LIST; do [ "${{ inputs.dryrun }}" = "true" ] && echo DELETING $CACHE || echo \[DRY RUN\] DELETING $CACHE; done + for CACHE in $DELETE_LIST ; do [ "${{ inputs.dryrun }}" = "true" ] && echo \[DRY RUN\] DELETING $CACHE || echo DELETING $CACHE ; done echo AFTER ... gh actions-cache list -B main -L 100 --order asc --sort created-at From 964af78cb888baf28b309f6d09ae5b7b5239a093 Mon Sep 17 00:00:00 2001 From: Alan Forbes Date: Fri, 22 Nov 2024 14:12:38 +0000 Subject: [PATCH 22/38] update logging and schedule --- .github/workflows/cache_clean.yml | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/.github/workflows/cache_clean.yml b/.github/workflows/cache_clean.yml index 2b26ed738..762c327a2 100644 --- a/.github/workflows/cache_clean.yml +++ b/.github/workflows/cache_clean.yml @@ -4,15 +4,15 @@ name: Cache clean on: #schedule: - # # Run Mon-Fri at 7pm - # - cron: '00 19 * * 1-5' + # # Run Mon-Sun at 11pm + # - cron: '00 23 * * 1-7' workflow_dispatch: inputs: dryrun: required: true type: boolean default: false - pull_request: + pull_request: # DELETE ME concurrency: group: ${{ github.workflow }}-${{ github.ref }} @@ -31,15 +31,19 @@ jobs: env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | + # Install gh cache manager extension + # For usage, flags and examples: $ gh actions-cache [ --help | list --help | delete --help ] gh extension install actions/gh-actions-cache - #gh actions-cache --help - #gh actions-cache list --help - #gh actions-cache delete --help + # Generate current cache list for main, oldest first (note: 100 entries is gh maximum) echo BEFORE ... gh actions-cache list -B main -L 100 --order asc --sort created-at | tee CACHE_LIST + # Define cache prefixes in list for deletion PREFIX_LIST="llvm-ubuntu- codeql-trap- sccache-sccache-" + # Generate list of cache keys for deletion - retaining only the newest entry for each prefix DELETE_LIST=$(for CACHE_PREFIX in $PREFIX_LIST ; do grep -E -o "^${CACHE_PREFIX}[^[:space:]]+" CACHE_LIST| sed '1d' ; done) echo DELETIONS ... - for CACHE in $DELETE_LIST ; do [ "${{ inputs.dryrun }}" = "true" ] && echo \[DRY RUN\] DELETING $CACHE || echo DELETING $CACHE ; done + # Delete caches by keys in DELETE_LIST if not dryrun + for KEY in $DELETE_LIST ; do [ "${{ inputs.dryrun }}" = "true" ] && echo \[DRY RUN\] DELETING $KEY || echo gh actions-cache delete -B main --confirm $KEY ; done + # Generate post-clean list echo AFTER ... gh actions-cache list -B main -L 100 --order asc --sort created-at From bb68bf05a6e6f9d120edc801cb1d8e87271d7340 Mon Sep 17 00:00:00 2001 From: Alan Forbes Date: Fri, 22 Nov 2024 14:45:11 +0000 Subject: [PATCH 23/38] set perms explicitly --- .github/workflows/cache_clean.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/cache_clean.yml b/.github/workflows/cache_clean.yml index 762c327a2..f1fad0d08 100644 --- a/.github/workflows/cache_clean.yml +++ b/.github/workflows/cache_clean.yml @@ -11,19 +11,19 @@ on: dryrun: required: true type: boolean - default: false + default: true pull_request: # DELETE ME concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true -permissions: {} - jobs: clean_cache: name: Cache clean runs-on: ubuntu-latest + permissions: + metadata: read steps: - name: Checkout repo uses: actions/checkout@v4.1.0 @@ -34,15 +34,15 @@ jobs: # Install gh cache manager extension # For usage, flags and examples: $ gh actions-cache [ --help | list --help | delete --help ] gh extension install actions/gh-actions-cache - # Generate current cache list for main, oldest first (note: 100 entries is gh maximum) + # Generate current cache list for main, oldest first (note: 100 cache entries is gh maximum) echo BEFORE ... gh actions-cache list -B main -L 100 --order asc --sort created-at | tee CACHE_LIST - # Define cache prefixes in list for deletion + # Define unique cache prefixes in list for deletion PREFIX_LIST="llvm-ubuntu- codeql-trap- sccache-sccache-" - # Generate list of cache keys for deletion - retaining only the newest entry for each prefix + # Generate corresponding list of cache keys for deletion - retain only the newest entry for each prefix DELETE_LIST=$(for CACHE_PREFIX in $PREFIX_LIST ; do grep -E -o "^${CACHE_PREFIX}[^[:space:]]+" CACHE_LIST| sed '1d' ; done) echo DELETIONS ... - # Delete caches by keys in DELETE_LIST if not dryrun + # Delete caches via keys in DELETE_LIST if not dryrun for KEY in $DELETE_LIST ; do [ "${{ inputs.dryrun }}" = "true" ] && echo \[DRY RUN\] DELETING $KEY || echo gh actions-cache delete -B main --confirm $KEY ; done # Generate post-clean list echo AFTER ... From 99e8166d198b78c294d40f511e54397cf36305db Mon Sep 17 00:00:00 2001 From: Alan Forbes Date: Fri, 22 Nov 2024 14:49:39 +0000 Subject: [PATCH 24/38] set job actions perms --- .github/workflows/cache_clean.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cache_clean.yml b/.github/workflows/cache_clean.yml index f1fad0d08..58602c0f1 100644 --- a/.github/workflows/cache_clean.yml +++ b/.github/workflows/cache_clean.yml @@ -23,7 +23,7 @@ jobs: name: Cache clean runs-on: ubuntu-latest permissions: - metadata: read + actions: read steps: - name: Checkout repo uses: actions/checkout@v4.1.0 From 89782ad4996d6c481cdb68e48771cc6a590c1bf5 Mon Sep 17 00:00:00 2001 From: Alan Forbes Date: Fri, 22 Nov 2024 14:51:56 +0000 Subject: [PATCH 25/38] add test deletion using perms --- .github/workflows/cache_clean.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/cache_clean.yml b/.github/workflows/cache_clean.yml index 58602c0f1..6a5e71e8b 100644 --- a/.github/workflows/cache_clean.yml +++ b/.github/workflows/cache_clean.yml @@ -44,6 +44,7 @@ jobs: echo DELETIONS ... # Delete caches via keys in DELETE_LIST if not dryrun for KEY in $DELETE_LIST ; do [ "${{ inputs.dryrun }}" = "true" ] && echo \[DRY RUN\] DELETING $KEY || echo gh actions-cache delete -B main --confirm $KEY ; done + gh actions-cache delete -B main --confirm sccache-sccache-build-2024-11-15T19:18:58.560Z # Generate post-clean list echo AFTER ... gh actions-cache list -B main -L 100 --order asc --sort created-at From b440c282ca349568ab1d6805ac42a1237a9f665a Mon Sep 17 00:00:00 2001 From: Alan Forbes Date: Fri, 22 Nov 2024 14:56:38 +0000 Subject: [PATCH 26/38] set perms to write --- .github/workflows/cache_clean.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cache_clean.yml b/.github/workflows/cache_clean.yml index 6a5e71e8b..58981b919 100644 --- a/.github/workflows/cache_clean.yml +++ b/.github/workflows/cache_clean.yml @@ -23,7 +23,7 @@ jobs: name: Cache clean runs-on: ubuntu-latest permissions: - actions: read + actions: write steps: - name: Checkout repo uses: actions/checkout@v4.1.0 From 99ca9717dde00ffddda6429b34f6ea212f54f78b Mon Sep 17 00:00:00 2001 From: Alan Forbes Date: Fri, 22 Nov 2024 15:21:24 +0000 Subject: [PATCH 27/38] Update TODOS and add args VARS for gh commnds --- .github/workflows/cache_clean.yml | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/.github/workflows/cache_clean.yml b/.github/workflows/cache_clean.yml index 58981b919..1eed9504b 100644 --- a/.github/workflows/cache_clean.yml +++ b/.github/workflows/cache_clean.yml @@ -3,6 +3,7 @@ name: Cache clean on: +# TODO: restore schedule #schedule: # # Run Mon-Sun at 11pm # - cron: '00 23 * * 1-7' @@ -12,7 +13,8 @@ on: required: true type: boolean default: true - pull_request: # DELETE ME +# TODO: delete pull_request + pull_request: concurrency: group: ${{ github.workflow }}-${{ github.ref }} @@ -32,19 +34,23 @@ jobs: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | # Install gh cache manager extension - # For usage, flags and examples: $ gh actions-cache [ --help | list --help | delete --help ] gh extension install actions/gh-actions-cache + # ... for usage, flags and examples: $ gh actions-cache [ --help | list --help | delete --help ] + # Define args for gh cache commands + GH_LIST_ARGS="-B main -L 100 --order asc --sort created-at" + GH_DELETE_ARGS="-B main --confirm" # Generate current cache list for main, oldest first (note: 100 cache entries is gh maximum) echo BEFORE ... - gh actions-cache list -B main -L 100 --order asc --sort created-at | tee CACHE_LIST + gh actions-cache list $GH_LIST_ARGS | tee CACHE_LIST # Define unique cache prefixes in list for deletion + # TODO: set prefixes correctly PREFIX_LIST="llvm-ubuntu- codeql-trap- sccache-sccache-" # Generate corresponding list of cache keys for deletion - retain only the newest entry for each prefix DELETE_LIST=$(for CACHE_PREFIX in $PREFIX_LIST ; do grep -E -o "^${CACHE_PREFIX}[^[:space:]]+" CACHE_LIST| sed '1d' ; done) echo DELETIONS ... # Delete caches via keys in DELETE_LIST if not dryrun - for KEY in $DELETE_LIST ; do [ "${{ inputs.dryrun }}" = "true" ] && echo \[DRY RUN\] DELETING $KEY || echo gh actions-cache delete -B main --confirm $KEY ; done - gh actions-cache delete -B main --confirm sccache-sccache-build-2024-11-15T19:18:58.560Z + # TODO: remove non-dryrun echo for live use + for KEY in $DELETE_LIST ; do [ "${{ inputs.dryrun }}" = "true" ] && echo \[DRY RUN\] DELETING $KEY || echo gh actions-cache delete $GH_DELETE_ARGS $KEY ; done # Generate post-clean list echo AFTER ... - gh actions-cache list -B main -L 100 --order asc --sort created-at + gh actions-cache list $GH_LIST_ARGS From b6d02fa59807419039e6e34eb21243ef5a49a570 Mon Sep 17 00:00:00 2001 From: Alan Forbes Date: Fri, 22 Nov 2024 15:24:55 +0000 Subject: [PATCH 28/38] align commants --- .github/workflows/cache_clean.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/cache_clean.yml b/.github/workflows/cache_clean.yml index 1eed9504b..c7a96ebee 100644 --- a/.github/workflows/cache_clean.yml +++ b/.github/workflows/cache_clean.yml @@ -3,7 +3,7 @@ name: Cache clean on: -# TODO: restore schedule + # TODO restore schedule #schedule: # # Run Mon-Sun at 11pm # - cron: '00 23 * * 1-7' @@ -13,7 +13,7 @@ on: required: true type: boolean default: true -# TODO: delete pull_request + # TODO delete pull_request pull_request: concurrency: @@ -43,13 +43,13 @@ jobs: echo BEFORE ... gh actions-cache list $GH_LIST_ARGS | tee CACHE_LIST # Define unique cache prefixes in list for deletion - # TODO: set prefixes correctly + # TODO set prefixes correctly PREFIX_LIST="llvm-ubuntu- codeql-trap- sccache-sccache-" # Generate corresponding list of cache keys for deletion - retain only the newest entry for each prefix DELETE_LIST=$(for CACHE_PREFIX in $PREFIX_LIST ; do grep -E -o "^${CACHE_PREFIX}[^[:space:]]+" CACHE_LIST| sed '1d' ; done) echo DELETIONS ... # Delete caches via keys in DELETE_LIST if not dryrun - # TODO: remove non-dryrun echo for live use + # TODO remove non-dryrun echo for live use for KEY in $DELETE_LIST ; do [ "${{ inputs.dryrun }}" = "true" ] && echo \[DRY RUN\] DELETING $KEY || echo gh actions-cache delete $GH_DELETE_ARGS $KEY ; done # Generate post-clean list echo AFTER ... From 5ab5417761bea5e89740ef51ea50a926bb4d69c2 Mon Sep 17 00:00:00 2001 From: Alan Forbes Date: Fri, 22 Nov 2024 15:45:42 +0000 Subject: [PATCH 29/38] define cache prefix list --- .github/workflows/cache_clean.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/cache_clean.yml b/.github/workflows/cache_clean.yml index c7a96ebee..aea6c14f2 100644 --- a/.github/workflows/cache_clean.yml +++ b/.github/workflows/cache_clean.yml @@ -32,6 +32,9 @@ jobs: - name: Cache clean env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # Define unique cache prefixes for deletion + # TODO set prefixes correctly + CACHE_PREFIX_LIST: "llvm-ubuntu- codeql-trap- sccache-sccache-" run: | # Install gh cache manager extension gh extension install actions/gh-actions-cache @@ -42,11 +45,8 @@ jobs: # Generate current cache list for main, oldest first (note: 100 cache entries is gh maximum) echo BEFORE ... gh actions-cache list $GH_LIST_ARGS | tee CACHE_LIST - # Define unique cache prefixes in list for deletion - # TODO set prefixes correctly - PREFIX_LIST="llvm-ubuntu- codeql-trap- sccache-sccache-" - # Generate corresponding list of cache keys for deletion - retain only the newest entry for each prefix - DELETE_LIST=$(for CACHE_PREFIX in $PREFIX_LIST ; do grep -E -o "^${CACHE_PREFIX}[^[:space:]]+" CACHE_LIST| sed '1d' ; done) + # Generate corresponding list of cache keys for deletion - retain only the newest key for each prefix + DELETE_LIST=$(for CACHE_PREFIX in $CACHE_PREFIX_LIST ; do grep -E -o "^${CACHE_PREFIX}[^[:space:]]+" CACHE_LIST| sed '1d' ; done) echo DELETIONS ... # Delete caches via keys in DELETE_LIST if not dryrun # TODO remove non-dryrun echo for live use From 3e4604439ad829dfa9de7fcd43ceb483f658f465 Mon Sep 17 00:00:00 2001 From: Alan Forbes Date: Fri, 22 Nov 2024 15:58:47 +0000 Subject: [PATCH 30/38] update comments remove checkout --- .github/workflows/cache_clean.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/cache_clean.yml b/.github/workflows/cache_clean.yml index aea6c14f2..4390a0c6a 100644 --- a/.github/workflows/cache_clean.yml +++ b/.github/workflows/cache_clean.yml @@ -27,8 +27,8 @@ jobs: permissions: actions: write steps: - - name: Checkout repo - uses: actions/checkout@v4.1.0 + #- name: Checkout repo + # uses: actions/checkout@v4.1.0 - name: Cache clean env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} @@ -42,8 +42,9 @@ jobs: # Define args for gh cache commands GH_LIST_ARGS="-B main -L 100 --order asc --sort created-at" GH_DELETE_ARGS="-B main --confirm" + echo CACHE PREFIXES FOR CLEANING ... $CACHE_PREFIX_LIST # Generate current cache list for main, oldest first (note: 100 cache entries is gh maximum) - echo BEFORE ... + echo CACHE LIST BEFORE ... gh actions-cache list $GH_LIST_ARGS | tee CACHE_LIST # Generate corresponding list of cache keys for deletion - retain only the newest key for each prefix DELETE_LIST=$(for CACHE_PREFIX in $CACHE_PREFIX_LIST ; do grep -E -o "^${CACHE_PREFIX}[^[:space:]]+" CACHE_LIST| sed '1d' ; done) @@ -52,5 +53,5 @@ jobs: # TODO remove non-dryrun echo for live use for KEY in $DELETE_LIST ; do [ "${{ inputs.dryrun }}" = "true" ] && echo \[DRY RUN\] DELETING $KEY || echo gh actions-cache delete $GH_DELETE_ARGS $KEY ; done # Generate post-clean list - echo AFTER ... + echo CACHE LIST AFTER ... gh actions-cache list $GH_LIST_ARGS From a488cec54f905ee3ccbe51a43bf92d16ed8148ce Mon Sep 17 00:00:00 2001 From: Alan Forbes Date: Fri, 22 Nov 2024 16:07:09 +0000 Subject: [PATCH 31/38] add sparse checkout --- .github/workflows/cache_clean.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/cache_clean.yml b/.github/workflows/cache_clean.yml index 4390a0c6a..3ff86183d 100644 --- a/.github/workflows/cache_clean.yml +++ b/.github/workflows/cache_clean.yml @@ -27,8 +27,10 @@ jobs: permissions: actions: write steps: - #- name: Checkout repo - # uses: actions/checkout@v4.1.0 + - name: Checkout repo + uses: actions/checkout@v4.1.0 + with: + sparse-checkout: .github - name: Cache clean env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 4db6fd3b5fd29a597c202ece2b0d177356d8cd46 Mon Sep 17 00:00:00 2001 From: Alan Forbes Date: Fri, 22 Nov 2024 16:20:05 +0000 Subject: [PATCH 32/38] change asc to desc - fix order --- .github/workflows/cache_clean.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cache_clean.yml b/.github/workflows/cache_clean.yml index 3ff86183d..e7f835d59 100644 --- a/.github/workflows/cache_clean.yml +++ b/.github/workflows/cache_clean.yml @@ -42,7 +42,7 @@ jobs: gh extension install actions/gh-actions-cache # ... for usage, flags and examples: $ gh actions-cache [ --help | list --help | delete --help ] # Define args for gh cache commands - GH_LIST_ARGS="-B main -L 100 --order asc --sort created-at" + GH_LIST_ARGS="-B main -L 100 --order desc --sort created-at" GH_DELETE_ARGS="-B main --confirm" echo CACHE PREFIXES FOR CLEANING ... $CACHE_PREFIX_LIST # Generate current cache list for main, oldest first (note: 100 cache entries is gh maximum) From 2dc230aa90678d70e3bd46a0e3bab86dad2c165a Mon Sep 17 00:00:00 2001 From: Alan Forbes Date: Fri, 22 Nov 2024 16:50:38 +0000 Subject: [PATCH 33/38] set prefix list for main repo --- .github/workflows/cache_clean.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/cache_clean.yml b/.github/workflows/cache_clean.yml index e7f835d59..0157a2a90 100644 --- a/.github/workflows/cache_clean.yml +++ b/.github/workflows/cache_clean.yml @@ -35,8 +35,7 @@ jobs: env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Define unique cache prefixes for deletion - # TODO set prefixes correctly - CACHE_PREFIX_LIST: "llvm-ubuntu- codeql-trap- sccache-sccache-" + CACHE_PREFIX_LIST: "codeql-trap- sccache-sccache-" run: | # Install gh cache manager extension gh extension install actions/gh-actions-cache From b9369b0824df4a656ebf59426fa90fa76bc4de2b Mon Sep 17 00:00:00 2001 From: Alan Forbes Date: Mon, 25 Nov 2024 11:12:21 +0000 Subject: [PATCH 34/38] Tidy comments and formatting --- .github/workflows/cache_clean.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/cache_clean.yml b/.github/workflows/cache_clean.yml index 0157a2a90..ea23944b5 100644 --- a/.github/workflows/cache_clean.yml +++ b/.github/workflows/cache_clean.yml @@ -44,11 +44,11 @@ jobs: GH_LIST_ARGS="-B main -L 100 --order desc --sort created-at" GH_DELETE_ARGS="-B main --confirm" echo CACHE PREFIXES FOR CLEANING ... $CACHE_PREFIX_LIST - # Generate current cache list for main, oldest first (note: 100 cache entries is gh maximum) + # Generate current cache list for main, newest first (note: 100 cache entries is gh maximum) echo CACHE LIST BEFORE ... gh actions-cache list $GH_LIST_ARGS | tee CACHE_LIST # Generate corresponding list of cache keys for deletion - retain only the newest key for each prefix - DELETE_LIST=$(for CACHE_PREFIX in $CACHE_PREFIX_LIST ; do grep -E -o "^${CACHE_PREFIX}[^[:space:]]+" CACHE_LIST| sed '1d' ; done) + DELETE_LIST=$(for CACHE_PREFIX in $CACHE_PREFIX_LIST ; do grep -E -o "^${CACHE_PREFIX}[^[:space:]]+" CACHE_LIST | sed '1d' ; done) echo DELETIONS ... # Delete caches via keys in DELETE_LIST if not dryrun # TODO remove non-dryrun echo for live use From 90f1f72c8d597730772d949090f1d8d06cd3d269 Mon Sep 17 00:00:00 2001 From: Alan Forbes Date: Tue, 26 Nov 2024 16:46:35 +0000 Subject: [PATCH 35/38] Review updates and explicitly disable caching for CodeQL --- .github/workflows/cache_clean.yml | 16 +++++++++------- .github/workflows/codeql.yml | 2 ++ 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/.github/workflows/cache_clean.yml b/.github/workflows/cache_clean.yml index ea23944b5..d2920843a 100644 --- a/.github/workflows/cache_clean.yml +++ b/.github/workflows/cache_clean.yml @@ -3,18 +3,20 @@ name: Cache clean on: - # TODO restore schedule - #schedule: - # # Run Mon-Sun at 11pm - # - cron: '00 23 * * 1-7' + schedule: + # Run Mon-Sun at 11pm + - cron: '00 23 * * 1-7' workflow_dispatch: - inputs: + inputs: dryrun: required: true type: boolean default: true - # TODO delete pull_request pull_request: + branches: + - main + paths: + '.github/workflows/cache_clean.yml' concurrency: group: ${{ github.workflow }}-${{ github.ref }} @@ -35,7 +37,7 @@ jobs: env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Define unique cache prefixes for deletion - CACHE_PREFIX_LIST: "codeql-trap- sccache-sccache-" + CACHE_PREFIX_LIST: "sccache-sccache-" run: | # Install gh cache manager extension gh extension install actions/gh-actions-cache diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 969248aa1..002fd893d 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -50,6 +50,7 @@ jobs: with: languages: c-cpp build-mode: manual + trap-caching: false - name: build host x86_64 release uses: ./.github/actions/do_build_ock @@ -97,6 +98,7 @@ jobs: with: languages: c-cpp build-mode: manual + trap-caching: false - name: build riscv m1 uses: ./.github/actions/do_build_ock/do_build_m1 From d85dce69a751c4351b636b9c10a37a314a7404b0 Mon Sep 17 00:00:00 2001 From: Alan Forbes Date: Tue, 26 Nov 2024 16:51:47 +0000 Subject: [PATCH 36/38] Fix cron setting --- .github/workflows/cache_clean.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cache_clean.yml b/.github/workflows/cache_clean.yml index d2920843a..adae10d44 100644 --- a/.github/workflows/cache_clean.yml +++ b/.github/workflows/cache_clean.yml @@ -5,7 +5,7 @@ name: Cache clean on: schedule: # Run Mon-Sun at 11pm - - cron: '00 23 * * 1-7' + - cron: '00 23 * * 0-6' workflow_dispatch: inputs: dryrun: From 6063c58d0389623e1ea4a7f9eac16d3e681cc0ac Mon Sep 17 00:00:00 2001 From: Alan Forbes Date: Wed, 27 Nov 2024 10:26:36 +0000 Subject: [PATCH 37/38] Remove echo from deletion for "live" --- .github/workflows/cache_clean.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/cache_clean.yml b/.github/workflows/cache_clean.yml index adae10d44..bee1798c4 100644 --- a/.github/workflows/cache_clean.yml +++ b/.github/workflows/cache_clean.yml @@ -53,8 +53,7 @@ jobs: DELETE_LIST=$(for CACHE_PREFIX in $CACHE_PREFIX_LIST ; do grep -E -o "^${CACHE_PREFIX}[^[:space:]]+" CACHE_LIST | sed '1d' ; done) echo DELETIONS ... # Delete caches via keys in DELETE_LIST if not dryrun - # TODO remove non-dryrun echo for live use - for KEY in $DELETE_LIST ; do [ "${{ inputs.dryrun }}" = "true" ] && echo \[DRY RUN\] DELETING $KEY || echo gh actions-cache delete $GH_DELETE_ARGS $KEY ; done + for KEY in $DELETE_LIST ; do [ "${{ inputs.dryrun }}" = "true" ] && echo \[DRY RUN\] DELETING $KEY || gh actions-cache delete $GH_DELETE_ARGS $KEY ; done # Generate post-clean list echo CACHE LIST AFTER ... gh actions-cache list $GH_LIST_ARGS From ca8d36668ff9ef19dc8d9d1d6df884719f4ec0a3 Mon Sep 17 00:00:00 2001 From: Alan Forbes Date: Wed, 27 Nov 2024 11:47:57 +0000 Subject: [PATCH 38/38] Add conditional for repo and schedule event --- .github/workflows/cache_clean.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/cache_clean.yml b/.github/workflows/cache_clean.yml index bee1798c4..727d7e002 100644 --- a/.github/workflows/cache_clean.yml +++ b/.github/workflows/cache_clean.yml @@ -26,6 +26,7 @@ jobs: clean_cache: name: Cache clean runs-on: ubuntu-latest + if: ${{ github.repository == 'uxlfoundation/oneapi-construction-kit' || github.event_name != 'schedule' }} permissions: actions: write steps: