Skip to content

fix(apm): materialize post-merge in a separate PR, not on the Renovate branch - #202

Merged
DevSecNinja merged 3 commits into
mainfrom
fix/apm-materialize-post-merge
Jun 21, 2026
Merged

fix(apm): materialize post-merge in a separate PR, not on the Renovate branch#202
DevSecNinja merged 3 commits into
mainfrom
fix/apm-materialize-post-merge

Conversation

@DevSecNinja

Copy link
Copy Markdown
Owner

The bug (great catch by @DevSecNinja)

The previous apm-materialize.yml triggered on pull_request and 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:

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:

  • Trigger:push to main (paths: apm.yml) + workflow_dispatch, instead of pull_request.
  • Action: run apm install, then open a separate chore: materialize APM primitives PR via the open-pr composite (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). main is briefly ahead on apm.yml until the materialize PR merges — harmless for agent-context files.

This reuses the exact open-pr pattern that already works in config-sync, so it's reliable on Mend-hosted Renovate (which can't run postUpgradeTasks).

Also

  • Rewrote docs/apm-sync-onboarding.md for the post-merge model (with a "why not on the Renovate branch" note).
  • Verified actionlint / yamllint / yamlfmt / dprint all pass.

Note

.github is 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.

…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.
@DevSecNinja
DevSecNinja merged commit fbc6913 into mainJun 21, 2026
16 checks passed
@DevSecNinja
DevSecNinja deleted the fix/apm-materialize-post-merge branch June 21, 2026 15:19
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

@DevSecNinja