stabilize tests
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
|
||||
using StellaOps.Signals.Scm.Models;
|
||||
using System.Globalization;
|
||||
using System.Text.Json;
|
||||
using StellaOps.Signals.Scm.Models;
|
||||
|
||||
namespace StellaOps.Signals.Scm.Webhooks;
|
||||
|
||||
@@ -24,6 +25,12 @@ public sealed class GitHubEventMapper : IScmEventMapper
|
||||
_ => (ScmEventType.Unknown, (Func<JsonElement, (ScmEventType, string?, string?)>?)null)
|
||||
};
|
||||
|
||||
// Unsupported event types return null
|
||||
if (extractor is null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
var repository = ExtractRepository(payload);
|
||||
if (repository is null && scmEventType != ScmEventType.Unknown)
|
||||
{
|
||||
@@ -35,18 +42,10 @@ public sealed class GitHubEventMapper : IScmEventMapper
|
||||
FullName = "unknown"
|
||||
};
|
||||
|
||||
string? commitSha = null;
|
||||
string? refName = null;
|
||||
|
||||
if (extractor is not null)
|
||||
var (extractedType, commitSha, refName) = extractor(payload);
|
||||
if (extractedType != ScmEventType.Unknown)
|
||||
{
|
||||
var (extractedType, sha, @ref) = extractor(payload);
|
||||
if (extractedType != ScmEventType.Unknown)
|
||||
{
|
||||
scmEventType = extractedType;
|
||||
}
|
||||
commitSha = sha;
|
||||
refName = @ref;
|
||||
scmEventType = extractedType;
|
||||
}
|
||||
|
||||
return new NormalizedScmEvent
|
||||
|
||||
Reference in New Issue
Block a user