From b25846562a69a67a3272ce19ddffdadf27dcfc25 Mon Sep 17 00:00:00 2001 From: blam Date: Thu, 15 Apr 2021 12:16:38 +0200 Subject: [PATCH] chore: add changeset Signed-off-by: blam --- .changeset/silent-papayas-dress.md | 38 ++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 .changeset/silent-papayas-dress.md diff --git a/.changeset/silent-papayas-dress.md b/.changeset/silent-papayas-dress.md new file mode 100644 index 0000000000..c3c05971fe --- /dev/null +++ b/.changeset/silent-papayas-dress.md @@ -0,0 +1,38 @@ +--- +'@backstage/plugin-scaffolder-backend': patch +--- + +Enable the JSON parsing of the response from templated variables in the `v2beta1` syntax. Previously if template parameters json strings they were left as strings, they are now parsed as JSON objects. + +Before: + +```yaml +- id: test + name: test-action + action: custom:run + input: + input: '{"hello":"ben"}' +``` + +Now: + +```yaml +- id: test + name: test-action + action: custom:run + input: + input: + hello: ben +``` + +Also added the `parseRepoUrl` and `json` helpers to the parameters syntax. You can now use these helpers to parse work with some `json` or `repoUrl` strings in templates. + +```yaml +- id: test + name: test-action + action: cookiecutter:fetch + input: + destination: '{{ parseRepoUrl parameters.repoUrl }}' +``` + +Will produce a parsed version of the `repoUrl` of type `{ repo: string, owner: string, host: string }` that you can use in your actions. Specifically `cookiecutter` with `{{ cookiecutter.destination.owner }}` like the `plugins/scaffolder-backend/sample-templates/v1beta2-demo/template.yaml` example.