From 92b03cb91f6f3e3d85a45b4f355c38c0ab1ed415 Mon Sep 17 00:00:00 2001 From: "trop[bot]" <37223003+trop[bot]@users.noreply.github.com> Date: Tue, 1 Apr 2025 18:31:54 -0400 Subject: [PATCH] build: make it clearer when cookie auth runs (#46422) Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com> Co-authored-by: Shelley Vohr --- .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'