• Applicable Software: MokoGIT
  • Min Version Number: 02.10.00
  • Max Version Number: Not Applicable

Sync profiles decide which repositories a template's workflows and files get synced into. Traditionally a profile matches repos by their registered platform metadata. The new applies_to field adds a second, text-based way to match: it looks directly at each repo's root Makefile.

What applies_to does

applies_to is a list of regular expressions (one per line). At sync time, MokoGIT reads the candidate repo's root Makefile and checks each expression against it. If any line matches, the repo is a member of the profile.

This runs in addition to the normal platform match — the two are combined as a union:

A repo joins the profile if its platform metadata matches OR any applies_to expression matches its Makefile.

Because it only reads the Makefile, applies_to can match a repo that has no platform registered at all. You don't need to pre-register a platform or pass any “known platform” check — if the Makefile says PLATFORM = something, you can target it.

When to use it

Use applies_to when you want a profile to cover repos by what their Makefile declares, rather than by a registered platform. A common case: pulling in new or infrastructure repos that set PLATFORM=<x> in their Makefile before any platform entry exists for them.

How to match PLATFORM = <x>

Repos declare their platform in the Makefile, for example:

PLATFORM = go

The declaration can use =, :=, or ?=, with different spacing. To match all of those forms reliably, use this expression (replace <x> with your platform name):

(?m)^\s*PLATFORM\s*[:?]?=\s*<x>\b

What the pieces do:

  • (?m) — checks each line of the Makefile independently.
  • ^\s*PLATFORM — the line must begin with PLATFORM (so commented-out lines starting with # are skipped).
  • \s*[:?]?=\s* — accepts =, :=, and ?=, with any spaces around them.
  • \b — a word boundary, so PLATFORM=php won't accidentally match a profile looking for phpfpm (and vice-versa).

Worked example: match every PLATFORM=go repo

To make a profile include every repository whose Makefile declares Go as its platform:

# match any repo whose Makefile declares PLATFORM = go
(?m)^\s*PLATFORM\s*[:?]?=\s*go\b

Any repo with PLATFORM = go, PLATFORM:=go, or PLATFORM ?= go in its root Makefile is now included — even one with no Go platform registered — together with whatever the profile's platform selector already matched.

Comments

Lines that begin with # in the applies_to list are treated as comments and ignored, so you can label what each expression is for (as shown above).

Notes

  • Expressions are evaluated at sync-resolution time, against the Makefile on the repo's default branch. No build or checkout of other branches happens.
  • An empty or missing applies_to simply falls back to platform-only matching — existing profiles behave exactly as before.