From 6eeadfd2768c5f5a77cf016ac1f31cd6cd6ba7c3 Mon Sep 17 00:00:00 2001 From: Peter Dave Hello Date: Fri, 16 Jan 2026 04:00:00 +0800 Subject: [PATCH] fix: prevent automation from producing broken PRs - Preserve existing YARN_VERSION when running update.sh with -s flag instead of leaving template placeholder (0.0.0) in Dockerfiles - Change build-automation.mjs to skip versions without musl builds instead of exiting early, preventing partial updates - Add condition to workflow to skip PR creation when no versions were updated, preventing empty PR titles Fixes issues seen in PRs #2341, #2347, #2350 where automation produced Dockerfiles with YARN_VERSION=0.0.0 and/or empty PR titles. Co-Authored-By: Claude Opus 4.5 --- .github/workflows/automatic-updates.yml | 1 + build-automation.mjs | 9 +++++++-- update.sh | 6 ++++++ 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/.github/workflows/automatic-updates.yml b/.github/workflows/automatic-updates.yml index 85334f63ed..6ca77a946c 100644 --- a/.github/workflows/automatic-updates.yml +++ b/.github/workflows/automatic-updates.yml @@ -25,6 +25,7 @@ jobs: - name: Create update PR id: cpr + if: steps.updt.outputs.result != '' uses: peter-evans/create-pull-request@98357b18bf14b5342f975ff684046ec3b2a07725 # v8.0.0 with: token: ${{ secrets.GH_API_TOKEN }} diff --git a/build-automation.mjs b/build-automation.mjs index ba296d1ed4..3d1eb5592c 100644 --- a/build-automation.mjs +++ b/build-automation.mjs @@ -93,10 +93,15 @@ export default async function(github) { console.log(stdout); updatedVersions.push(newVersion.fullVersion); } else { - console.log(`There's no musl build for version ${newVersion.fullVersion} yet.`); - process.exit(0); + console.log(`Skipping version ${newVersion.fullVersion} - no musl build available yet.`); } } + + if (updatedVersions.length === 0) { + console.log("No versions with musl builds were updated."); + process.exit(0); + } + const { stdout } = (await exec(`git diff`)); console.log(stdout); diff --git a/update.sh b/update.sh index c30b6b3088..c0d715353f 100755 --- a/update.sh +++ b/update.sh @@ -170,6 +170,12 @@ function update_node_version() { else if [ "${SKIP}" != true ]; then sed -Ei -e 's/^(ENV YARN_VERSION)=.*/\1='"${yarnVersion}"'/' "${dockerfile}-tmp" + else + # Preserve existing YARN_VERSION from current Dockerfile when SKIP=true + existingYarnVersion=$(sed -n 's/^ENV YARN_VERSION=//p' "${dockerfile}") + if [ -n "${existingYarnVersion}" ]; then + sed -Ei -e 's/^(ENV YARN_VERSION)=.*/\1='"${existingYarnVersion}"'/' "${dockerfile}-tmp" + fi fi echo "${dockerfile} updated!" fi