From d81d033b98554deb13297c80c2657ad3c5a9f771 Mon Sep 17 00:00:00 2001 From: Nigro Simone Date: Thu, 1 Oct 2026 19:20:24 +0200 Subject: [PATCH] Retry the push of the binaries when another job pushed first, in one line for PowerShell and bash --- .github/workflows/build-asan.yml | 6 +++++- .github/workflows/build.yml | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-asan.yml b/.github/workflows/build-asan.yml index d453bfb76..ea70227f0 100644 --- a/.github/workflows/build-asan.yml +++ b/.github/workflows/build-asan.yml @@ -34,4 +34,8 @@ jobs: git config --global user.email "alexhultman@gmail.com" git config --global user.name "Alex Hultman" git commit -a -m "[GitHub Actions] Updated ${{ matrix.os }} ASAN binaries" || true - git push "https://unetworkingab:${{ secrets.SECRET }}@github.com/uNetworking/uWebSockets.js" binaries-asan + # Another job can push in between: then its commit is taken and the push tried again, up to three + # times. One line, because PowerShell and bash both read && and || left to right. -X theirs keeps + # this job's version of a file both changed, like source_commit + git remote set-url --push origin "https://unetworkingab:${{ secrets.SECRET }}@github.com/uNetworking/uWebSockets.js" + git push origin binaries-asan || git pull --rebase -X theirs origin binaries-asan && git push origin binaries-asan || git pull --rebase -X theirs origin binaries-asan && git push origin binaries-asan || git pull --rebase -X theirs origin binaries-asan && git push origin binaries-asan diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 963bfe194..2703718ab 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -42,4 +42,8 @@ jobs: git config --global user.email "alexhultman@gmail.com" git config --global user.name "Alex Hultman" git commit -a -m "[GitHub Actions] Updated ${{ matrix.os }} binaries" || true - git push "https://unetworkingab:${{ secrets.SECRET }}@github.com/uNetworking/uWebSockets.js" binaries + # Another job can push in between: then its commit is taken and the push tried again, up to three + # times. One line, because PowerShell and bash both read && and || left to right. -X theirs keeps + # this job's version of a file both changed, like source_commit + git remote set-url --push origin "https://unetworkingab:${{ secrets.SECRET }}@github.com/uNetworking/uWebSockets.js" + git push origin binaries || git pull --rebase -X theirs origin binaries && git push origin binaries || git pull --rebase -X theirs origin binaries && git push origin binaries || git pull --rebase -X theirs origin binaries && git push origin binaries