MAI-13: substitute MAIASS_DEVELOPBRANCH in CI templates#9
Merged
Conversation
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
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 free
to 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.
Summary
The CI template installer (
maiass --create-gh-action/--show-gl-excerpt/--show-bb-excerpt) used to hardcodedevelopas the trigger branch, so the workflows it generated wouldn't fire for users whose develop branch is named anything else.This change bakes
MAIASS_DEVELOPBRANCHinto 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.renderTemplate(src)helper inlib/ci-templates.jsreadsprocess.env.MAIASS_DEVELOPBRANCH(silent fallback todevelop) and replaces__MAIASS_DEVELOPBRANCH__in the template content.nodemaiass/.github/workflows/version-bump.ymlregenerated from the updated template as a dogfooding check — output is effectively unchanged for this repo (develop branch is literallydevelop), but lineage is now traceable.Test plan
MAIASS_DEVELOPBRANCH=trunk node maiass.mjs --create-gh-actionin a scratch dir → output containsbranches: - trunk,Checkout trunk,git checkout trunk. No placeholder leak.node maiass.mjs --create-gh-actionin a scratch dir with empty env → output containsbranches: - develop,Checkout develop,git checkout develop. No warning, no failure.MAIASS_DEVELOPBRANCH=trunk node maiass.mjs --show-gl-excerpt→ printsonly: - trunk.MAIASS_DEVELOPBRANCH=trunk node maiass.mjs --show-bb-excerpt→ printspipelines.branches.trunk:key.version-bump.ymlcontains no__MAIASS_DEVELOPBRANCH__placeholder.Ticket: https://velvary.atlassian.net/browse/MAI-13