From bd4aac9c8051c8e9958df3267d68238cd015904e Mon Sep 17 00:00:00 2001 From: daftgopher Date: Sat, 19 Mar 2022 16:37:37 -0400 Subject: [PATCH] additional template migration documentation Signed-off-by: daftgopher --- .../migrating-from-v1beta2-to-v1beta3.md | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) 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 1f771b4eaf..a2277e096c 100644 --- a/docs/features/software-templates/migrating-from-v1beta2-to-v1beta3.md +++ b/docs/features/software-templates/migrating-from-v1beta2-to-v1beta3.md @@ -180,6 +180,35 @@ These should be moved to `links` under the `output` object instead. ``` +## Watch out for `dash-case` + +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. + +```diff + steps: +- id: my-custom-action +- ... +- +- id: publish-pull-request +- input: +- repoUrl: {{ steps.my-custom-action.output.repoUrl }} # Will not recognize 'my-custom-action' as a JS property since it contains dashes! + + steps: ++ id: myCustomAction ++ ... ++ ++ id: publishPullRequest ++ input: ++ repoUrl: ${{ steps.myCustomAction.output.repoUrl }} +``` + +Alternatively, it's possible to keep the `dash-case` syntax and use brackets for property access as you would in JavaScript: + +```yaml +input: + repoUrl: ${{ steps['my-custom-action'].output.repoUrl }} +``` + ### Summary Of course, we're always available on [discord](https://discord.gg/MUpMjP2) if