Skip to content

Commit

Permalink
Add CreatedAt to WorkflowJob model (#2729)
Browse files Browse the repository at this point in the history
* make some fields nullable on workflowjob

* add CreatedAt to WorkflowJob model
  • Loading branch information
lineville authored Jun 26, 2023
1 parent b4b3534 commit afac3e0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 2 additions & 0 deletions Octokit.Tests/Models/WorkflowJobTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ public void CanBeDeserialized()
""html_url"": ""https://github.com/octo-org/octo-repo/runs/399444496"",
""status"": ""completed"",
""conclusion"": ""success"",
""created_at"": ""2020-01-20T17:42:40Z"",
""started_at"": ""2020-01-20T17:42:40Z"",
""completed_at"": ""2020-01-20T17:44:39Z"",
""name"": ""build"",
Expand Down Expand Up @@ -129,6 +130,7 @@ public void CanBeDeserialized()
Assert.Equal("https://github.com/octo-org/octo-repo/runs/399444496", payload.HtmlUrl);
Assert.Equal(WorkflowJobStatus.Completed, payload.Status);
Assert.Equal(WorkflowJobConclusion.Success, payload.Conclusion);
Assert.Equal(new DateTimeOffset(2020, 01, 20, 17, 42, 40, TimeSpan.Zero), payload.CreatedAt);
Assert.Equal(new DateTimeOffset(2020, 01, 20, 17, 42, 40, TimeSpan.Zero), payload.StartedAt);
Assert.Equal(new DateTimeOffset(2020, 01, 20, 17, 44, 39, TimeSpan.Zero), payload.CompletedAt);
Assert.Equal("build", payload.Name);
Expand Down
8 changes: 7 additions & 1 deletion Octokit/Models/Response/WorkflowJob.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public class WorkflowJob
{
public WorkflowJob() { }

public WorkflowJob(long id, long runId, string runUrl, string nodeId, string headSha, string url, string htmlUrl, WorkflowJobStatus status, WorkflowJobConclusion? conclusion, DateTimeOffset startedAt, DateTimeOffset? completedAt, string name, IReadOnlyList<WorkflowJobStep> steps, string checkRunUrl, IReadOnlyList<string> labels, long? runnerId = default, string runnerName = default, long? runnerGroupId = default, string runnerGroupName = default)
public WorkflowJob(long id, long runId, string runUrl, string nodeId, string headSha, string url, string htmlUrl, WorkflowJobStatus status, WorkflowJobConclusion? conclusion, DateTimeOffset createdAt, DateTimeOffset startedAt, DateTimeOffset? completedAt, string name, IReadOnlyList<WorkflowJobStep> steps, string checkRunUrl, IReadOnlyList<string> labels, long? runnerId = default, string runnerName = default, long? runnerGroupId = default, string runnerGroupName = default)
{
Id = id;
RunId = runId;
Expand All @@ -21,6 +21,7 @@ public WorkflowJob(long id, long runId, string runUrl, string nodeId, string hea
HtmlUrl = htmlUrl;
Status = status;
Conclusion = conclusion;
CreatedAt = createdAt;
StartedAt = startedAt;
CompletedAt = completedAt;
Name = name;
Expand Down Expand Up @@ -78,6 +79,11 @@ public WorkflowJob(long id, long runId, string runUrl, string nodeId, string hea
/// </summary>
public StringEnum<WorkflowJobConclusion>? Conclusion { get; private set; }

/// <summary>
/// The time that the job was created.
/// </summary>
public DateTimeOffset CreatedAt { get; private set; }

/// <summary>
/// The time that the job started.
/// </summary>
Expand Down

0 comments on commit afac3e0

Please sign in to comment.