Skip to content
This repository has been archived by the owner on Jan 13, 2025. It is now read-only.

Commit

Permalink
feat(WebhookSync): add secret option
Browse files Browse the repository at this point in the history
  • Loading branch information
ijsKoud committed Apr 26, 2023
1 parent af1ea37 commit ff5d8e3
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/actions/*/*/WebhookSync.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,14 @@ export default class WebhookSync extends Action {
const repo = ctx.repo();

const webhook = process.env[`${repo.owner.toUpperCase()}_WEBHOOK_URL`];
const secret = process.env[`${repo.owner.toUpperCase()}_WEBHOOK_SECRET`];
if (!webhook) return;

if (ctx.payload.action === "created") {
const active = !ctx.payload.repository.private;
await ctx.octokit.repos.createWebhook({
...repo,
config: { url: webhook, content_type: "json" },
config: { url: webhook, secret, content_type: "json" },
events: WEBHOOK_EVENTS,
active
});
Expand Down

0 comments on commit ff5d8e3

Please sign in to comment.