Skip to content

Commit 6eeadfd

Browse files
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 <noreply@anthropic.com>
1 parent 4b9a941 commit 6eeadfd

File tree

3 files changed

+14
-2
lines changed

3 files changed

+14
-2
lines changed

.github/workflows/automatic-updates.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ jobs:
2525
2626
- name: Create update PR
2727
id: cpr
28+
if: steps.updt.outputs.result != ''
2829
uses: peter-evans/create-pull-request@98357b18bf14b5342f975ff684046ec3b2a07725 # v8.0.0
2930
with:
3031
token: ${{ secrets.GH_API_TOKEN }}

build-automation.mjs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,15 @@ export default async function(github) {
9393
console.log(stdout);
9494
updatedVersions.push(newVersion.fullVersion);
9595
} else {
96-
console.log(`There's no musl build for version ${newVersion.fullVersion} yet.`);
97-
process.exit(0);
96+
console.log(`Skipping version ${newVersion.fullVersion} - no musl build available yet.`);
9897
}
9998
}
99+
100+
if (updatedVersions.length === 0) {
101+
console.log("No versions with musl builds were updated.");
102+
process.exit(0);
103+
}
104+
100105
const { stdout } = (await exec(`git diff`));
101106
console.log(stdout);
102107

update.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,12 @@ function update_node_version() {
170170
else
171171
if [ "${SKIP}" != true ]; then
172172
sed -Ei -e 's/^(ENV YARN_VERSION)=.*/\1='"${yarnVersion}"'/' "${dockerfile}-tmp"
173+
else
174+
# Preserve existing YARN_VERSION from current Dockerfile when SKIP=true
175+
existingYarnVersion=$(sed -n 's/^ENV YARN_VERSION=//p' "${dockerfile}")
176+
if [ -n "${existingYarnVersion}" ]; then
177+
sed -Ei -e 's/^(ENV YARN_VERSION)=.*/\1='"${existingYarnVersion}"'/' "${dockerfile}-tmp"
178+
fi
173179
fi
174180
echo "${dockerfile} updated!"
175181
fi

0 commit comments

Comments
 (0)