Template
ci: resolve source directory from metadata entry_point (single source of truth, error on Makefile conflict) #33
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Every npm workflow hardcodes
src/as the source directory. The authoritative source-dir value already lives in the MokoGIT metadata API asentry_point. Because the MokoGIT release system zips from the source directory, a wrong/duplicated source-dir value ships the wrong tree. This issue introduces a single, shared resolver so CI reads the source dir from metadata and hard-fails on any conflict with the Makefile.Background
GET ${MOKOGIT_URL}/api/v1/repos/${GIT_ORG}/${GIT_REPO}/metadataentry_point(e.g.source/). Today this repo returns"entry_point": "src/"(fixed in the standardization issue).Makefilereferences$(SRC_DIR)in theminifytarget but never defines it (currently empty).src/occurs innpm-publish.yml,npm-build-test.yml, andnpm-auto-release.yml.Requirements
.mokogit/actions/resolve-source-dir/action.ymlthat:GETs the metadata endpoint and reads.entry_point; normalizes the trailing slash; defaults tosource/if empty/unreachable.SRC_DIR(e.g.make -pRrq 2>/dev/null | awk -F' := ' '/^SRC_DIR /{print $2}'or a grep fallback), normalized the same way.echo "::error::..."andexit 1(do not guess).source/.source_dir(with trailing slash) andsource_glob(<dir>/**).npm-publish.yml(this replaces PR #32's hardcoded^src/gate — the detect grep must use the resolved dir) andnpm-build-test.yml(path filters + thesrc/index.tstool-count reference).Acceptance Criteria
entry_pointin metadata changes what the publish gate and build-test consider "source" — no workflow edit required.SRC_DIRthat disagrees with metadataentry_pointfails the job with a clear::error::message.npm-publish.ymlno longer contains a hardcoded^src/(or^source/) literal in the detect step.npm-build-test.ymlpath filters and tool-count path derive from the resolved dir.Notes
fix/npm-publish-change-gate), which hardcodes^src/. That gate should read the resolved dir instead.source/); pairs with the standardization issue and the release-zip issue, which consume the sameentry_point.Authored-by: Moko Consulting
Status: implemented, pending testing (merged to
devvia PR #36, promoted tomainvia #39).Testing checklist (verify in a child npm/MCP repo synced from the template):
entry_pointfrom the metadata API and reports the resolved dir in the step log.mokogit_tokeninput (no 401 / no silent default).SRC_DIR≠ metadataentry_point→ job fails with the::error::source dir conflictmessage.strict: 'true'(publish/release) → job fails closed; withstrict: 'false'(build-test/tool-inventory) →::warning::+ default, job continues.npm-publish.yml:workflow_dispatchpublishes; a README-only change publishes; a docs-only/no-source change logs the::notice::and skips.Authored-by: Moko Consulting