From 2f940b0aec38c2d5370cef83895b8a4870e9990c Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 16 Jul 2025 17:46:02 +0000 Subject: [PATCH] Address review feedback: simplify warning text and revert migration/custom action docs Co-authored-by: Rugvip <4984472+Rugvip@users.noreply.github.com> --- docs/features/software-templates/index.md | 4 +- .../migrating-from-v1beta2-to-v1beta3.md | 39 ------------------- .../writing-custom-actions.md | 10 ----- 3 files changed, 1 insertion(+), 52 deletions(-) diff --git a/docs/features/software-templates/index.md b/docs/features/software-templates/index.md index 7a019838da..58da85c6eb 100644 --- a/docs/features/software-templates/index.md +++ b/docs/features/software-templates/index.md @@ -12,9 +12,7 @@ locations like GitHub or GitLab. :::warning Important -When creating custom scaffolder actions, **use camelCase for action IDs** instead of kebab-case. Action IDs with dashes (like `fetch:component-id`) will cause template expressions like `${{ steps.fetch-component-id.output.componentId }}` to return `NaN` because the dashes are evaluated as subtraction operators in JavaScript expressions. - -Use `fetchComponentId` instead of `fetch:component-id` for action IDs, or access outputs using bracket notation: `${{ steps['fetch:component-id'].output.componentId }}`. +When creating custom scaffolder actions, **use camelCase for action IDs** instead of kebab-case. Action IDs with dashes (like `fetch-component-id`) will cause template expressions like `${{ steps.fetch-component-id.output.componentId }}` to return `NaN` because the dashes are evaluated as subtraction operators in JavaScript expressions. :::note diff --git a/docs/features/software-templates/migrating-from-v1beta2-to-v1beta3.md b/docs/features/software-templates/migrating-from-v1beta2-to-v1beta3.md index 19d8e3c03d..91fc34f978 100644 --- a/docs/features/software-templates/migrating-from-v1beta2-to-v1beta3.md +++ b/docs/features/software-templates/migrating-from-v1beta2-to-v1beta3.md @@ -202,45 +202,6 @@ output: ## Watch out for `dash-case` -:::warning Critical Issue: kebab-case Action IDs Cause NaN - -The nunjucks compiler can run into issues if the `id` fields in your template steps use dash characters, since these IDs translate directly to JavaScript object properties when accessed as output. **This is a common source of bugs where template expressions return `NaN` instead of expected values.** - -**The Problem:** -When you use kebab-case action IDs like `fetch:component-id`, template expressions like: -```yaml -${{ steps.fetch-component-id.output.componentId }} -``` -Are evaluated as JavaScript: `steps.fetch - component - id.output.componentId`, which performs subtraction operations and results in `NaN`. - -**Solutions:** - -1. **Recommended:** Use `camelCase` for your action IDs: - -```yaml -steps: - - id: fetchComponentId # ✅ Use camelCase - ... - - - id: publishPullRequest # ✅ Use camelCase - input: - repoUrl: ${{ steps.fetchComponentId.output.repoUrl }} # ✅ Works correctly -``` - -2. **Alternative:** Keep dash-case and use bracket notation for property access: - -```yaml -steps: - - id: fetch-component-id # ⚠️ Dash-case requires bracket notation - ... - - - id: publish-pull-request - input: - repoUrl: ${{ steps['fetch-component-id'].output.repoUrl }} # ✅ Works with brackets -``` - -::: - The nunjucks compiler can run into issues if the `id` fields in your template steps use dash characters, since these IDs translate directly to JavaScript object properties when accessed as output. One possible migration path is to use `camelCase` for your action IDs. ```yaml diff --git a/docs/features/software-templates/writing-custom-actions.md b/docs/features/software-templates/writing-custom-actions.md index e7202a4a6e..1a64406b04 100644 --- a/docs/features/software-templates/writing-custom-actions.md +++ b/docs/features/software-templates/writing-custom-actions.md @@ -105,16 +105,6 @@ We follow `provider:entity:verb` or as close to this as possible for our built-i Also feel free to use your company name to namespace them if you prefer too, for example `acme:file:create` like above. -:::warning Critical: Use camelCase for Action IDs - -**Always use `camelCase` for action IDs** instead of `kebab-case` or `snake_case`. Action IDs with dashes (like `fetch:component-id`) will cause your template expressions to return `NaN` instead of expected values. - -**Problem:** If you use kebab-case like `fetch:component-id`, expressions like `${{ steps.fetch-component-id.output.componentId }}` will be evaluated as `steps.fetch - component - id.output.componentId` (subtraction operations), resulting in `NaN`. - -**Solution:** Use `fetchComponentId` instead of `fetch:component-id`, or access outputs with bracket notation: `${{ steps['fetch:component-id'].output.componentId }}`. - -::: - Prefer to use `camelCase` over `snake_case` or `kebab-case` for these actions if possible, which leads to better reading and writing of template entity definitions.