Skip to content
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 pull_request.{demilestoned, milestoned} events #237

Merged
merged 2 commits into from
Apr 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/Octokit.Webhooks/Events/PullRequest/PullRequestAction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,16 @@ public sealed record PullRequestAction : WebhookEventAction

public static readonly PullRequestAction Dequeued = new(PullRequestActionValue.Dequeued);

public static readonly PullRequestAction Demilestoned = new(PullRequestActionValue.Demilestoned);

public static readonly PullRequestAction Edited = new(PullRequestActionValue.Edited);

public static readonly PullRequestAction Labeled = new(PullRequestActionValue.Labeled);

public static readonly PullRequestAction Locked = new(PullRequestActionValue.Locked);

public static readonly PullRequestAction Milestoned = new(PullRequestActionValue.Milestoned);

public static readonly PullRequestAction Opened = new(PullRequestActionValue.Opened);

public static readonly PullRequestAction Queued = new(PullRequestActionValue.Queued);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ public static class PullRequestActionValue

public const string ConvertedToDraft = "converted_to_draft";

public const string Demilestoned = "demilestoned";

public const string Dequeued = "dequeued";

public const string Edited = "edited";
Expand All @@ -20,6 +22,8 @@ public static class PullRequestActionValue

public const string Locked = "locked";

public const string Milestoned = "milestoned";

public const string Opened = "opened";

public const string Queued = "queued";
Expand Down
14 changes: 14 additions & 0 deletions src/Octokit.Webhooks/Events/PullRequest/PullRequestDemilestoned.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
namespace Octokit.Webhooks.Events.PullRequest;

using Milestone = Octokit.Webhooks.Models.Milestone;

[PublicAPI]
[WebhookActionType(PullRequestActionValue.Demilestoned)]
public sealed record PullRequestDemilestoned : PullRequestEvent
{
[JsonPropertyName("action")]
public override string Action => PullRequestAction.Demilestoned;

[JsonPropertyName("milestone")]
public Milestone Milestone { get; init; } = null!;
}
14 changes: 14 additions & 0 deletions src/Octokit.Webhooks/Events/PullRequest/PullRequestMilestoned.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
namespace Octokit.Webhooks.Events.PullRequest;

using Milestone = Octokit.Webhooks.Models.Milestone;

[PublicAPI]
[WebhookActionType(PullRequestActionValue.Milestoned)]
public sealed record PullRequestMilestoned : PullRequestEvent
{
[JsonPropertyName("action")]
public override string Action => PullRequestAction.Milestoned;

[JsonPropertyName("milestone")]
public Milestone Milestone { get; init; } = null!;
}
3 changes: 3 additions & 0 deletions src/Octokit.Webhooks/WebhookEventProcessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -789,9 +789,12 @@ private Task ProcessPullRequestWebhookAsync(WebhookHeaders headers, PullRequestE
=> this.ProcessPullRequestWebhookAsync(headers, pullRequestEvent, PullRequestAction.ConvertedToDraft),
PullRequestActionValue.Dequeued =>
this.ProcessPullRequestWebhookAsync(headers, pullRequestEvent, PullRequestAction.Dequeued),
PullRequestActionValue.Demilestoned =>
this.ProcessPullRequestWebhookAsync(headers, pullRequestEvent, PullRequestAction.Demilestoned),
PullRequestActionValue.Edited => this.ProcessPullRequestWebhookAsync(headers, pullRequestEvent, PullRequestAction.Edited),
PullRequestActionValue.Labeled => this.ProcessPullRequestWebhookAsync(headers, pullRequestEvent, PullRequestAction.Labeled),
PullRequestActionValue.Locked => this.ProcessPullRequestWebhookAsync(headers, pullRequestEvent, PullRequestAction.Locked),
PullRequestActionValue.Milestoned => this.ProcessPullRequestWebhookAsync(headers, pullRequestEvent, PullRequestAction.Milestoned),
PullRequestActionValue.Opened => this.ProcessPullRequestWebhookAsync(headers, pullRequestEvent, PullRequestAction.Opened),
PullRequestActionValue.Queued
=> this.ProcessPullRequestWebhookAsync(headers, pullRequestEvent, PullRequestAction.Queued),
Expand Down