From c09bf1e8787490baacd4bdb5f78d9cb3b8001b07 Mon Sep 17 00:00:00 2001 From: crazywhalecc Date: Fri, 4 Oct 2024 17:19:38 +0800 Subject: [PATCH] Adjust caches --- .github/workflows/tests.yml | 2 +- src/SPC/store/CurlHook.php | 10 ++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 3a24ad76..0ed808e0 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -171,7 +171,7 @@ jobs: uses: actions/cache@v4 with: path: downloads - key: php-${{ matrix.php }}-dependencies + key: php-dependencies-${{ matrix.os }} - name: "Install Dependencies" run: composer update -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist diff --git a/src/SPC/store/CurlHook.php b/src/SPC/store/CurlHook.php index ce27cf3d..48e2b0c4 100644 --- a/src/SPC/store/CurlHook.php +++ b/src/SPC/store/CurlHook.php @@ -20,11 +20,17 @@ class CurlHook } if (getenv('GITHUB_USER')) { $auth = base64_encode(getenv('GITHUB_USER') . ':' . getenv('GITHUB_TOKEN')); - $headers[] = "Authorization: Basic {$auth}"; + $he = "Authorization: Basic {$auth}"; + if (!in_array($he, $headers)) { + $headers[] = $he; + } logger()->info("using basic github token for {$method} {$url}"); } else { $auth = getenv('GITHUB_TOKEN'); - $headers[] = "Authorization: Bearer {$auth}"; + $he = "Authorization: Bearer {$auth}"; + if (!in_array($he, $headers)) { + $headers[] = $he; + } logger()->info("using bearer github token for {$method} {$url}"); } }