Made "github:autolinks:create" action idempotent

Signed-off-by: Bogdan Nechyporenko <bnechyporenko@bol.com>
This commit is contained in:
Bogdan Nechyporenko
2025-03-18 20:24:23 +01:00
parent 403bb43d3d
commit 1af427ab0b
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:autolinks:create" action idempotent
@@ -108,15 +108,20 @@ export function createGithubAutolinksAction(options: {
}),
);
await client.rest.repos.createAutolink({
owner,
repo,
key_prefix: keyPrefix,
url_template: urlTemplate,
is_alphanumeric: isAlphanumeric,
});
await ctx.checkpoint({
key: `create.auto.link.${owner}.${repo}`,
fn: async () => {
await client.rest.repos.createAutolink({
owner,
repo,
key_prefix: keyPrefix,
url_template: urlTemplate,
is_alphanumeric: isAlphanumeric,
});
ctx.logger.info(`Autolink reference created successfully`);
ctx.logger.info(`Autolink reference created successfully`);
},
});
},
});
}