Provisioning: Fix repos stuck in deletion (#111918)

This commit is contained in:
Stephanie Hingtgen
2025-10-02 00:04:55 -06:00
committed by GitHub
parent ebbcef5583
commit 6f0a8a344a
5 changed files with 57 additions and 2 deletions
@@ -274,11 +274,15 @@ func (r *githubWebhookRepository) deleteWebhook(ctx context.Context) error {
id := r.config.Status.Webhook.ID
err := r.gh.DeleteWebhook(ctx, r.owner, r.repo, id)
if err != nil && !errors.Is(err, ErrResourceNotFound) {
if err != nil && !errors.Is(err, ErrResourceNotFound) && !errors.Is(err, ErrUnauthorized) {
return fmt.Errorf("delete webhook: %w", err)
}
if errors.Is(err, ErrResourceNotFound) {
logger.Info("webhook does not exist", "url", r.config.Status.Webhook.URL, "id", id)
logger.Warn("webhook no longer exists", "url", r.config.Status.Webhook.URL, "id", id)
return nil
}
if errors.Is(err, ErrUnauthorized) {
logger.Warn("webhook deletion failed. no longer authorized to delete this webhook", "url", r.config.Status.Webhook.URL, "id", id)
return nil
}