Skip to content
This repository was archived by the owner on Dec 2, 2022. It is now read-only.

Commit efc5580

Browse files
author
Adam Warner
committed
DEBUG: Save github hooks to see what's happening.
1 parent 09ff534 commit efc5580

File tree

1 file changed

+4
-45
lines changed

1 file changed

+4
-45
lines changed

Matterhook.NET/Controllers/GitHubHookController.cs

+4-45
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,10 @@ public async Task<IActionResult> Receive()
6161
payloadText = await reader.ReadToEndAsync().ConfigureAwait(false);
6262
}
6363

64+
System.IO.File.WriteAllText($"/config/payloads/{delivery}", $"Signature: {signature}\n");
65+
System.IO.File.AppendAllText($"/config/payloads/{delivery}", $"Event: {strEvent}\nPayload:\n");
66+
System.IO.File.AppendAllText($"/config/payloads/{delivery}", payloadText);
67+
6468
var calcSig = Util.CalculateSignature(payloadText, signature, _config.Secret, "sha1=");
6569

6670

@@ -226,56 +230,11 @@ private static MattermostMessage GetMessagePush(PushEvent payload)
226230
retVal.Text =
227231
$"{userMd} pushed {payload.commits.Count} commit{multi} to {branchMd} on {repoMd}";
228232

229-
230-
231233
att = new MattermostAttachment();
232-
233-
var tmpAdded = new MattermostField
234-
{
235-
Short = true,
236-
Title = "Added"
237-
};
238-
var tmpRemoved = new MattermostField
239-
{
240-
Short = true,
241-
Title = "Removed"
242-
};
243-
var tmpModified = new MattermostField
244-
{
245-
Short = true,
246-
Title = "Modified"
247-
};
248234

249235
foreach (var commit in payload.commits)
250236
{
251237
att.Text += $"- [`{commit.id.Substring(0, 8)}`]({commit.url}) - {commit.message.Replace("\n"," ")}\n";
252-
if (commit.added.Any())
253-
{
254-
tmpAdded.Value +=
255-
commit.added.Aggregate("", (current, added) => current + $"`{added}`\n");
256-
}
257-
258-
if (commit.removed.Any())
259-
{
260-
tmpRemoved.Value +=
261-
commit.removed.Aggregate("", (current, removed) => current + $"`{removed}`\n");
262-
}
263-
264-
if (commit.modified.Any())
265-
{
266-
tmpModified.Value +=
267-
commit.modified.Aggregate("", (current, modified) => current + $"`{modified}`\n");
268-
}
269-
}
270-
271-
if (_config.VerboseCommitMessages)
272-
{
273-
att.Fields = new List<MattermostField>
274-
{
275-
tmpAdded,
276-
tmpRemoved,
277-
tmpModified
278-
};
279238
}
280239

281240
}

0 commit comments

Comments
 (0)