fix(apm): materialize post-merge in a separate PR, not on the Renovate branch - #202
Merged
Conversation
…e branch
The materialize workflow triggered on `pull_request` and pushed the
lockfile + deployed files back onto the triggering PR branch. For
Renovate's own apm.yml bump PRs that broke Renovate's branch ownership:
Renovate stopped rebasing/automerging them and refused to autoclose
superseded ones ("branch already modified" — see the abandoned #200).
Switch to running AFTER apm.yml lands on main (`push: main`, paths:
apm.yml) and opening a SEPARATE `chore: materialize` PR via the open-pr
composite. Renovate's bump PR now stays pristine and merges/automerges
normally; this follow-up PR carries the lockfile + deployed primitives.Describe the corrected flow: Renovate's bump PR changes only apm.yml (so it rebases/automerges/autocloses cleanly), then a post-merge workflow opens a separate materialize PR with the lockfile + deployed files. Explain why the materialize step must not touch the Renovate branch.
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 freeto 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.
The bug (great catch by @DevSecNinja)
The previous
apm-materialize.ymltriggered onpull_requestand pushed the materialized files (lockfile + deployed primitives) back onto the triggering PR branch. That works on a branch I own, but for Renovate's own bump PRs it corrupts Renovate's branch ownership:"Autoclosing Skipped … the branch being already modified").Pushing commits to Renovate branches is a known anti-pattern. I've closed#200 and deleted its branch (Renovate couldn't).
The fix (option A)
Materialize post-merge, in a separate PR — never touching the Renovate branch:
pushtomain(paths:apm.yml) +workflow_dispatch, instead ofpull_request.apm install, then open a separatechore: materialize APM primitivesPR via theopen-prcomposite (App token → CI runs on it).So Renovate's bump PR now changes only the manifest text → it rebases, automerges, and autocloses normally. After it lands, the materialize PR carries the lockfile + deployed files.
Net flow per upstream release: Renovate bump PR (manifest only, automerges) → materialize PR (lockfile + deployed files, you review/merge).
mainis briefly ahead onapm.ymluntil the materialize PR merges — harmless for agent-context files.This reuses the exact
open-prpattern that already works inconfig-sync, so it's reliable on Mend-hosted Renovate (which can't runpostUpgradeTasks).Also
docs/apm-sync-onboarding.mdfor the post-merge model (with a "why not on the Renovate branch" note).Note
.githubis already fully materialized at v0.3.0 (from #201), so merging this just changes future behavior — no immediate materialize PR expected until the next ai-toolkit release.