File tree Expand file tree Collapse file tree 2 files changed +12
-6
lines changed Expand file tree Collapse file tree 2 files changed +12
-6
lines changed Original file line number Diff line number Diff line change 3131 set +e
3232
3333 keys=$(gh actions-cache list -L 100 -R $REPO -B $BRANCH | cut -f 1)
34+ # $keys might contain spaces. Thus we set IFS to \n.
35+ IFS=$'\n'
3436 for k in $keys
3537 do
36- gh actions-cache delete $k -R $REPO -B $BRANCH --confirm
38+ gh actions-cache delete "$k" -R $REPO -B $BRANCH --confirm
3739 done
40+ unset IFS
Original file line number Diff line number Diff line change 2727 EVENT=${{ github.event.workflow_run.event }}
2828
2929 # Triggering workflow run name (e.g., LinuxClang)
30- WORKFLOW_NAME=${{ github.event.workflow_run.name }}
30+ WORKFLOW_NAME=" ${{ github.event.workflow_run.name }}"
3131
3232 if [[ $EVENT == "pull_request" ]]; then
3333 gh run download ${{ github.event.workflow_run.id }} -n pr_number
@@ -45,16 +45,19 @@ jobs:
4545 # The goal is to keep the last used key of each job and delete all others.
4646
4747 # something like ccache-LinuxClang-
48- keyprefix=ccache-${WORKFLOW_NAME}-
48+ keyprefix=" ccache-${WORKFLOW_NAME}-"
4949
50- cached_jobs=$(gh actions-cache list -L 100 -R $REPO -B $BRANCH --key $keyprefix | awk -F '-git-' '{print $1}' | sort | uniq)
50+ cached_jobs=$(gh actions-cache list -L 100 -R $REPO -B $BRANCH --key " $keyprefix" | awk -F '-git-' '{print $1}' | sort | uniq)
5151
5252 # cached_jobs is something like "ccache-LinuxClang-configure-1d ccache-LinuxClang-configure-2d".
53+ # It might also contain spaces. Thus we set IFS to \n.
54+ IFS=$'\n'
5355 for j in $cached_jobs
5456 do
55- old_keys=$(gh actions-cache list -L 100 -R $REPO -B $BRANCH --key ${j}-git- --sort last-used | cut -f 1 | tail -n +2)
57+ old_keys=$(gh actions-cache list -L 100 -R $REPO -B $BRANCH --key " ${j}-git-" --sort last-used | cut -f 1 | tail -n +2)
5658 for k in $old_keys
5759 do
58- gh actions-cache delete $k -R $REPO -B $BRANCH --confirm
60+ gh actions-cache delete "$k" -R $REPO -B $BRANCH --confirm
5961 done
6062 done
63+ unset IFS
You can’t perform that action at this time.
0 commit comments