Skip to content

Commit

Permalink
feat: new PullRequestQueued and PullRequestDequeued events (#131)
Browse files Browse the repository at this point in the history
  • Loading branch information
JamieMagee committed Oct 5, 2022
1 parent a294728 commit ebd71b4
Show file tree
Hide file tree
Showing 5 changed files with 33 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 @@ -13,6 +13,8 @@ public sealed record PullRequestAction : WebhookEventAction

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

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

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

public static readonly PullRequestAction Labeled = new(PullRequestActionValue.Labeled);
Expand All @@ -21,6 +23,8 @@ public sealed record PullRequestAction : WebhookEventAction

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

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

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

public static readonly PullRequestAction Reopened = new(PullRequestActionValue.Reopened);
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 Dequeued = "dequeued";

public const string Edited = "edited";

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

public const string Opened = "opened";

public const string Queued = "queued";

public const string ReadyForReview = "ready_for_review";

public const string Reopened = "reopened";
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
namespace Octokit.Webhooks.Events.PullRequest;

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

[JsonPropertyName("reason")]
public string Reason { get; init; } = null!;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
namespace Octokit.Webhooks.Events.PullRequest;

[PublicAPI]
[WebhookActionType(PullRequestActionValue.Queued)]
public sealed record PullRequestQueuedEvent : PullRequestEvent
{
[JsonPropertyName("action")]
public override string Action => PullRequestAction.Queued;
}
4 changes: 4 additions & 0 deletions src/Octokit.Webhooks/WebhookEventProcessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -746,10 +746,14 @@ private Task ProcessPullRequestWebhookAsync(WebhookHeaders headers, PullRequestE
PullRequestActionValue.Closed => this.ProcessPullRequestWebhookAsync(headers, pullRequestEvent, PullRequestAction.Closed),
PullRequestActionValue.ConvertedToDraft
=> this.ProcessPullRequestWebhookAsync(headers, pullRequestEvent, PullRequestAction.ConvertedToDraft),
PullRequestActionValue.Dequeued =>
this.ProcessPullRequestWebhookAsync(headers, pullRequestEvent, PullRequestAction.Dequeued),
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.Opened => this.ProcessPullRequestWebhookAsync(headers, pullRequestEvent, PullRequestAction.Opened),
PullRequestActionValue.Queued
=> this.ProcessPullRequestWebhookAsync(headers, pullRequestEvent, PullRequestAction.Queued),
PullRequestActionValue.ReadyForReview
=> this.ProcessPullRequestWebhookAsync(headers, pullRequestEvent, PullRequestAction.ReadyForReview),
PullRequestActionValue.Reopened
Expand Down

0 comments on commit ebd71b4

Please sign in to comment.