feat(ruby): add ci.yml generation for GitHub output mode #10750
+119
−2
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.
Description
Linear ticket: N/A
Requested by: [email protected] (@tjb9dc)
Devin session: https://app.devin.ai/sessions/48add64d3495483da835df980f051ae0
Adds GitHub Actions CI workflow generation for the ruby-v2 SDK generator when using GitHub output mode. The workflow includes compile, test, and optional publish jobs for Ruby gems, following the same pattern as other language generators (Python, Go, C#, PHP).
Changes Made
getAsIsFilepath()helper function toAsIs.tsfor resolving template file paths in bundled CLI environmentsgithub-ci.ymltemplate with lodash template syntax for variable substitutiongenerateGithubWorkflow()method inSdkGeneratorCli.tsto:.github/workflows/ci.ymlin the output directoryregistryUrlandapiKeyEnvironmentVariableusing.trim() || defaultValuepatternKey Implementation Details
Path Resolution: The
getAsIsFilepath()function is exported from the base package to ensure__dirnameresolves correctly in bundled CLI environments where cross-package path resolution can fail.Template Variables:
gemName: The root folder name of the generated SDKshouldWritePublishBlock: Boolean flag to conditionally include the publish jobregistryUrl: The gem registry URL (defaults to rubygems.org)gemHostApiKeySecret: Pre-computed GitHub Actions secret expression (e.g.,${{ secrets.RUBYGEMS_AUTH_TOKEN }})Critical Fix: The
gemHostApiKeySecretis computed in TypeScript as${{ secrets.${gemHostApiKeyEnvVar} }}to avoid nested template syntax that would break lodash compilation. Empty strings are handled with.trim() || defaultValueto prevent generating invalid expressions like${{ secrets. }}.Testing
pnpm run check)Human Review Checklist
github-ci.ymlis correct, especially:<% if (shouldWritePublishBlock) { %><%= gemName %>,<%= gemHostApiKeySecret %>, etc..trim() || defaultValue) properly falls back to defaults when publishInfo fields are empty${{ secrets.${envVar} }}is properly escapedgetAsIsFilepath()works correctly in both local and bundled CLI environments