MOEN-46303: Robust CHANGELOG anchoring + PR body improvements for dependency-update automation - #131
Merged
Conversation
…endency-update automation Refactor both dependency-update scripts to anchor on the explicit "# Release Date" unreleased marker instead of trying to detect where released content starts via a strict dated-entry regex. The prior approach failed on trailing whitespace and other date-format quirks (root cause of PR #129). - update-ios-deps.main.kts: rewrite appendIosChangelogEntries; add artifact-level duplicate protection so re-runs update bullets in place instead of duplicating; emit .bump-summary.txt. - update-bom.main.kts: same anchoring refactor for updateChangelog; prepend a fresh unreleased section when missing (this was absent — the reason PR #128 polluted every released Android section); emit .bump-summary.txt. - update_dependency.yml: switch branch name to patch/<TICKET>/... to match repo convention; pre-flight branch-collision check with a clear error message; include the bumps summary in the PR body under a ## Bumps section. Verified locally with 21 dry-run assertions across 7 scenarios (pathological CHANGELOG shapes, byte-exact format preservation, duplicate re-run, workflow YAML validity).
|
🚪 Hodor is reviewing this PR... 👀 |
umangmoe
approved these changes
Jul 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Jira Ticket
MOEN-46303
Description
Summary
Fixes root cause of the CHANGELOG-pollution bug that was patched manually in PR #129, plus a few small improvements found during review.
Motivation
PR #128 (the first real production run of the automation) produced a diff that placed dependency bump entries inside released sections of several CHANGELOGs — for personalize on the iOS side, and for all 5 modules on the Android side. PR #129 manually moved those entries into unreleased sections, but the root causes in the scripts remained. This PR fixes those root causes.
What changed
1. Robust CHANGELOG anchoring (bug fix)
The scripts previously tried to detect where released content starts via
Regex("^# \\d{2}-\\d{2}-\\d{4}$"). That strict regex fails on trailing whitespace (the actual PR #128 trigger — the personalize CHANGELOG had# 11-06-2026with a trailing space) and any other date-format variation. When the regex fails, both scripts fall through and insert new entries into the most recent released section.Fix: Anchor on the explicit
# Release Dateunreleased marker instead. If present, append into it; if absent, prepend a fresh unreleased section. Applied to bothupdate-ios-deps.main.ktsandupdate-bom.main.kts. The Android script never had the "prepend when missing" behavior at all — that's why PR #128 polluted every released Android section.2.
patch/branch prefixWorkflow-generated branches now follow the repo convention:
${TICKET}/dependency_updatepatch/${TICKET}/dependency_update3. Pre-flight branch collision check
Before running the scripts, the workflow checks whether the target branch already exists on remote. If yes, it fails fast with a clear message: "Branch already exists. Use a fresh ticket, or delete the existing branch first." Enforces the "one ticket = one PR" invariant explicitly.
4. Duplicate-line protection
If a subsequent run bumps the same artifact to a newer version (e.g.
MoEngagePluginBase 6.10.0 → 6.10.1after a previous run left6.10.0in the CHANGELOG), the existing bullet is updated in place instead of creating a duplicate.5. Descriptive PR body
Both scripts now emit
.github/scripts/.bump-summary.txtper-run. The workflow includes it in the PR body under a## Bumpssection, so reviewers see the actual version changes without opening the diff.Files changed
.github/scripts/update-ios-deps.main.kts— refactorappendIosChangelogEntries; artifact-level duplicate protection; emit bump summary.github/scripts/update-bom.main.kts— refactorupdateChangelogwith same anchoring pattern; prepend fresh unreleased section when missing; emit bump summary.github/workflows/update_dependency.yml—patch/prefix; pre-flight collision check; PR body enhancementTesting
21 dry-run assertions across 7 scenarios pass locally (kotlin 2.3.21, matching CI):
# 11-06-2026(trailing space)# Release Dateunreleased section# Release Datemarker; bump lands in unreleased- Androidheading with pre-existing manual bullets.bump-summary.txtemissionpatch/prefix, pre-flight check, bumps sectionBehavior when
# Release Datesection already existsThe refactored anchoring works as follows:
# Release Date→ append into the existing unreleased section. Finds or creates the- iOS/- Androidheading within it; respects existing manual bullets; updates in place if the same artifact was bumped previously.# Release Date / ## Release Version / - <Platform>section. Existing released content is never touched.Suggested smoke test before merge
Trigger the workflow on this PR branch (Actions → Update Dependency → Run workflow → select
patch/MOEN-46303/dep-automation-fix) with a test ticket andtarget=ios. Expected: all pods SKIP (already latest), no diff, no PR created, workflow green. This validates the wiring in real CI without side-effects.