Made "checkpoint" on scaffolder action context non-optional (#23291)

* Made "checkpoint" on scaffolder action context non-optional
Signed-off-by: bnechyporenko <bnechyporenko@bol.com>
This commit is contained in:
Bogdan Nechyporenko
2024-02-29 10:41:34 +01:00
committed by GitHub
parent b130eb36b4
commit bbd1fe19ab
5 changed files with 13 additions and 5 deletions
+7
View File
@@ -0,0 +1,7 @@
---
'@backstage/plugin-scaffolder-node-test-utils': patch
'@backstage/plugin-scaffolder-backend': patch
'@backstage/plugin-scaffolder-node': patch
---
Made "checkpoint" on scaffolder action context non-optional
@@ -138,13 +138,13 @@ describe('NunjucksWorkflowRunner', () => {
id: 'checkpoints-action',
description: 'Mock action with checkpoints',
handler: async ctx => {
const key1 = await ctx.checkpoint?.('key1', async () => {
const key1 = await ctx.checkpoint('key1', async () => {
return 'updated';
});
const key2 = await ctx.checkpoint?.('key2', async () => {
const key2 = await ctx.checkpoint('key2', async () => {
return 'updated';
});
const key3 = await ctx.checkpoint?.('key3', async () => {
const key3 = await ctx.checkpoint('key3', async () => {
return 'updated';
});
@@ -38,6 +38,7 @@ export const createMockActionContext = <
output: jest.fn(),
createTemporaryDirectory: jest.fn(),
input: {} as TActionInput,
checkpoint: jest.fn(),
};
const createDefaultWorkspace = () => ({
+1 -1
View File
@@ -30,7 +30,7 @@ export type ActionContext<
secrets?: TaskSecrets;
workspacePath: string;
input: TActionInput;
checkpoint?<U extends JsonValue>(
checkpoint<U extends JsonValue>(
key: string,
fn: () => Promise<U>,
): Promise<U>;
+1 -1
View File
@@ -35,7 +35,7 @@ export type ActionContext<
secrets?: TaskSecrets;
workspacePath: string;
input: TActionInput;
checkpoint?<U extends JsonValue>(
checkpoint<U extends JsonValue>(
key: string,
fn: () => Promise<U>,
): Promise<U>;