From 3b7b85fbe86fa0c4cbfb2e855f588b595a95609e Mon Sep 17 00:00:00 2001 From: Josh Soref <2119212+jsoref@users.noreply.github.com> Date: Sun, 3 Nov 2024 19:35:35 -0500 Subject: [PATCH] Conditionally clear runner cache This allows runners that don't have the cache to run these workflows. --- .github/workflows/__zstd-bundle-streaming.yml | 4 +++- .github/workflows/__zstd-bundle.yml | 4 +++- pr-checks/checks/zstd-bundle-streaming.yml | 4 +++- pr-checks/checks/zstd-bundle.yml | 4 +++- 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/.github/workflows/__zstd-bundle-streaming.yml b/.github/workflows/__zstd-bundle-streaming.yml index 8a143a2e8..6328bbeef 100644 --- a/.github/workflows/__zstd-bundle-streaming.yml +++ b/.github/workflows/__zstd-bundle-streaming.yml @@ -59,7 +59,9 @@ jobs: const fs = require('fs'); const path = require('path'); const codeqlPath = path.join(process.env['RUNNER_TOOL_CACHE'], 'CodeQL'); - fs.rmdirSync(codeqlPath, { recursive: true }); + if (codeqlPath !== undefined) { + fs.rmdirSync(codeqlPath, { recursive: true }); + } - id: init uses: ./../action/init with: diff --git a/.github/workflows/__zstd-bundle.yml b/.github/workflows/__zstd-bundle.yml index da8a55442..9f3036855 100644 --- a/.github/workflows/__zstd-bundle.yml +++ b/.github/workflows/__zstd-bundle.yml @@ -61,7 +61,9 @@ jobs: const fs = require('fs'); const path = require('path'); const codeqlPath = path.join(process.env['RUNNER_TOOL_CACHE'], 'CodeQL'); - fs.rmdirSync(codeqlPath, { recursive: true }); + if (codeqlPath !== undefined) { + fs.rmdirSync(codeqlPath, { recursive: true }); + } - id: init uses: ./../action/init with: diff --git a/pr-checks/checks/zstd-bundle-streaming.yml b/pr-checks/checks/zstd-bundle-streaming.yml index 40937fa14..291f8d88b 100644 --- a/pr-checks/checks/zstd-bundle-streaming.yml +++ b/pr-checks/checks/zstd-bundle-streaming.yml @@ -16,7 +16,9 @@ steps: const fs = require('fs'); const path = require('path'); const codeqlPath = path.join(process.env['RUNNER_TOOL_CACHE'], 'CodeQL'); - fs.rmdirSync(codeqlPath, { recursive: true }); + if (codeqlPath !== undefined) { + fs.rmdirSync(codeqlPath, { recursive: true }); + } - id: init uses: ./../action/init with: diff --git a/pr-checks/checks/zstd-bundle.yml b/pr-checks/checks/zstd-bundle.yml index a751b18bc..9350c39f6 100644 --- a/pr-checks/checks/zstd-bundle.yml +++ b/pr-checks/checks/zstd-bundle.yml @@ -16,7 +16,9 @@ steps: const fs = require('fs'); const path = require('path'); const codeqlPath = path.join(process.env['RUNNER_TOOL_CACHE'], 'CodeQL'); - fs.rmdirSync(codeqlPath, { recursive: true }); + if (codeqlPath !== undefined) { + fs.rmdirSync(codeqlPath, { recursive: true }); + } - id: init uses: ./../action/init with: