Add proposal approval api endpoint
Change-Id: I3ab864af51735ee7c484df9c66d0b3ec2f6acb36
diff --git a/server/app/proposal.go b/server/app/proposal.go
new file mode 100644
index 0000000..4b2acc4
--- /dev/null
+++ b/server/app/proposal.go
@@ -0,0 +1,26 @@
+package app
+
+import (
+ "fmt"
+
+ "github.com/iomodo/staff/git"
+)
+
+func (a *App) ProposalApproval(body []byte, signature string) error {
+ // Validate the webhook signature
+ if err := git.ValidateSignature(body, signature, a.config.GitHub.WebhookSecret); err != nil {
+ return fmt.Errorf("invalid webhook signature: %w", err)
+ }
+
+ // Process the webhook payload
+ taskID, err := git.ProcessMergeWebhook(body, signature, a.config.GitHub.WebhookSecret)
+ if err != nil {
+ return fmt.Errorf("Failed to process webhook: %w", err)
+ }
+
+ // Log the successful approval
+ a.logger.Info("Proposal approved via webhook",
+ "task_id", taskID,
+ )
+ return nil
+}