From 96ca2423b681e9875db502216bf39581e5ccea1d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Julian=20Gro=C3=9F?= <julian.g@posteo.de>
Date: Tue, 30 May 2023 22:55:18 +0200
Subject: [PATCH] Clear user cache directories on self-hosted GitHub Actions

---
 .github/workflows/linux_server_build.yml | 14 ++++++++++----
 .github/workflows/master_build.yml       | 20 ++++++++++++++++----
 .github/workflows/pr_build.yml           | 14 ++++++++++----
 3 files changed, 36 insertions(+), 12 deletions(-)

diff --git a/.github/workflows/linux_server_build.yml b/.github/workflows/linux_server_build.yml
index b6be8dd418..32dee8afec 100644
--- a/.github/workflows/linux_server_build.yml
+++ b/.github/workflows/linux_server_build.yml
@@ -89,10 +89,13 @@ jobs:
     container: ${{matrix.image}}
 
     steps:
-    - name: Clear Working Directory
+    - name: Clear Working Directories
       if: contains(matrix.runner, 'linux_aarch64')
       shell: bash
-      run: rm -rf ./*
+      run: |
+        rm -rf ./*
+        rm -rf ~/overte-files
+        rm -rf ~/.cache
 
     - name: Configure Build Environment 1
       shell: bash
@@ -273,7 +276,10 @@ jobs:
         AWS_SECRET_ACCESS_KEY: ${{ secrets.s3_secret_access_key }}
       run: python3 $GITHUB_WORKSPACE/tools/ci-scripts/upload.py
 
-    - name: Clear Working Directory
+    - name: Clear Working Directories
       if: contains(matrix.runner, 'linux_aarch64')
       shell: bash
-      run: rm -rf ./*
+      run: |
+        rm -rf ./*
+        rm -rf ~/overte-files
+        rm -rf ~/.cache
diff --git a/.github/workflows/master_build.yml b/.github/workflows/master_build.yml
index 5203f62797..022806c3fa 100644
--- a/.github/workflows/master_build.yml
+++ b/.github/workflows/master_build.yml
@@ -109,11 +109,15 @@ jobs:
           echo "CLIENT_ONLY=TRUE" >> $GITHUB_ENV
           echo "INSTALLER=Overte-Interface-master$BUILD_NUMBER-${{ steps.buildenv1.outputs.github_sha_short }}.$INSTALLER_EXT" >> $GITHUB_ENV
         fi
-    - name: Clear working directory
-      if: startsWith(matrix.os, 'windows')
+
+    - name: Clear Working Directories
+      if: contains(matrix.runner, 'linux_aarch64')
       shell: bash
-      working-directory: ${{runner.workspace}}
-      run: rm -rf ./*
+      run: |
+        rm -rf ./*
+        rm -rf ~/overte-files
+        rm -rf ~/.cache
+
     - uses: actions/checkout@v1
       with:
         submodules: false
@@ -273,3 +277,11 @@ jobs:
     #  with:
     #    name: symbols
     #    path: ${{runner.workspace}}/${{ steps.buildenv1.outputs.symbols_archive }}
+
+    - name: Clear Working Directories
+      if: contains(matrix.runner, 'linux_aarch64')
+      shell: bash
+      run: |
+        rm -rf ./*
+        rm -rf ~/overte-files
+        rm -rf ~/.cache
diff --git a/.github/workflows/pr_build.yml b/.github/workflows/pr_build.yml
index b44a7d201c..d7f3953034 100644
--- a/.github/workflows/pr_build.yml
+++ b/.github/workflows/pr_build.yml
@@ -155,10 +155,13 @@ jobs:
           echo "INSTALLER=Overte-Interface-$RELEASE_NUMBER-${GIT_COMMIT_SHORT}.$INSTALLER_EXT" >> $GITHUB_ENV
         fi
 
-    - name: Clear Working Directory
+    - name: Clear Working Directories
       if: contains(matrix.runner, 'linux_aarch64')
       shell: bash
-      run: rm -rf ./*
+      run: |
+        rm -rf ./*
+        rm -rf ~/overte-files
+        rm -rf ~/.cache
 
     - uses: actions/checkout@v3
       with:
@@ -336,7 +339,10 @@ jobs:
         path: ./build/${{ env.ARTIFACT_PATTERN }}
         if-no-files-found: error
 
-    - name: Clear Working Directory
+    - name: Clear Working Directories
       if: contains(matrix.runner, 'linux_aarch64')
       shell: bash
-      run: rm -rf ./*
+      run: |
+        rm -rf ./*
+        rm -rf ~/overte-files
+        rm -rf ~/.cache