Made "github:webhook" action idempotent
Signed-off-by: Bogdan Nechyporenko <bnechyporenko@bol.com>
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'@backstage/plugin-scaffolder-backend-module-github': patch
|
||||
---
|
||||
|
||||
Made "github:webhook" action idempotent
|
||||
@@ -168,18 +168,25 @@ export function createGithubWebhookAction(options: {
|
||||
|
||||
try {
|
||||
const insecure_ssl = insecureSsl ? '1' : '0';
|
||||
await client.rest.repos.createWebhook({
|
||||
owner,
|
||||
repo,
|
||||
config: {
|
||||
url: webhookUrl,
|
||||
content_type: contentType,
|
||||
secret: webhookSecret,
|
||||
insecure_ssl,
|
||||
|
||||
await ctx.checkpoint({
|
||||
key: `create.webhhook.${owner}.${repo}.${webhookUrl}`,
|
||||
fn: async () => {
|
||||
await client.rest.repos.createWebhook({
|
||||
owner,
|
||||
repo,
|
||||
config: {
|
||||
url: webhookUrl,
|
||||
content_type: contentType,
|
||||
secret: webhookSecret,
|
||||
insecure_ssl,
|
||||
},
|
||||
events,
|
||||
active,
|
||||
});
|
||||
},
|
||||
events,
|
||||
active,
|
||||
});
|
||||
|
||||
ctx.logger.info(`Webhook '${webhookUrl}' created successfully`);
|
||||
} catch (e) {
|
||||
assertError(e);
|
||||
|
||||
Reference in New Issue
Block a user