-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Add missing deployment_status properties #55
feat: Add missing deployment_status properties #55
Conversation
The Actor types should be of the |
[JsonPropertyName("run_started_at")] | ||
[JsonConverter(typeof(DateTimeOffsetConverter))] | ||
public DateTimeOffset RunStartedAt { get; init; } | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing previous_attempt_url
in here1. I think the definition is going to be:
[JsonPropertyName("previous_attempt_url")] | |
public string? PreviousAttemptUrl { get; init; }; | |
Footnotes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like I missed this one because it's a Deployment WorkflowRun1, rather than a WorkflowRun
, so that's why there wasn't a previous_attempt_url
in the payload2. Should I add a different type that's a subset, or leave it as is where various properties will just be null
because they're absent?
Footnotes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If octokit/webhooks
splits these as two different models, then we should probably do so too.
DeploymentWorkflowRun
is used in DeploymentCreatedEvent
and DeploymentStatusCreatedEvent
.
WorkflowRun
is used in WorkflowRunCompletedEvent
and WorkflowRunRequestedEvent
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I went through the schema definition and added the different models for the ones where they were either defined differently or inline as separate models/enums and rebased this onto #52.
- Add missing properties to DeploymentStatusEvent - Add missing properties to WorkflowRun Contributes to octokit#54.
Add the `actor` and `triggering_actor` properties to WorkflowRun.
- Add missing `previous_attempt_url` property. - Sort properties according to the schema.
- Add missing properties/types for the `deployment` and `deployment_status` events. - Use dedicated types for `deployment_status`. - Add missing deployment event to `CheckRun`. - Add missing `environment_url` and `log_url` properties to `DeploymentStatus`.
d8e4e05
to
46fcead
Compare
[JsonPropertyName("workflow")] | ||
public Models.Workflow? Workflow { get; init; } = null!; | ||
|
||
[JsonPropertyName("workflow_run")] | ||
public Models.DeploymentEvent.DeploymentWorkflowRun? WorkflowRun { get; init; } = null!; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[JsonPropertyName("check_run")] | ||
public Models.DeploymentEvent.DeploymentCheckRun? CheckRun { get; init; } | ||
|
||
[JsonPropertyName("workflow_run")] | ||
public Models.DeploymentEvent.DeploymentWorkflowRun? WorkflowRun { get; init; } | ||
|
||
[JsonPropertyName("workflow")] | ||
public Models.Workflow? Workflow { get; init; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[JsonPropertyName("deployment")] | ||
public Deployment Deployment { get; init; } = null!; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Footnotes
-
https://github.com/octokit/webhooks/blob/d93eebf4c48dc3c36f9c7ceffab356fa444bf9fc/payload-types/schema.d.ts#L756 ↩
-
https://github.com/octokit/webhooks/blob/d93eebf4c48dc3c36f9c7ceffab356fa444bf9fc/payload-types/schema.d.ts#L1005 ↩
-
https://github.com/octokit/webhooks/blob/d93eebf4c48dc3c36f9c7ceffab356fa444bf9fc/payload-types/schema.d.ts#L1118 ↩
-
https://github.com/octokit/webhooks/blob/d93eebf4c48dc3c36f9c7ceffab356fa444bf9fc/payload-types/schema.d.ts#L1223 ↩
using Octokit.Webhooks.Converter; | ||
|
||
[PublicAPI] | ||
public sealed record DeploymentCheckRun |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
using System.Text.Json.Serialization; | ||
|
||
[JsonConverter(typeof(JsonStringEnumMemberConverter))] | ||
public enum DeploymentCheckRunConclusion |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
using Octokit.Webhooks.Models.CheckRunEvent; | ||
|
||
[PublicAPI] | ||
public sealed record DeploymentWorkflowRun |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
using System.Text.Json.Serialization; | ||
|
||
[JsonConverter(typeof(JsonStringEnumMemberConverter))] | ||
public enum DeploymentWorkflowRunConclusion |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
using System.Text.Json.Serialization; | ||
|
||
[JsonConverter(typeof(JsonStringEnumMemberConverter))] | ||
public enum DeploymentWorkflowRunStatus |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Schema reference{^1] plus values from #52
[JsonPropertyName("environment_url")] | ||
public string? EnvironmentUrl { get; init; } | ||
|
||
[JsonPropertyName("log_url")] | ||
public string? LogUrl { get; init; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[JsonPropertyName("run_started_at")] | ||
[JsonConverter(typeof(DateTimeOffsetConverter))] | ||
public DateTimeOffset RunStartedAt { get; init; } | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've also validated that the event I originally received in my app deserializes without issue using these changes. |
DeploymentStatusEvent
WorkflowRun
I've made an assumption here that the properties for check suite and workflows are nullable.#55 (comment)I've also omitted the missingactor
andtriggering_actor
properties at this point as I'm not sure what the type should be with respect to the schema and I couldn't see an obvious existing type for it.Resolves #54.