From 203783ba48db0004a674601a4d12cd044eee27d2 Mon Sep 17 00:00:00 2001 From: jvmdc <109624469+jvmdc@users.noreply.github.com> Date: Mon, 6 Jan 2025 12:56:49 +0100 Subject: [PATCH 1/2] Fix checkpoint example in "Writing custom actions" The example was not using the correct parameters for setting up the checkpoint - You pass in an `opts` object rather than individual parameters. Signed-off-by: jvmdc <109624469+jvmdc@users.noreply.github.com> --- docs/features/software-templates/writing-custom-actions.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/features/software-templates/writing-custom-actions.md b/docs/features/software-templates/writing-custom-actions.md index 11e67af07fecd..1eb331f7b9ddf 100644 --- a/docs/features/software-templates/writing-custom-actions.md +++ b/docs/features/software-templates/writing-custom-actions.md @@ -263,7 +263,7 @@ Idempotent action could be achieved via the usage of checkpoints. Example: ```ts title="plugins/my-company-scaffolder-actions-plugin/src/vendor/my-custom-action.ts" -const res = await ctx.checkpoint?.('create.projects', async () => { +const res = await ctx.checkpoint?.({key: 'create.projects', fn: async () => { const projectStgId = createStagingProjectId(); const projectProId = createProductionProjectId(); @@ -271,7 +271,7 @@ const res = await ctx.checkpoint?.('create.projects', async () => { projectStgId, projectProId, }; -}); +}}); ``` You have to define the unique key in scope of the scaffolder task for your checkpoint. During the execution task engine From 91af9682be552e8f140ea5fef283ef0c811c6c40 Mon Sep 17 00:00:00 2001 From: blam Date: Tue, 28 Jan 2025 09:55:42 +0100 Subject: [PATCH 2/2] chore: pretty :nails: Signed-off-by: blam --- .../writing-custom-actions.md | 21 +++++++++++-------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/docs/features/software-templates/writing-custom-actions.md b/docs/features/software-templates/writing-custom-actions.md index 1eb331f7b9ddf..07734418cc654 100644 --- a/docs/features/software-templates/writing-custom-actions.md +++ b/docs/features/software-templates/writing-custom-actions.md @@ -263,15 +263,18 @@ Idempotent action could be achieved via the usage of checkpoints. Example: ```ts title="plugins/my-company-scaffolder-actions-plugin/src/vendor/my-custom-action.ts" -const res = await ctx.checkpoint?.({key: 'create.projects', fn: async () => { - const projectStgId = createStagingProjectId(); - const projectProId = createProductionProjectId(); - - return { - projectStgId, - projectProId, - }; -}}); +const res = await ctx.checkpoint?.({ + key: 'create.projects', + fn: async () => { + const projectStgId = createStagingProjectId(); + const projectProId = createProductionProjectId(); + + return { + projectStgId, + projectProId, + }; + }, +}); ``` You have to define the unique key in scope of the scaffolder task for your checkpoint. During the execution task engine