From 87c5c4909b96219ab61dd21e122eceb7933a8856 Mon Sep 17 00:00:00 2001 From: Jonathan Miller <230051081+jmiller-moko@users.noreply.github.com> Date: Tue, 23 Dec 2025 14:34:26 -0600 Subject: [PATCH] Update version_branch.yml --- .github/workflows/version_branch.yml | 32 +++++++++++++++++++++++----- 1 file changed, 27 insertions(+), 5 deletions(-) diff --git a/.github/workflows/version_branch.yml b/.github/workflows/version_branch.yml index 3797344..5147dab 100644 --- a/.github/workflows/version_branch.yml +++ b/.github/workflows/version_branch.yml @@ -110,6 +110,12 @@ jobs: echo "$(date -u +%Y-%m-%dT%H:%M:%SZ) | ${step_name} | line ${line_no} | ${last_cmd}" >> "$ERROR_LOG" || true fi } + + + moko_bool() { + local v="${1:-false}" + [[ "${v}" == "true" ]] + } SH chmod 0755 "$CI_HELPERS" @@ -495,9 +501,25 @@ jobs: if [[ -f "update.xml" ]]; then echo "[INFO] update.xml present at repo root. Clearing contents because it is release generated only." chmod u+rw "update.xml" || true - : > "update.xml" - sync || true - echo "[INFO] update.xml size after truncate: $(wc -c < update.xml | tr -d ' ') bytes" + + # Robust truncation + : > "update.xml" || true + truncate -s 0 "update.xml" || true + + SIZE_BYTES="$(wc -c < update.xml | tr -d ' ')" + if [[ "${SIZE_BYTES}" != "0" ]]; then + echo "[WARN] update.xml truncate returned ${SIZE_BYTES} bytes. Forcing recreate." + rm -f "update.xml" || true + : > "update.xml" + truncate -s 0 "update.xml" || true + SIZE_BYTES="$(wc -c < update.xml | tr -d ' ')" + fi + + echo "[INFO] update.xml size after truncate: ${SIZE_BYTES} bytes" + if [[ "${SIZE_BYTES}" != "0" ]]; then + echo "[FATAL] update.xml could not be cleared to 0 bytes." >&2 + exit 2 + fi else echo "[INFO] update.xml not present. No action taken." fi @@ -575,7 +597,7 @@ jobs: - name: Commit changes id: commit - if: ${{ env.REPORT_ONLY != 'true' && env.COMMIT_CHANGES == 'true' }} }} + if: ${{ env.REPORT_ONLY != 'true' && env.COMMIT_CHANGES == 'true' }} run: | source "$CI_HELPERS" moko_init "Commit changes" @@ -595,7 +617,7 @@ jobs: echo "committed=true" >> "$GITHUB_OUTPUT" - name: Push commits - if: ${{ env.REPORT_ONLY != 'true' && env.COMMIT_CHANGES == 'true' && steps.commit.outputs.committed == 'true' }} }} + if: ${{ env.REPORT_ONLY != 'true' && env.COMMIT_CHANGES == 'true' && steps.commit.outputs.committed == 'true' }} run: | source "$CI_HELPERS" moko_init "Push commits"