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>
This commit is contained in:
jvmdc
2025-01-06 12:56:49 +01:00
committed by GitHub
parent 41ab5cf4a0
commit 203783ba48
@@ -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