Address review feedback: simplify warning text and revert migration/custom action docs

Co-authored-by: Rugvip <4984472+Rugvip@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2025-07-16 17:46:02 +00:00
parent ad56ea9417
commit 2f940b0aec
3 changed files with 1 additions and 52 deletions
+1 -3
View File
@@ -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
@@ -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
@@ -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.