Made "github:actions:dispatch" action idempotent

Signed-off-by: Bogdan Nechyporenko <bnechyporenko@bol.com>
This commit is contained in:
Bogdan Nechyporenko
2025-03-18 20:26:33 +01:00
parent 403bb43d3d
commit a833f0f46d
2 changed files with 18 additions and 8 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-scaffolder-backend-module-github': patch
---
Made "github:actions:dispatch" action idempotent
@@ -115,15 +115,20 @@ export function createGithubActionsDispatchAction(options: {
}),
);
await client.rest.actions.createWorkflowDispatch({
owner,
repo,
workflow_id: workflowId,
ref: branchOrTagName,
inputs: workflowInputs,
});
await ctx.checkpoint({
key: `create.workflow.dispatch.${owner}.${repo}.${workflowId}`,
fn: async () => {
await client.rest.actions.createWorkflowDispatch({
owner,
repo,
workflow_id: workflowId,
ref: branchOrTagName,
inputs: workflowInputs,
});
ctx.logger.info(`Workflow ${workflowId} dispatched successfully`);
ctx.logger.info(`Workflow ${workflowId} dispatched successfully`);
},
});
},
});
}