From a21233ff4b253b4365fca76a520ab7a219e4c020 Mon Sep 17 00:00:00 2001 From: Mitch Denny Date: Tue, 2 Jun 2020 19:11:03 +1000 Subject: [PATCH] Handle requested_action field for check-runs. --- Octokit.Tests/Models/CheckRunEventTests.cs | 4 +++ .../ActivityPayloads/CheckRunEventPayload.cs | 1 + .../Response/CheckRunRequestedAction.cs | 27 +++++++++++++++++++ 3 files changed, 32 insertions(+) create mode 100644 Octokit/Models/Response/CheckRunRequestedAction.cs diff --git a/Octokit.Tests/Models/CheckRunEventTests.cs b/Octokit.Tests/Models/CheckRunEventTests.cs index 1038fda9f1..360a72382a 100644 --- a/Octokit.Tests/Models/CheckRunEventTests.cs +++ b/Octokit.Tests/Models/CheckRunEventTests.cs @@ -107,6 +107,9 @@ public void CanBeDeserialized() ] }, + ""requested_action"": { + ""identifier"": ""dosomeaction"" + }, ""repository"": { ""id"": 526, ""node_id"": ""MDEwOlJlcG9zaXRvcnkxMzU0OTMyMzM="", @@ -248,6 +251,7 @@ public void CanBeDeserialized() Assert.Equal(4, payload.CheckRun.Id); Assert.Equal(CheckStatus.Completed, payload.CheckRun.Status); Assert.Equal(CheckConclusion.Neutral, payload.CheckRun.Conclusion); + Assert.Equal("dosomeaction", payload.RequestedAction.Identifier); Assert.Equal(5, payload.CheckRun.CheckSuite.Id); Assert.Equal(CheckStatus.Completed, payload.CheckRun.CheckSuite.Status.Value); Assert.Equal(CheckConclusion.Neutral, payload.CheckRun.CheckSuite.Conclusion); diff --git a/Octokit/Models/Response/ActivityPayloads/CheckRunEventPayload.cs b/Octokit/Models/Response/ActivityPayloads/CheckRunEventPayload.cs index a3b76b1a45..9bc83e6f84 100644 --- a/Octokit/Models/Response/ActivityPayloads/CheckRunEventPayload.cs +++ b/Octokit/Models/Response/ActivityPayloads/CheckRunEventPayload.cs @@ -7,5 +7,6 @@ public class CheckRunEventPayload : ActivityPayload { public string Action { get; protected set; } public CheckRun CheckRun { get; protected set; } + public CheckRunRequestedAction RequestedAction { get; protected set; } } } diff --git a/Octokit/Models/Response/CheckRunRequestedAction.cs b/Octokit/Models/Response/CheckRunRequestedAction.cs new file mode 100644 index 0000000000..05468942cc --- /dev/null +++ b/Octokit/Models/Response/CheckRunRequestedAction.cs @@ -0,0 +1,27 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Globalization; + +namespace Octokit +{ + [DebuggerDisplay("{DebuggerDisplay,nq}")] + public class CheckRunRequestedAction + { + public CheckRunRequestedAction() + { + } + + public CheckRunRequestedAction(string identifier) + { + Identifier = identifier; + } + + /// + /// The Identifier of the check run requested action. + /// + public string Identifier { get; protected set; } + + internal string DebuggerDisplay => string.Format(CultureInfo.InvariantCulture, "Identifier: {0}", Identifier); + } +}