Skip to content

Conversation

@devin-ai-integration
Copy link
Contributor

@devin-ai-integration devin-ai-integration bot commented Nov 20, 2025

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

  • Added getAsIsFilepath() helper function to AsIs.ts for resolving template file paths in bundled CLI environments
  • Created github-ci.yml template with lodash template syntax for variable substitution
  • Implemented generateGithubWorkflow() method in SdkGeneratorCli.ts to:
    • Read and compile the CI workflow template
    • Generate workflow with gem name, registry URL, and API key configuration
    • Write the workflow to .github/workflows/ci.yml in the output directory
  • Added proper empty string handling for registryUrl and apiKeyEnvironmentVariable using .trim() || defaultValue pattern

Key Implementation Details

Path Resolution: The getAsIsFilepath() function is exported from the base package to ensure __dirname resolves correctly in bundled CLI environments where cross-package path resolution can fail.

Template Variables:

  • gemName: The root folder name of the generated SDK
  • shouldWritePublishBlock: Boolean flag to conditionally include the publish job
  • registryUrl: The gem registry URL (defaults to rubygems.org)
  • gemHostApiKeySecret: Pre-computed GitHub Actions secret expression (e.g., ${{ secrets.RUBYGEMS_AUTH_TOKEN }})

Critical Fix: The gemHostApiKeySecret is computed in TypeScript as ${{ secrets.${gemHostApiKeyEnvVar} }} to avoid nested template syntax that would break lodash compilation. Empty strings are handled with .trim() || defaultValue to prevent generating invalid expressions like ${{ secrets. }}.

Testing

  • Lint checks passed (pnpm run check)
  • All ruby-sdk-v2 seed tests passed (11 test groups)
  • CI checks passed

Human Review Checklist

  • Verify the lodash template syntax in github-ci.yml is correct, especially:
    • The conditional block <% if (shouldWritePublishBlock) { %>
    • Variable interpolation <%= gemName %>, <%= gemHostApiKeySecret %>, etc.
  • Confirm empty string handling logic (.trim() || defaultValue) properly falls back to defaults when publishInfo fields are empty
  • Check that the generated GitHub Actions secret expression ${{ secrets.${envVar} }} is properly escaped
  • Verify the workflow structure follows Ruby gem best practices (compile → test → publish)
  • Confirm path resolution via getAsIsFilepath() works correctly in both local and bundled CLI environments

Add support for generating GitHub Actions CI workflow file for ruby-v2 generator.
The ci.yml includes jobs for compiling, testing, and optionally publishing gems to RubyGems.

Changes:
- Add github-ci.yml template in ruby-v2/base/src/asIs/
- Update AsIs.ts to reference the new ci.yml template
- Implement generateGithubWorkflow method in SdkGeneratorCli.ts
- Support building and publishing gems with configurable registry URL and API key

Co-Authored-By: [email protected] <[email protected]>
@devin-ai-integration
Copy link
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

@tjb9dc tjb9dc changed the title feat(ruby-v2): add ci.yml generation for GitHub output mode feat(ruby): add ci.yml generation for GitHub output mode Nov 20, 2025
Export getAsIsFilepath function from ruby-base package to properly resolve
asIs template file paths. This fixes the ENOENT error when trying to read
the github-ci.yml template during generation.

The issue was caused by __dirname being resolved incorrectly in the bundled
CLI when trying to reach across packages from sdk to base. The solution is
to export the path resolver from the base package where the asIs files live.

Co-Authored-By: [email protected] <[email protected]>
@devin-ai-integration devin-ai-integration bot changed the title feat(ruby): add ci.yml generation for GitHub output mode feat(ruby-v2): add ci.yml generation for GitHub output mode Nov 20, 2025
- Remove GithubCiYml from AsIsFiles to prevent it from being copied into generated SDKs
- Fix lodash template syntax error by building GitHub Actions expression in TypeScript
- Update SdkGeneratorCli.ts to use getAsIsFilepath with string directly
- Change gemHostApiKeyEnvVar template variable to gemHostApiKeySecret with full expression

This fixes the seed test failures caused by including the CI template in AsIsFiles,
which caused RubyProject to copy it into generated gems.

Co-Authored-By: [email protected] <[email protected]>
@devin-ai-integration devin-ai-integration bot changed the title feat(ruby-v2): add ci.yml generation for GitHub output mode feat(ruby): add ci.yml generation for GitHub output mode Nov 20, 2025
…Variable

Use trim() and || operator instead of ?? to properly fallback to defaults
when publishInfo fields are empty strings (as they are in seed configs).

This prevents generating invalid GitHub Actions expressions like:
- GEM_HOST_API_KEY: ${{ secrets. }}
- gem push --host (empty host)

Co-Authored-By: [email protected] <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant