From a5bd9e39e52b60d7bc92b26026cd41d59753debb Mon Sep 17 00:00:00 2001 From: Maxwell Weru Date: Mon, 11 Sep 2023 15:55:16 +0300 Subject: [PATCH] Skip comments that do not start with @dependabot --- .../Tingle.Dependabot/AzureDevOpsEventHandler.cs | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/server/Tingle.Dependabot/AzureDevOpsEventHandler.cs b/server/Tingle.Dependabot/AzureDevOpsEventHandler.cs index 22a07d3f..cb720d7a 100644 --- a/server/Tingle.Dependabot/AzureDevOpsEventHandler.cs +++ b/server/Tingle.Dependabot/AzureDevOpsEventHandler.cs @@ -77,12 +77,17 @@ public virtual async Task HandleAsync(AzureDevOpsEvent model, CancellationToken var prId = pr.PullRequestId; var status = pr.Status; - logger.LogInformation("PR {PullRequestId} in {RepositoryUrl} was commented on: {Content}", - prId, - adoRepository.RemoteUrl, - comment.Content); + // ensure the comment starts with @dependabot + var content = comment.Content?.Trim(); + if (content is not null && content.StartsWith("@dependabot")) + { + logger.LogInformation("PR {PullRequestId} in {RepositoryUrl} was commented on: {Content}", + prId, + adoRepository.RemoteUrl, + content); - // TODO: handle the logic for comments here using events + // TODO: handle the logic for comments here using events + } } else {