From c02e5bc72c9beb79bcd5a8c9c30c739d2e6405a8 Mon Sep 17 00:00:00 2001 From: Shelley Vohr Date: Tue, 1 Apr 2025 19:44:51 +0200 Subject: [PATCH] build: make it clearer when cookie auth runs (#46406) --- .github/actions/set-chromium-cookie/action.yml | 14 ++++++++++++-- .github/workflows/linux-publish.yml | 1 + .github/workflows/macos-publish.yml | 1 + .github/workflows/windows-publish.yml | 1 + 4 files changed, 15 insertions(+), 2 deletions(-) diff --git a/.github/actions/set-chromium-cookie/action.yml b/.github/actions/set-chromium-cookie/action.yml index 4c37d14b7c7f..2011655e29b5 100644 --- a/.github/actions/set-chromium-cookie/action.yml +++ b/.github/actions/set-chromium-cookie/action.yml @@ -4,9 +4,14 @@ runs: using: "composite" steps: - name: Set the git cookie from chromium.googlesource.com (Unix) - if: ${{ runner.os != 'Windows' && env.CHROMIUM_GIT_COOKIE }} + if: ${{ runner.os != 'Windows' }} shell: bash run: | + if [[ -z "${{ env.CHROMIUM_GIT_COOKIE }}" ]]; then + echo "CHROMIUM_GIT_COOKIE is not set - cannot authenticate." + exit 0 + fi + eval 'set +o history' 2>/dev/null || setopt HIST_IGNORE_SPACE 2>/dev/null touch ~/.gitcookies chmod 0600 ~/.gitcookies @@ -28,9 +33,14 @@ runs: echo $RESPONSE fi - name: Set the git cookie from chromium.googlesource.com (Windows) - if: ${{ runner.os == 'Windows' && env.CHROMIUM_GIT_COOKIE_WINDOWS_STRING }} + if: ${{ runner.os == 'Windows' }} shell: cmd run: | + if "%CHROMIUM_GIT_COOKIE_WINDOWS_STRING%"=="" ( + echo CHROMIUM_GIT_COOKIE_WINDOWS_STRING is not set - cannot authenticate. + exit /b 0 + ) + git config --global http.cookiefile "%USERPROFILE%\.gitcookies" powershell -noprofile -nologo -command Write-Output "${{ env.CHROMIUM_GIT_COOKIE_WINDOWS_STRING }}" >>"%USERPROFILE%\.gitcookies" diff --git a/.github/workflows/linux-publish.yml b/.github/workflows/linux-publish.yml index 9443d54f324e..0d5a2a234952 100644 --- a/.github/workflows/linux-publish.yml +++ b/.github/workflows/linux-publish.yml @@ -27,6 +27,7 @@ jobs: - /mnt/cross-instance-cache:/mnt/cross-instance-cache - /var/run/sas:/var/run/sas env: + CHROMIUM_GIT_COOKIE: ${{ secrets.CHROMIUM_GIT_COOKIE }} GCLIENT_EXTRA_ARGS: '--custom-var=checkout_arm=True --custom-var=checkout_arm64=True' steps: - name: Checkout Electron diff --git a/.github/workflows/macos-publish.yml b/.github/workflows/macos-publish.yml index d20b2d8d94a0..1620305893df 100644 --- a/.github/workflows/macos-publish.yml +++ b/.github/workflows/macos-publish.yml @@ -28,6 +28,7 @@ jobs: - /mnt/cross-instance-cache:/mnt/cross-instance-cache - /var/run/sas:/var/run/sas env: + CHROMIUM_GIT_COOKIE: ${{ secrets.CHROMIUM_GIT_COOKIE }} GCLIENT_EXTRA_ARGS: '--custom-var=checkout_mac=True --custom-var=host_os=mac' steps: - name: Checkout Electron diff --git a/.github/workflows/windows-publish.yml b/.github/workflows/windows-publish.yml index 3b0f0ad3e5e9..d4fd36139fd7 100644 --- a/.github/workflows/windows-publish.yml +++ b/.github/workflows/windows-publish.yml @@ -28,6 +28,7 @@ jobs: - /mnt/win-cache:/mnt/win-cache - /var/run/sas:/var/run/sas env: + CHROMIUM_GIT_COOKIE_WINDOWS_STRING: ${{ secrets.CHROMIUM_GIT_COOKIE_WINDOWS_STRING }} GCLIENT_EXTRA_ARGS: '--custom-var=checkout_win=True' TARGET_OS: 'win' ELECTRON_DEPOT_TOOLS_WIN_TOOLCHAIN: '1'