Skip to content

Commit

Permalink
feat: add pull_request.{demilestoned, milestoned} events (#237)
Browse files Browse the repository at this point in the history
  • Loading branch information
JamieMagee committed Apr 10, 2023
1 parent 3842a28 commit 14cc92c
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 0 deletions.
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

0 comments on commit 14cc92c

Please sign in to comment.