Skip to content

ci: add versioning for node-sdk genarator#2913

Merged
omer-topal merged 1 commit intomasterfrom
omer/node-sdk-versioning
Apr 23, 2026
Merged

ci: add versioning for node-sdk genarator#2913
omer-topal merged 1 commit intomasterfrom
omer/node-sdk-versioning

Conversation

@omer-topal
Copy link
Copy Markdown
Contributor

@omer-topal omer-topal commented Apr 22, 2026

Summary by CodeRabbit

  • Chores
    • Updated SDK generator workflow to support manual triggering with optional version specification.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 22, 2026

πŸ“ Walkthrough

Walkthrough

Updated GitHub Actions workflow configuration in .github/workflows/sdk-generator.yml to reintroduce workflow_dispatch trigger with optional version input parameter, corrected YAML indentation, and modified the final dispatch step to forward the version value sourced from release tags or manual input.

Changes

Cohort / File(s) Summary
GitHub Actions Workflow Configuration
.github/workflows/sdk-generator.yml
Reintroduced workflow_dispatch trigger with optional version input, corrected YAML nesting under on, and updated the final Permify/permify-node dispatch step to forward version parameter from either github.event.release.tag_name or manual inputs.version.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related PRs

Poem

🐰 The workflow dispatcher hops with glee,
A version input now flows so free,
From tags to inputs, the path is clear,
Dispatching northward without fear! πŸ“¦βœ¨

πŸš₯ Pre-merge checks | βœ… 5
βœ… Passed checks (5 passed)
Check name Status Explanation
Description Check βœ… Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check βœ… Passed The title accurately describes the main change: adding versioning capability to the Node SDK generator workflow via workflow_dispatch input configuration.
Docstring Coverage βœ… Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check βœ… Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check βœ… Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
πŸ§ͺ Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch omer/node-sdk-versioning

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❀️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

πŸ€– Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.github/workflows/sdk-generator.yml:
- Line 64: The workflow currently injects the raw version into a JSON string at
the inputs line ('inputs: '{ "version": "${{ github.event.release.tag_name ||
inputs.version }}" }'') which can break if the version contains
quotes/backslashes; change it to emit a proper JSON object using GitHub Actions
JSON-escaping (use toJSON/toJson) so the version is escaped, e.g. replace that
line with an expression that constructs the object and calls toJSON: ${{
toJSON({ version: github.event.release.tag_name || inputs.version }) }},
ensuring the forwarded version value is safely JSON-escaped.
πŸͺ„ Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
βš™οΈ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 4c603d33-93ce-48d6-a6f3-99a5269b150c

πŸ“₯ Commits

Reviewing files that changed from the base of the PR and between cb0c9af and fb997ca.

πŸ“’ Files selected for processing (1)
  • .github/workflows/sdk-generator.yml

repo: Permify/permify-node
ref: main
token: "${{ secrets.SDK_GH_TOKEN }}"
inputs: '{ "version": "${{ github.event.release.tag_name || inputs.version }}" }'
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟑 Minor

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Description: Demonstrate why direct interpolation into JSON is brittle.

python - <<'PY'
import json

versions = [
    "v1.6.9",
    'v1.6.9"bad',
    r"v1.6.9\bad",
]

for version in versions:
    current = '{ "version": "' + version + '" }'
    escaped = '{ "version": ' + json.dumps(version) + " }"

    print(f"\nversion={version!r}")

    try:
        parsed = json.loads(current)
        print("current parses:", parsed)
    except json.JSONDecodeError as exc:
        print("current fails:", exc)

    parsed = json.loads(escaped)
    print("escaped parses:", parsed)
PY

Repository: Permify/permify

Length of output: 393


🏁 Script executed:

cd /tmp && find . -name "sdk-generator.yml" -type f 2>/dev/null | head -5

Repository: Permify/permify

Length of output: 41


🏁 Script executed:

head -n 80 .github/workflows/sdk-generator.yml

Repository: Permify/permify

Length of output: 2627


🏁 Script executed:

if [ -f ".github/workflows/sdk-generator.yml" ]; then
  wc -l .github/workflows/sdk-generator.yml
  sed -n '55,75p' .github/workflows/sdk-generator.yml
else
  echo "File not found"
  ls -la .github/workflows/ 2>/dev/null || echo "Directory not found"
fi

Repository: Permify/permify

Length of output: 599


🌐 Web query:

GitHub Actions toJson format function documentation

πŸ’‘ Result:

