build: fail for out of date patches on forks (#46124)

* build: fail for out of date patches on forks

Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>

* chore: e patches all

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
This commit is contained in:
trop[bot] 2025-03-20 09:58:12 +01:00 committed by GitHub
parent 344b0ae3ad
commit 5f48031c24
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 16 additions and 8 deletions

View file

@ -99,7 +99,7 @@ runs:
fi fi
ELECTRON_USE_THREE_WAY_MERGE_FOR_PATCHES=1 e d gclient sync --with_branch_heads --with_tags -vv ELECTRON_USE_THREE_WAY_MERGE_FOR_PATCHES=1 e d gclient sync --with_branch_heads --with_tags -vv
if [[ "${{ inputs.is-release }}" != "true" && -n "${{ env.PATCH_UP_APP_CREDS }}" ]]; then if [[ "${{ inputs.is-release }}" != "true" ]]; then
# Re-export all the patches to check if there were changes. # Re-export all the patches to check if there were changes.
python3 src/electron/script/export_all_patches.py src/electron/patches/config.json python3 src/electron/script/export_all_patches.py src/electron/patches/config.json
cd src/electron cd src/electron

View file

@ -19,10 +19,10 @@ would be removed from its snapped state when re-shown. This fixes that.
Upstreamed at https://chromium-review.googlesource.com/c/chromium/src/+/6330848. Upstreamed at https://chromium-review.googlesource.com/c/chromium/src/+/6330848.
diff --git a/ui/views/win/hwnd_message_handler.cc b/ui/views/win/hwnd_message_handler.cc diff --git a/ui/views/win/hwnd_message_handler.cc b/ui/views/win/hwnd_message_handler.cc
index 22ed43bdf4dbaccc598135807abc8383c52db50e..c5457e3e58b53ca04697b22a885da654c6c0655f 100644 index e7b2bc1905958d2ff9c34ed7a22eb53e7ea3b9b8..031f966192084b19294678b84c6962d32de61a47 100644
--- a/ui/views/win/hwnd_message_handler.cc --- a/ui/views/win/hwnd_message_handler.cc
+++ b/ui/views/win/hwnd_message_handler.cc +++ b/ui/views/win/hwnd_message_handler.cc
@@ -676,7 +676,8 @@ void HWNDMessageHandler::Show(ui::mojom::WindowShowState show_state, @@ -674,7 +674,8 @@ void HWNDMessageHandler::Show(ui::mojom::WindowShowState show_state,
SetWindowPlacement(hwnd(), &placement); SetWindowPlacement(hwnd(), &placement);
native_show_state = SW_SHOWMAXIMIZED; native_show_state = SW_SHOWMAXIMIZED;
} else { } else {
@ -32,7 +32,7 @@ index 22ed43bdf4dbaccc598135807abc8383c52db50e..c5457e3e58b53ca04697b22a885da654
// Use SW_SHOW/SW_SHOWNA instead of SW_SHOWNORMAL/SW_SHOWNOACTIVATE so that // Use SW_SHOW/SW_SHOWNA instead of SW_SHOWNORMAL/SW_SHOWNOACTIVATE so that
// the window is not restored to its original position if it is maximized. // the window is not restored to its original position if it is maximized.
@@ -686,7 +687,8 @@ void HWNDMessageHandler::Show(ui::mojom::WindowShowState show_state, @@ -684,7 +685,8 @@ void HWNDMessageHandler::Show(ui::mojom::WindowShowState show_state,
// position, some do not. See crbug.com/1296710 // position, some do not. See crbug.com/1296710
switch (show_state) { switch (show_state) {
case ui::mojom::WindowShowState::kInactive: case ui::mojom::WindowShowState::kInactive:
@ -42,7 +42,7 @@ index 22ed43bdf4dbaccc598135807abc8383c52db50e..c5457e3e58b53ca04697b22a885da654
break; break;
case ui::mojom::WindowShowState::kMaximized: case ui::mojom::WindowShowState::kMaximized:
native_show_state = SW_SHOWMAXIMIZED; native_show_state = SW_SHOWMAXIMIZED;
@@ -697,9 +699,11 @@ void HWNDMessageHandler::Show(ui::mojom::WindowShowState show_state, @@ -695,9 +697,11 @@ void HWNDMessageHandler::Show(ui::mojom::WindowShowState show_state,
case ui::mojom::WindowShowState::kNormal: case ui::mojom::WindowShowState::kNormal:
if ((GetWindowLong(hwnd(), GWL_EXSTYLE) & WS_EX_TRANSPARENT) || if ((GetWindowLong(hwnd(), GWL_EXSTYLE) & WS_EX_TRANSPARENT) ||
(GetWindowLong(hwnd(), GWL_EXSTYLE) & WS_EX_NOACTIVATE)) { (GetWindowLong(hwnd(), GWL_EXSTYLE) & WS_EX_NOACTIVATE)) {

View file

@ -2,23 +2,31 @@ const { appCredentialsFromString, getTokenForRepo } = require('@electron/github-
const cp = require('node:child_process'); const cp = require('node:child_process');
const { PATCH_UP_APP_CREDS } = process.env;
async function main () { async function main () {
if (!PATCH_UP_APP_CREDS) {
throw new Error('PATCH_UP_APP_CREDS environment variable not set');
}
const token = await getTokenForRepo( const token = await getTokenForRepo(
{ {
name: 'electron', name: 'electron',
owner: 'electron' owner: 'electron'
}, },
appCredentialsFromString(process.env.PATCH_UP_APP_CREDS) appCredentialsFromString(PATCH_UP_APP_CREDS)
); );
const remoteURL = `https://x-access-token:${token}@github.com/electron/electron.git`; const remoteURL = `https://x-access-token:${token}@github.com/electron/electron.git`;
// NEVER LOG THE OUTPUT OF THIS COMMAND // NEVER LOG THE OUTPUT OF THIS COMMAND
// GIT LEAKS THE ACCESS CREDENTIALS IN CONSOLE LOGS // GIT LEAKS THE ACCESS CREDENTIALS IN CONSOLE LOGS
const { status } = cp.spawnSync('git', ['push', '--set-upstream', remoteURL], { const { status } = cp.spawnSync('git', ['push', '--set-upstream', remoteURL], {
stdio: 'ignore' stdio: 'ignore'
}); });
if (status !== 0) { if (status !== 0) {
console.error('Failed to push to target branch'); throw new Error('Failed to push to target branch');
process.exit(1);
} }
} }