diff --git a/source/Octopus.Server.Client/Model/ModifyRunbookCommand.cs b/source/Octopus.Server.Client/Model/ModifyRunbookCommand.cs new file mode 100644 index 00000000..ea1ed71d --- /dev/null +++ b/source/Octopus.Server.Client/Model/ModifyRunbookCommand.cs @@ -0,0 +1,7 @@ +namespace Octopus.Client.Model +{ + public class ModifyRunbookCommand : RunbookResource, ICommitCommand + { + public string ChangeDescription { get; set; } + } +} \ No newline at end of file diff --git a/source/Octopus.Server.Client/Repositories/Async/RunbookRepository.cs b/source/Octopus.Server.Client/Repositories/Async/RunbookRepository.cs index dee943e2..580d6a97 100644 --- a/source/Octopus.Server.Client/Repositories/Async/RunbookRepository.cs +++ b/source/Octopus.Server.Client/Repositories/Async/RunbookRepository.cs @@ -4,6 +4,7 @@ using Octopus.Client.Editors.Async; using Octopus.Client.Exceptions; using Octopus.Client.Model; +using Octopus.Client.Serialization; namespace Octopus.Client.Repositories.Async { @@ -117,10 +118,11 @@ public async Task Get(ProjectResource project, string gitRef, s public async Task Create(ProjectResource project, string gitRef, RunbookResource runbook, string commitMessage, CancellationToken cancellationToken) { var route = $"{baseGitUri}/runbooks/v2"; + var command = AppendCommitMessage(runbook, commitMessage); return await Client.Create( route, - runbook, + command, new { spaceId = project.SpaceId, @@ -134,10 +136,11 @@ public async Task Create(ProjectResource project, string gitRef public async Task Modify(ProjectResource project, string gitRef, RunbookResource runbook, string commitMessage, CancellationToken cancellationToken) { var route = $"{baseGitUri}/runbooks/{{id}}"; + var command = AppendCommitMessage(runbook, commitMessage); return await Client.Update( route, - runbook, + command, new { spaceId = project.SpaceId, @@ -162,7 +165,9 @@ await Client.Delete( gitRef = gitRef, slug = runbook.Id }, - null, + new { + ChangeDescription = commitMessage + }, cancellationToken ).ConfigureAwait(false); } @@ -184,5 +189,14 @@ public async Task Run(ProjectResource project, string gitR cancellationToken ).ConfigureAwait(false); } + + ModifyRunbookCommand AppendCommitMessage(RunbookResource runbook, string commitMessage) + { + var json = Serializer.Serialize(runbook); + var command = Serializer.Deserialize(json); + + command.ChangeDescription = commitMessage; + return command; + } } }