The toJSON function in GitHub Actions is part of the expression syntax used to convert objects, arrays, or other values into a pretty-printed JSON string representation. It is primarily used for debugging purposes, such as logging context information. Syntax: toJSON(value) Description: Returns a pretty-print JSON representation of the provided value. Commonly used with contexts like github, job, steps, runner, etc. Example from official documentation: - name: Dump GitHub context env: GITHUB_CONTEXT: ${{ toJSON(github) }} run: echo "$GITHUB_CONTEXT" This outputs the entire github context as formatted JSON to the log. Note the warning: the github context includes sensitive data like github.token, which GitHub masks in logs, but caution is advised when exporting. toJSON(job) might return { "status": "success" }. It pairs with fromJSON(value), which parses a JSON string back into an object or primitive type. Official documentation is in the "Evaluate expressions in workflows and actions" page, with usage examples in "Contexts reference".

Citations:


🌐 Web query:

benc-uk workflow-dispatch inputs parameter how to pass JSON

πŸ’‘ Result:

To pass JSON as inputs parameters to a workflow_dispatch using the benc-uk/workflow-dispatch GitHub Action, provide a JSON-encoded string to the inputs parameter. The inputs input must be a valid JSON string containing key-value pairs that match the target workflow's workflow_dispatch.inputs definition. Example usage in a GitHub Actions workflow: - name: Trigger workflow with JSON inputs uses: benc-uk/workflow-dispatch@v2 with: workflow: "Target Workflow" token: ${{ secrets.MY_TOKEN }} inputs: '{ "message": "Hello world", "debug": true, "config": {"key": "value"} }' Key points: - All values in the JSON must be strings, even for booleans/numbers in the target workflow (use fromJson(inputs.myInput) in the target to parse). - For complex/nested JSON, use jq -c to compact it into a single-line string to avoid YAML multiline issues. - Recent updates (v1.3.1, Feb 2026) include safer JSON parsing that logs errors instead of crashing. - Requires a Personal Access Token (PAT) with repo scope for cross-repo triggers. In the target workflow, access via ${{ inputs.message }} or ${{ fromJson(inputs.config).key }}. Official documentation: https://github.com/benc-uk/workflow-dispatch

Citations:


🌐 Web query:

GitHub Actions format() toJSON() expression functions available

πŸ’‘ Result:

Yes, both format and toJSON are available expression functions in GitHub Actions. format(string, replaceValue0, replaceValue1, ..., replaceValueN): Replaces values in the string using {N} placeholders. Escape curly braces with double braces. Example: format('Hello {0} {1}', 'Mona', 'Octocat') returns 'Hello Mona Octocat'. toJSON(value): Returns a pretty-printed JSON representation of the value, useful for debugging contexts. Example: toJSON(github) or toJSON(job). These are documented in the official GitHub Actions expressions reference and remain current as of 2026.

Citations:


JSON-escape the forwarded version value.

Line 64 interpolates user input directly into JSON. A version value containing quotes or backslashes can produce invalid JSON or corrupt the forwarded value.

Proposed fix
-                inputs: '{ "version": "${{ github.event.release.tag_name || inputs.version }}" }'
+                inputs: >-
+                  ${{ format('{{ "version": {0} }}', toJson(github.event.release.tag_name || inputs.version)) }}
πŸ“ Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
inputs: '{ "version": "${{ github.event.release.tag_name || inputs.version }}" }'
inputs: >-
${{ format('{{ "version": {0} }}', toJson(github.event.release.tag_name || inputs.version)) }}
πŸ€– Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/sdk-generator.yml at line 64, The workflow currently
injects the raw version into a JSON string at the inputs line ('inputs: '{
"version": "${{ github.event.release.tag_name || inputs.version }}" }'') which
can break if the version contains quotes/backslashes; change it to emit a proper
JSON object using GitHub Actions JSON-escaping (use toJSON/toJson) so the
version is escaped, e.g. replace that line with an expression that constructs
the object and calls toJSON: ${{ toJSON({ version: github.event.release.tag_name
|| inputs.version }) }}, ensuring the forwarded version value is safely
JSON-escaped.

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 22, 2026

Codecov Report

βœ… All modified and coverable lines are covered by tests.
βœ… Project coverage is 81.98%. Comparing base (cb0c9af) to head (fb997ca).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #2913   +/-   ##
=======================================
  Coverage   81.98%   81.98%           
=======================================
  Files          74       74           
  Lines       11215    11215           
=======================================
  Hits         9193     9193           
  Misses       1486     1486           
  Partials      536      536           

β˜” View full report in Codecov by Sentry.
πŸ“’ Have feedback on the report? Share it here.

πŸš€ New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • πŸ“¦ JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@omer-topal omer-topal merged commit d7d98ba into master Apr 23, 2026
15 checks passed
@github-actions github-actions Bot locked and limited conversation to collaborators Apr 23, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant