diff --git a/Octokit.Tests/Models/DeploymentTests.cs b/Octokit.Tests/Models/DeploymentTests.cs index dab6b66842..b1630152de 100644 --- a/Octokit.Tests/Models/DeploymentTests.cs +++ b/Octokit.Tests/Models/DeploymentTests.cs @@ -17,7 +17,7 @@ public void CanSerialize() }; var deserialized = new SimpleJsonSerializer().Serialize(deployment); - Assert.Equal(@"{""ref"":""ref"",""task"":""deploy"",""payload"":{""environment"":""production""}}", deserialized); + Assert.Equal(@"{""ref"":""ref"",""payload"":{""environment"":""production""}}", deserialized); } [Fact] @@ -50,7 +50,8 @@ public void CanDeserialize() ""created_at"": ""2012-07-20T01:19:13Z"", ""updated_at"": ""2012-07-20T01:19:13Z"", ""description"": ""Deploy request from hubot"", - ""statuses_url"": ""https://api.github.com/repos/octocat/example/deployments/1/statuses"" + ""statuses_url"": ""https://api.github.com/repos/octocat/example/deployments/1/statuses"", + ""task"": ""deploy"" }"; var actual = new SimpleJsonSerializer().Deserialize(json); @@ -63,6 +64,7 @@ public void CanDeserialize() Assert.Equal(DateTimeOffset.Parse("2012-07-20T01:19:13Z"), actual.UpdatedAt); Assert.Equal("Deploy request from hubot", actual.Description); Assert.Equal("https://api.github.com/repos/octocat/example/deployments/1/statuses", actual.StatusesUrl); + Assert.Equal("deploy", actual.Task); } } } diff --git a/Octokit/Models/Request/NewDeployment.cs b/Octokit/Models/Request/NewDeployment.cs index 7fdf30d4ba..eea8086959 100644 --- a/Octokit/Models/Request/NewDeployment.cs +++ b/Octokit/Models/Request/NewDeployment.cs @@ -33,12 +33,9 @@ public NewDeployment(string @ref) /// /// Gets or sets the optional task used to specify a task to execute, e.g. deploy or deploy:migrations. - /// Default: deploy + /// Default if not specified: deploy /// - /// - /// The task. - /// - public DeployTask Task { get; set; } + public string Task { get; set; } /// /// Merges the default branch into the requested deployment branch if true; @@ -95,22 +92,4 @@ internal string DebuggerDisplay } } } - - /// - /// The types of deployments tasks that are available. - /// - public enum DeployTask - { - /// - /// Deploy everything (default) - /// - [Parameter(Value = "deploy")] - Deploy, - - /// - /// Deploy migrations only. - /// - [Parameter(Value = "deploy:migrations")] - DeployMigrations - } } diff --git a/Octokit/Models/Response/Deployment.cs b/Octokit/Models/Response/Deployment.cs index 4d4e5be667..ba3016a295 100644 --- a/Octokit/Models/Response/Deployment.cs +++ b/Octokit/Models/Response/Deployment.cs @@ -13,7 +13,7 @@ public class Deployment { public Deployment() { } - public Deployment(int id, string nodeId, string sha, string url, User creator, IReadOnlyDictionary payload, DateTimeOffset createdAt, DateTimeOffset updatedAt, string description, string statusesUrl, bool transientEnvironment, bool productionEnvironment) + public Deployment(int id, string nodeId, string sha, string url, User creator, IReadOnlyDictionary payload, DateTimeOffset createdAt, DateTimeOffset updatedAt, string description, string statusesUrl, bool transientEnvironment, bool productionEnvironment, string task) { Id = id; NodeId = nodeId; @@ -27,6 +27,7 @@ public Deployment(int id, string nodeId, string sha, string url, User creator, I StatusesUrl = statusesUrl; TransientEnvironment = transientEnvironment; ProductionEnvironment = productionEnvironment; + Task = task; } /// @@ -89,6 +90,11 @@ public Deployment(int id, string nodeId, string sha, string url, User creator, I /// public bool ProductionEnvironment { get; protected set; } + /// + /// Specifies a task to execute (e.g., deploy or deploy:migrations) + /// + public string Task { get; protected set; } + internal string DebuggerDisplay { get