Skip to content

MAI-13: substitute MAIASS_DEVELOPBRANCH in CI templates#9

Merged
vsmash merged 3 commits into
developfrom
task/MAI-13_ci_template_develop_branch
May 12, 2026
Merged

MAI-13: substitute MAIASS_DEVELOPBRANCH in CI templates#9
vsmash merged 3 commits into
developfrom
task/MAI-13_ci_template_develop_branch

Conversation

@vsmash
Copy link
Copy Markdown
Owner

@vsmash vsmash commented May 12, 2026

Summary

The CI template installer (maiass --create-gh-action / --show-gl-excerpt / --show-bb-excerpt) used to hardcode develop as the trigger branch, so the workflows it generated wouldn't fire for users whose develop branch is named anything else.

This change bakes MAIASS_DEVELOPBRANCH into the rendered template at install/print time. The trigger filter in all three CI providers requires a YAML literal — there's no runtime escape hatch — so substitution at install time is the only correct fix.

  • New renderTemplate(src) helper in lib/ci-templates.js reads process.env.MAIASS_DEVELOPBRANCH (silent fallback to develop) and replaces __MAIASS_DEVELOPBRANCH__ in the template content.
  • Three templates updated to use the placeholder and to have setup instructions / comments that reflect the new install-time substitution behaviour (the old GitHub template had a comment falsely claiming the workflow read the env var at runtime).
  • nodemaiass/.github/workflows/version-bump.yml regenerated from the updated template as a dogfooding check — output is effectively unchanged for this repo (develop branch is literally develop), but lineage is now traceable.

Test plan

  • MAIASS_DEVELOPBRANCH=trunk node maiass.mjs --create-gh-action in a scratch dir → output contains branches: - trunk, Checkout trunk, git checkout trunk. No placeholder leak.
  • node maiass.mjs --create-gh-action in a scratch dir with empty env → output contains branches: - develop, Checkout develop, git checkout develop. No warning, no failure.
  • MAIASS_DEVELOPBRANCH=trunk node maiass.mjs --show-gl-excerpt → prints only: - trunk.
  • MAIASS_DEVELOPBRANCH=trunk node maiass.mjs --show-bb-excerpt → prints pipelines.branches.trunk: key.
  • Misleading line-19 comment in GitHub template removed/corrected.
  • Regenerated version-bump.yml contains no __MAIASS_DEVELOPBRANCH__ placeholder.

Ticket: https://velvary.atlassian.net/browse/MAI-13

Tyler Durton and others added 3 commits May 12, 2026 16:26
The GitHub Actions trigger filter (on.pull_request.branches:) must be a
YAML literal -- there is no runtime escape hatch -- so bake the user's
configured develop branch into the template output at install time.

- lib/ci-templates.js: read process.env.MAIASS_DEVELOPBRANCH (with
  silent 'develop' fallback) and replace __MAIASS_DEVELOPBRANCH__ in
  both the copy path (--create-gh-action) and the show paths
  (--show-gl-excerpt, --show-bb-excerpt).
- templates/ci/github-version-bump.yml: replace branch literals on
  trigger, step name, and checkout command; fix misleading comment
  that claimed the workflow reads MAIASS_DEVELOPBRANCH at runtime.
- templates/ci/gitlab-ci-excerpt.yml: substitute branch in 'only:'.
- templates/ci/bitbucket-pipelines-excerpt.yml: substitute branch in
  'pipelines.branches:' key.
- .github/workflows/version-bump.yml: regenerated from the updated
  template (dogfooding check; nodemaiass's branch is 'develop' so the
  effective workflow is unchanged but the lineage is now traceable).

https://velvary.atlassian.net/browse/MAI-13
A trailing newline or surrounding whitespace from a mis-quoted .env.maiass
value would silently flow into the rendered YAML and break the trigger
filter. Trim once on read, and fall back to 'develop' if the trimmed
value is empty (e.g. MAIASS_DEVELOPBRANCH="   ").

https://velvary.atlassian.net/browse/MAI-13
@vsmash vsmash merged commit 8a4dc49 into develop May 12, 2026
8 checks passed
@vsmash vsmash deleted the task/MAI-13_ci_template_develop_branch branch May 12, 2026 06:40
Sign up for free to 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