From 1b745561c25715a2563caa6e227455673b177af6 Mon Sep 17 00:00:00 2001 From: Gerry Agbobada Date: Tue, 25 Jul 2023 17:54:23 +0200 Subject: [PATCH] Draft: add webhook event deserialization This commit will be force pushed regularly, as progressively elements for which we have example payloads will be more precise than just `serde_json::Value`. This commit is pushed to enable an initial review over the architecture/scope of the changes. --- src/models.rs | 2 + src/models/events.rs | 4 - src/models/reactions.rs | 2 +- src/models/webhook_events.rs | 810 ++++++++++++++++++ src/models/webhook_events/payload.rs | 196 +++++ .../payload/branch_protection_rule.rs | 18 + .../webhook_events/payload/check_run.rs | 18 + .../webhook_events/payload/check_suite.rs | 18 + .../payload/code_scanning_alert.rs | 25 + .../webhook_events/payload/commit_comment.rs | 42 + src/models/webhook_events/payload/create.rs | 14 + src/models/webhook_events/payload/delete.rs | 21 + .../payload/dependabot_alert.rs | 22 + .../webhook_events/payload/deploy_key.rs | 17 + .../webhook_events/payload/deployment.rs | 18 + .../payload/deployment_protection_rule.rs | 19 + .../payload/deployment_status.rs | 20 + .../webhook_events/payload/discussion.rs | 33 + .../payload/discussion_comment.rs | 20 + src/models/webhook_events/payload/fork.rs | 11 + .../payload/github_app_authorization.rs | 15 + src/models/webhook_events/payload/gollum.rs | 9 + .../webhook_events/payload/installation.rs | 23 + .../payload/installation_repositories.rs | 30 + .../payload/installation_target.rs | 11 + .../webhook_events/payload/issue_comment.rs | 23 + src/models/webhook_events/payload/issues.rs | 39 + src/models/webhook_events/payload/label.rs | 19 + .../payload/marketplace_purchase.rs | 21 + src/models/webhook_events/payload/member.rs | 19 + .../webhook_events/payload/membership.rs | 21 + .../webhook_events/payload/merge_group.rs | 26 + src/models/webhook_events/payload/meta.rs | 19 + .../webhook_events/payload/milestone.rs | 21 + .../webhook_events/payload/org_block.rs | 17 + .../webhook_events/payload/organization.rs | 21 + src/models/webhook_events/payload/package.rs | 17 + .../webhook_events/payload/page_build.rs | 9 + .../payload/personal_access_token_request.rs | 18 + src/models/webhook_events/payload/ping.rs | 11 + src/models/webhook_events/payload/project.rs | 21 + .../webhook_events/payload/project_card.rs | 21 + .../webhook_events/payload/project_column.rs | 20 + .../webhook_events/payload/projects_v2.rs | 20 + .../payload/projects_v2_item.rs | 22 + src/models/webhook_events/payload/public.rs | 7 + .../webhook_events/payload/pull_request.rs | 45 + .../payload/pull_request_review.rs | 19 + .../payload/pull_request_review_comment.rs | 20 + .../payload/pull_request_review_thread.rs | 17 + src/models/webhook_events/payload/push.rs | 19 + .../payload/registry_package.rs | 17 + src/models/webhook_events/payload/release.rs | 23 + .../webhook_events/payload/repository.rs | 24 + .../payload/repository_advisory.rs | 18 + .../payload/repository_dispatch.rs | 10 + .../payload/repository_import.rs | 17 + .../payload/repository_vulnerability_alert.rs | 19 + .../payload/secret_scanning_alert.rs | 19 + .../payload/secret_scanning_alert_location.rs | 16 + .../payload/security_advisory.rs | 18 + .../payload/security_and_analysis.rs | 8 + .../webhook_events/payload/sponsorship.rs | 23 + src/models/webhook_events/payload/star.rs | 18 + src/models/webhook_events/payload/status.rs | 32 + src/models/webhook_events/payload/team.rs | 21 + src/models/webhook_events/payload/team_add.rs | 8 + src/models/webhook_events/payload/watch.rs | 15 + .../payload/workflow_dispatch.rs | 10 + .../webhook_events/payload/workflow_job.rs | 20 + .../webhook_events/payload/workflow_run.rs | 19 + .../installation_created_webhook_event.json | 102 +++ .../installation_deleted_webhook_event.json | 101 +++ ...on_repositories_removed_webhook_event.json | 92 ++ .../issue_comment_created_webhook_event.json | 237 +++++ .../issue_comment_deleted_webhook_event.json | 245 ++++++ .../issue_comment_edited_webhook_event.json | 250 ++++++ .../issues_labeled_webhook_event.json | 213 +++++ .../issues_opened_webhook_event.json | 196 +++++ tests/resources/ping_webhook_event.json | 30 + .../pull_request_closed_webhook_event.json | 506 +++++++++++ .../pull_request_opened_webhook_event.json | 506 +++++++++++ ...ull_request_synchronize_webhook_event.json | 508 +++++++++++ .../repository_deleted_webhook_event.json | 135 +++ 84 files changed, 5421 insertions(+), 5 deletions(-) create mode 100644 src/models/webhook_events.rs create mode 100644 src/models/webhook_events/payload.rs create mode 100644 src/models/webhook_events/payload/branch_protection_rule.rs create mode 100644 src/models/webhook_events/payload/check_run.rs create mode 100644 src/models/webhook_events/payload/check_suite.rs create mode 100644 src/models/webhook_events/payload/code_scanning_alert.rs create mode 100644 src/models/webhook_events/payload/commit_comment.rs create mode 100644 src/models/webhook_events/payload/create.rs create mode 100644 src/models/webhook_events/payload/delete.rs create mode 100644 src/models/webhook_events/payload/dependabot_alert.rs create mode 100644 src/models/webhook_events/payload/deploy_key.rs create mode 100644 src/models/webhook_events/payload/deployment.rs create mode 100644 src/models/webhook_events/payload/deployment_protection_rule.rs create mode 100644 src/models/webhook_events/payload/deployment_status.rs create mode 100644 src/models/webhook_events/payload/discussion.rs create mode 100644 src/models/webhook_events/payload/discussion_comment.rs create mode 100644 src/models/webhook_events/payload/fork.rs create mode 100644 src/models/webhook_events/payload/github_app_authorization.rs create mode 100644 src/models/webhook_events/payload/gollum.rs create mode 100644 src/models/webhook_events/payload/installation.rs create mode 100644 src/models/webhook_events/payload/installation_repositories.rs create mode 100644 src/models/webhook_events/payload/installation_target.rs create mode 100644 src/models/webhook_events/payload/issue_comment.rs create mode 100644 src/models/webhook_events/payload/issues.rs create mode 100644 src/models/webhook_events/payload/label.rs create mode 100644 src/models/webhook_events/payload/marketplace_purchase.rs create mode 100644 src/models/webhook_events/payload/member.rs create mode 100644 src/models/webhook_events/payload/membership.rs create mode 100644 src/models/webhook_events/payload/merge_group.rs create mode 100644 src/models/webhook_events/payload/meta.rs create mode 100644 src/models/webhook_events/payload/milestone.rs create mode 100644 src/models/webhook_events/payload/org_block.rs create mode 100644 src/models/webhook_events/payload/organization.rs create mode 100644 src/models/webhook_events/payload/package.rs create mode 100644 src/models/webhook_events/payload/page_build.rs create mode 100644 src/models/webhook_events/payload/personal_access_token_request.rs create mode 100644 src/models/webhook_events/payload/ping.rs create mode 100644 src/models/webhook_events/payload/project.rs create mode 100644 src/models/webhook_events/payload/project_card.rs create mode 100644 src/models/webhook_events/payload/project_column.rs create mode 100644 src/models/webhook_events/payload/projects_v2.rs create mode 100644 src/models/webhook_events/payload/projects_v2_item.rs create mode 100644 src/models/webhook_events/payload/public.rs create mode 100644 src/models/webhook_events/payload/pull_request.rs create mode 100644 src/models/webhook_events/payload/pull_request_review.rs create mode 100644 src/models/webhook_events/payload/pull_request_review_comment.rs create mode 100644 src/models/webhook_events/payload/pull_request_review_thread.rs create mode 100644 src/models/webhook_events/payload/push.rs create mode 100644 src/models/webhook_events/payload/registry_package.rs create mode 100644 src/models/webhook_events/payload/release.rs create mode 100644 src/models/webhook_events/payload/repository.rs create mode 100644 src/models/webhook_events/payload/repository_advisory.rs create mode 100644 src/models/webhook_events/payload/repository_dispatch.rs create mode 100644 src/models/webhook_events/payload/repository_import.rs create mode 100644 src/models/webhook_events/payload/repository_vulnerability_alert.rs create mode 100644 src/models/webhook_events/payload/secret_scanning_alert.rs create mode 100644 src/models/webhook_events/payload/secret_scanning_alert_location.rs create mode 100644 src/models/webhook_events/payload/security_advisory.rs create mode 100644 src/models/webhook_events/payload/security_and_analysis.rs create mode 100644 src/models/webhook_events/payload/sponsorship.rs create mode 100644 src/models/webhook_events/payload/star.rs create mode 100644 src/models/webhook_events/payload/status.rs create mode 100644 src/models/webhook_events/payload/team.rs create mode 100644 src/models/webhook_events/payload/team_add.rs create mode 100644 src/models/webhook_events/payload/watch.rs create mode 100644 src/models/webhook_events/payload/workflow_dispatch.rs create mode 100644 src/models/webhook_events/payload/workflow_job.rs create mode 100644 src/models/webhook_events/payload/workflow_run.rs create mode 100644 tests/resources/installation_created_webhook_event.json create mode 100644 tests/resources/installation_deleted_webhook_event.json create mode 100644 tests/resources/installation_repositories_removed_webhook_event.json create mode 100644 tests/resources/issue_comment_created_webhook_event.json create mode 100644 tests/resources/issue_comment_deleted_webhook_event.json create mode 100644 tests/resources/issue_comment_edited_webhook_event.json create mode 100644 tests/resources/issues_labeled_webhook_event.json create mode 100644 tests/resources/issues_opened_webhook_event.json create mode 100644 tests/resources/ping_webhook_event.json create mode 100644 tests/resources/pull_request_closed_webhook_event.json create mode 100644 tests/resources/pull_request_opened_webhook_event.json create mode 100644 tests/resources/pull_request_synchronize_webhook_event.json create mode 100644 tests/resources/repository_deleted_webhook_event.json diff --git a/src/models.rs b/src/models.rs index 798a1de3..dc0e4da0 100644 --- a/src/models.rs +++ b/src/models.rs @@ -22,6 +22,7 @@ pub mod reactions; pub mod repos; pub mod teams; pub mod timelines; +pub mod webhook_events; pub mod workflows; pub use apps::App; @@ -105,6 +106,7 @@ id_type!( IssueEventId, IssueId, JobId, + HookId, LabelId, MilestoneId, NotificationId, diff --git a/src/models/events.rs b/src/models/events.rs index 79b26a4e..0b623a95 100644 --- a/src/models/events.rs +++ b/src/models/events.rs @@ -15,10 +15,6 @@ use serde::{de::Error, Deserialize, Serialize}; use url::Url; /// A GitHub event. -/// -/// If you want to deserialize a webhook payload received in a Github Application, you -/// must directly deserialize the body into a [`WrappedEventPayload`](WrappedEventPayload). -/// For webhooks, the event type is stored in the `X-GitHub-Event` header. #[derive(Debug, Clone, PartialEq, Serialize)] #[non_exhaustive] pub struct Event { diff --git a/src/models/reactions.rs b/src/models/reactions.rs index cc49c14d..04e09071 100644 --- a/src/models/reactions.rs +++ b/src/models/reactions.rs @@ -1,6 +1,6 @@ use super::*; -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[derive(Debug, Clone, Hash, PartialEq, Eq, Serialize, Deserialize)] pub enum ReactionContent { #[serde(rename = "heart")] Heart, diff --git a/src/models/webhook_events.rs b/src/models/webhook_events.rs new file mode 100644 index 00000000..221b7156 --- /dev/null +++ b/src/models/webhook_events.rs @@ -0,0 +1,810 @@ +mod payload; + +use super::{orgs::Organization, Author, Installation, InstallationId, Repository, RepositoryId}; +use serde::{Deserialize, Serialize}; + +pub use payload::WebhookEventPayload; + +/// A GitHub event. +#[derive(Debug, Clone, PartialEq, Serialize)] +#[non_exhaustive] +pub struct WebhookEvent { + pub sender: Author, + pub repository: Option, + pub organization: Option, + pub installation: EventInstallation, + #[serde(skip)] + pub kind: WebhookEventType, + #[serde(flatten)] + pub specific: WebhookEventPayload, +} + +impl WebhookEvent { + pub fn try_from_header_and_body(header: &H, body: &B) -> Result + where + H: AsRef<[u8]>, + B: AsRef<[u8]>, + { + let kind = serde_json::from_slice::(header.as_ref())?; + + // Intermediate structure allows to separate the common fields from + // the event specific one. + #[derive(Deserialize)] + struct Intermediate { + sender: Author, + repository: Option, + organization: Option, + installation: EventInstallation, + #[serde(flatten)] + specific: serde_json::Value, + } + + let Intermediate { + sender, + repository, + organization, + installation, + specific, + } = serde_json::from_slice::(body.as_ref())?; + + let specific = kind.parse_specific_payload(specific)?; + + Ok(Self { + sender, + repository, + organization, + installation, + kind, + specific, + }) + } +} + +#[derive(Debug, Clone, Copy, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] +#[serde(rename_all = "snake_case")] +pub enum WebhookEventType { + /// This event occurs when there is activity relating to branch protection rules. For more information, see "About protected branches." For information about the APIs to manage branch protection rules, see the GraphQL documentation or "Branch protection" in the REST API documentation. + /// + /// To subscribe to this event, a GitHub App must have at least read-level access for the "Administration" repository permission + BranchProtectionRule, + /// This event occurs when there is activity relating to a check run. For information about check runs, see "Getting started with the Checks API." For information about the APIs to manage check runs, see the GraphQL API documentation or "Check Runs" in the REST API documentation. + /// + /// For activity relating to check suites, use the check-suite event. + /// + /// To subscribe to this event, a GitHub App must have at least read-level access for the "Checks" repository permission. To receive the rerequested and requested_action event types, the app must have at least write-level access for the "Checks" permission. GitHub Apps with write-level access for the "Checks" permission are automatically subscribed to this webhook event. + /// + /// Repository and organization webhooks only receive payloads for the created and completed event types in repositories. + /// + /// Note: The API only looks for pushes in the repository where the check run was created. Pushes to a branch in a forked repository are not detected and return an empty pull_requests array and a null value for head_branch. + CheckRun, + /// This event occurs when there is activity relating to a check suite. For information about check suites, see "Getting started with the Checks API." For information about the APIs to manage check suites, see the GraphQL API documentation or "Check Suites" in the REST API documentation. + /// + /// For activity relating to check runs, use the check_run event. + /// + /// To subscribe to this event, a GitHub App must have at least read-level access for the "Checks" permission. To receive the requested and rerequested event types, the app must have at lease write-level access for the "Checks" permission. GitHub Apps with write-level access for the "Checks" permission are automatically subscribed to this webhook event. + /// + /// Repository and organization webhooks only receive payloads for the completed event types in repositories. + /// + /// Note: The API only looks for pushes in the repository where the check suite was created. Pushes to a branch in a forked repository are not detected and return an empty pull_requests array and a null value for head_branch. + CheckSuite, + /// This event occurs when there is activity relating to code scanning alerts in a repository. For more information, see "About code scanning" and "About code scanning alerts." For information about the API to manage code scanning, see "Code scanning" in the REST API documentation. + /// + /// To subscribe to this event, a GitHub App must have at least read-level access for the "Code scanning alerts" repository permission. + CodeScanningAlert, + /// This event occurs when there is activity relating to commit comments. For more information about commit comments, see "Commenting on a pull request." For information about the APIs to manage commit comments, see the GraphQL API documentation or "Commit comments" in the REST API documentation. + /// + /// For activity relating to comments on pull request reviews, use the pull_request_review_comment event. For activity relating to issue comments, use the issue_comment event. For activity relating to discussion comments, use the discussion_comment event. + /// + /// To subscribe to this event, a GitHub App must have at least read-level access for the "Contents" repository permission. + CommitComment, + /// This event occurs when a Git branch or tag is created. + /// + /// To subscribe to this event, a GitHub App must have at least read-level access for the "Contents" repository permission. + /// + /// Note: This event will not occur when more than three tags are created at once. + Create, + /// This event occurs when a Git branch or tag is deleted. + /// + /// To subscribe to this event, a GitHub App must have at least read-level access for the "Contents" repository permission. + /// + /// Note: This event will not occur when more than three tags are deleted at once. + Delete, + /// This event occurs when there is activity relating to Dependabot alerts. + /// + /// For more information about Dependabot alerts, see "About Dependabot alerts." For information about the API to manage Dependabot alerts, see "Dependabot alerts" in the REST API documentation. + /// + /// To subscribe to this event, a GitHub App must have at least read-level access for the "Dependabot alerts" repository permission. + /// + /// Note: Webhook events for Dependabot alerts are currently in beta and subject to change. + DependabotAlert, + /// This event occurs when there is activity relating to deploy keys. For more information, see "Managing deploy keys." For information about the APIs to manage deploy keys, see the GraphQL API documentation or "Deploy keys" in the REST API documentation. + /// + /// To subscribe to this event, a GitHub App must have at least read-level access for the "Deployments" repository permission. + DeployKey, + /// This event occurs when there is activity relating to deployments. For more information, see "About deployments." For information about the APIs to manage deployments, see the GraphQL API documentation or "Deployments" in the REST API documentation. + /// + /// For activity relating to deployment status, use the deployment_status event. + /// + /// To subscribe to this event, a GitHub App must have at least read-level access for the "Deployments" repository permission. + Deployment, + /// This event occurs when there is activity relating to deployment protection rules. For more information, see "Using environments for deployment." For information about the API to manage deployment protection rules, see the REST API documentation. + /// + /// To subscribe to this event, a GitHub App must have at least read-level access for the "Deployments" repository permission. + DeploymentProtectionRule, + /// This event occurs when there is activity relating to deployment statuses. For more information, see "About deployments." For information about the APIs to manage deployments, see the GraphQL API documentation or "Deployments" in the REST API documentation. + /// + /// For activity relating to deployment creation, use the deployment event. + /// + /// To subscribe to this event, a GitHub App must have at least read-level access for the "Deployments" repository permission. + DeploymentStatus, + /// This event occurs when there is activity relating to a discussion. For more information about discussions, see "GitHub Discussions." For information about the API to manage discussions, see the GraphQL documentation. + /// + /// For activity relating to a comment on a discussion, use the discussion_comment event. + /// + /// To subscribe to this event, a GitHub App must have at least read-level access for the "Discussions" repository permission. + /// + /// Note: Webhook events for GitHub Discussions are currently in beta and subject to change. + Discussion, + /// This event occurs when there is activity relating to a comment on a discussion. For more information about discussions, see "GitHub Discussions." For information about the API to manage discussions, see the GraphQL documentation. + /// + /// For activity relating to a discussion as opposed to comments on a discussion, use the discussion event. + /// + /// To subscribe to this event, a GitHub App must have at least read-level access for the "Discussions" repository permission. + /// + /// Note: Webhook events for GitHub Discussions are currently in beta and subject to change. + DiscussionComment, + /// This event occurs when someone forks a repository. For more information, see "Fork a repo." For information about the API to manage forks, see "Forks" in the REST API documentation. + /// + /// To subscribe to this event, a GitHub App must have at least read-level access for the "Contents" repository permission. + Fork, + /// This event occurs when a user revokes their authorization of a GitHub App. For more information, see "About apps." For information about the API to manage GitHub Apps, see the GraphQL API documentation or "Apps" in the REST API documentation. + /// + /// A GitHub App receives this webhook by default and cannot unsubscribe from this event. + /// + /// Anyone can revoke their authorization of a GitHub App from their GitHub account settings page. Revoking the authorization of a GitHub App does not uninstall the GitHub App. You should program your GitHub App so that when it receives this webhook, it stops calling the API on behalf of the person who revoked the token. If your GitHub App continues to use a revoked access token, it will receive the 401 Bad Credentials error. For details about requests with a user access token, which require GitHub App authorization, see "Authenticating with a GitHub App on behalf of a user." + GithubAppAuthorization, + /// This event occurs when someone creates or updates a wiki page. For more information, see "About wikis." + /// + /// To subscribe to this event, a GitHub App must have at least read-level access for the "Contents" repository permission. + Gollum, + /// This event occurs when there is activity relating to a GitHub App installation. All GitHub Apps receive this event by default. You cannot manually subscribe to this event. + /// + /// For more information about GitHub Apps, see "About apps." For information about the APIs to manage GitHub Apps, see the GraphQL API documentation or "Apps" in the REST API documentation. + Installation, + /// This event occurs when there is activity relating to which repositories a GitHub App installation can access. All GitHub Apps receive this event by default. You cannot manually subscribe to this event. + /// + /// For more information about GitHub Apps, see "About apps." For information about the APIs to manage GitHub Apps, see the GraphQL API documentation or "Apps" in the REST API documentation. + InstallationRepositories, + /// This event occurs when there is activity relating to the user or organization account that a GitHub App is installed on. For more information, see "About apps." For information about the APIs to manage GitHub Apps, see the GraphQL API documentation or "Apps" in the REST API documentation. + InstallationTarget, + /// This event occurs when there is activity relating to a comment on an issue or pull request. For more information about issues and pull requests, see "About issues" and "About pull requests." For information about the APIs to manage issue comments, see the GraphQL documentation or "Issue comments" in the REST API documentation. + /// + /// For activity relating to an issue as opposed to comments on an issue, use the issue event. For activity related to pull request reviews or pull request review comments, use the pull_request_review or pull_request_review_comment events. For more information about the different types of pull request comments, see "Working with comments." + /// + /// To subscribe to this event, a GitHub App must have at least read-level access for the "Issues" repository permission. + IssueComment, + /// This event occurs when there is activity relating to an issue. For more information about issues, see "About issues." For information about the APIs to manage issues, see the GraphQL documentation or "Issues" in the REST API documentation. + /// + /// For activity relating to a comment on an issue, use the issue_comment event. + /// + /// To subscribe to this event, a GitHub App must have at least read-level access for the "Issues" repository permission. + Issues, + /// This event occurs when there is activity relating to labels. For more information, see "Managing labels." For information about the APIs to manage labels, see the GraphQL documentation or "Labels" in the REST API documentation. + /// + /// If you want to receive an event when a label is added to or removed from an issue, pull request, or discussion, use the labeled or unlabeled action type for the issues, pull_request, or discussion events instead. + /// + /// To subscribe to this event, a GitHub App must have at least read-level access for the "Metadata" repository permission. + Label, + /// This event occurs when there is activity relating to a GitHub Marketplace purchase. For more information, see "GitHub Marketplace." For information about the APIs to manage GitHub Marketplace listings, see the GraphQL documentation or "GitHub Marketplace" in the REST API documentation. + MarketplacePurchase, + /// This event occurs when there is activity relating to collaborators in a repository. For more information, see "Adding outside collaborators to repositories in your organization." For more information about the API to manage repository collaborators, see the GraphQL API documentation or "Collaborators" in the REST API documentation. + /// + /// To subscribe to this event, a GitHub App must have at least read-level access for the "Members" organization permission. + Member, + /// This event occurs when there is activity relating to team membership. For more information, see "About teams." For more information about the APIs to manage team memberships, see the GraphQL API documentation or "Team members" in the REST API documentation. + /// + /// To subscribe to this event, a GitHub App must have at least read-level access for the "Members" organization permission. + Membership, + /// This event occurs when there is activity relating to a merge group in a merge queue. For more information, see "Managing a merge queue." + /// + /// To subscribe to this event, a GitHub App must have at least read-level access for the "Merge queues" repository permission. + MergeGroup, + /// This event occurs when there is activity relating to a webhook itself. + /// + /// To subscribe to this event, a GitHub App must have at least read-level access for the "Meta" app permission. + Meta, + /// This event occurs when there is activity relating to milestones. For more information, see "About milestones." For information about the APIs to manage milestones, see the GraphQL documentation or "Milestones" in the REST API documentation. + /// + /// If you want to receive an event when an issue or pull request is added to or removed from a milestone, use the milestoned or demilestoned action type for the issues or pull_request events instead. + /// + /// To subscribe to this event, a GitHub App must have at least read-level access for the "Issues" or "Pull requests" repository permissions. + Milestone, + /// This event occurs when organization owners or moderators block or unblock a non-member from collaborating on the organization's repositories. For more information, see "Blocking a user from your organization." For information about the APIs to manage blocked users, see the GraphQL documentation or "Blocking users" in the REST API documentation. + /// + /// If you want to receive an event when members are added or removed from an organization, use the organization event instead. + /// + /// To subscribe to this event, a GitHub App must have at least read-level access for the "Administration" organization permission. + OrgBlock, + /// This event occurs when there is activity relating to an organization and its members. For more information, see "About organizations." For information about the APIs to manage organizations, see the GraphQL documentation or "Organizations" in the REST API documentation. + /// + /// If you want to receive an event when a non-member is blocked or unblocked from an organization, use the org_block event instead. + /// + /// To subscribe to this event, a GitHub App must have at least read-level access for the "Members" organization permission. + Organization, + /// This event occurs when there is activity relating to GitHub Packages. For more information, see "Introduction to GitHub Packages." For information about the APIs to manage GitHub Packages, see the GraphQL API documentation or "Packages" in the REST API documentation. + /// + /// To install this event on a GitHub App, the app must have at least read-level access for the "Packages" repository permission. + Package, + /// This event occurs when there is an attempted build of a GitHub Pages site. This event occurs regardless of whether the build is successful. For more information, see "Configuring a publishing source for your GitHub Pages site." For information about the API to manage GitHub Pages, see "Pages" in the REST API documentation. + /// + /// To subscribe to this event, a GitHub App must have at least read-level access for the "Pages" repository permission. + PageBuild, + /// This event occurs when there is activity relating to a request for a fine-grained personal access token to access resources that belong to a resource owner that requires approval for token access. For more information, see "Creating a personal access token." + /// + /// To subscribe to this event, a GitHub App must have at least read-level access for the "Personal access token requests" organization permission. + /// + /// Note: Fine-grained PATs are in public beta. Related APIs, events, and functionality are subject to change. + PersonalAccessTokenRequest, + /// This event occurs when you create a new webhook. The ping event is a confirmation from GitHub that you configured the webhook correctly. + Ping, + /// This event occurs when there is activity relating to a card on a classic project. For more information, see "About projects (classic)." For information about the API to manage classic projects, see the GraphQL API documentation or "Projects (classic)" in the REST API documentation. + /// + /// For activity relating to a project or a column on a project, use the project and project_column event. For activity relating to Projects instead of Projects (classic), use the projects_v2 event instead. + /// + /// To subscribe to this event, a GitHub App must have at least read-level access for the "Projects" repository or organization permission. + ProjectCard, + /// This event occurs when there is activity relating to a classic project. For more information, see "About projects (classic)." For information about the API to manage classic projects, see the GraphQL API documentation or "Projects (classic)" in the REST API documentation. + /// + /// For activity relating to a card or column on a project, use the project_card and project_column event. For activity relating to Projects instead of Projects (classic), use the projects_v2 event instead. + /// + /// To subscribe to this event, a GitHub App must have at least read-level access for the "Projects" repository or organization permission. + Project, + /// This event occurs when there is activity relating to a column on a classic project. For more information, see "About projects (classic)." For information about the API to manage classic projects, see the GraphQL API documentation or "Projects (classic)" in the REST API documentation. + /// + /// For activity relating to a project or a card on a project, use the project and project_card event. For activity relating to Projects instead of Projects (classic), use the projects_v2 event instead. + /// + /// To subscribe to this event, a GitHub App must have at least read-level access for the "Projects" repository or organization permission. + ProjectColumn, + /// This event occurs when there is activity relating to an organization-level project. For more information, see "About Projects." For information about the Projects API, see the GraphQL documentation. + /// + /// For activity relating to a item on a project, use the projects_v2_item event. For activity relating to Projects (classic), use the project, project_card, and project_column` events instead. + /// + /// To subscribe to this event, a GitHub App must have at least read-level access for the "Projects" organization permission. + /// + /// Note: Webhook events for projects are currently in beta and subject to change. To share feedback about projects webhooks with GitHub, see the Projects webhook feedback discussion. + ProjectsV2, + /// This event occurs when there is activity relating to an item on an organization-level project. For more information, see "About Projects." For information about the Projects API, see the GraphQL documentation. + /// + /// For activity relating to a project (instead of an item on a project), use the projects_v2 event. For activity relating to Projects (classic), use the project, project_card, and project_column events instead. + /// + /// To subscribe to this event, a GitHub App must have at least read-level access for the "Projects" organization permission. + /// + /// Note: Webhook events for projects are currently in beta and subject to change. To share feedback about projects webhooks with GitHub, see the Projects webhook feedback discussion. + ProjectsV2Item, + /// This event occurs when repository visibility changes from private to public. For more information, see "Setting repository visibility." + /// + /// To subscribe to this event, a GitHub App must have at least read-level access for the "Metadata" repository permission. + Public, + /// This event occurs when there is activity on a pull request. For more information, see "About pull requests." For information about the APIs to manage pull requests, see the GraphQL API documentation or "Pulls" in the REST API documentation. + /// + /// For activity related to pull request reviews, pull request review comments, pull request comments, or pull request review threads, use the pull_request_review, pull_request_review_comment, issue_comment, or pull_request_review_thread events instead. + /// + /// To subscribe to this event, a GitHub App must have at least read-level access for the "Pull requests" repository permission. + PullRequest, + /// This event occurs when there is activity relating to a pull request review. A pull request review is a group of pull request review comments in addition to a body comment and a state. For more information, see "About pull request reviews." For information about the APIs to manage pull request reviews, see the GraphQL API documentation or "Pull request reviews" in the REST API documentation. + /// + /// For activity related to pull request review comments, pull request comments, or pull request review threads, use the pull_request_review_comment, issue_comment, or pull_request_review_thread events instead. + /// + /// To subscribe to this event, a GitHub App must have at least read-level access for the "Pull requests" repository permission. + PullRequestReview, + /// This event occurs when there is activity relating to a pull request review comment. A pull request review comment is a comment on a pull request's diff. For more information, see "Commenting on a pull request." For information about the APIs to manage pull request review comments, see the GraphQL API documentation or "Pull request review comments" in the REST API documentation. + /// + /// For activity related to pull request reviews, pull request comments, or pull request review threads, use the pull_request_review, issue_comment, or pull_request_review_thread events instead. + /// + /// To subscribe to this event, a GitHub App must have at least read-level access for the "Pull requests" repository permission. + PullRequestReviewComment, + /// This event occurs when there is activity relating to a comment thread on a pull request. For more information, see "About pull request reviews." For information about the APIs to manage pull request review comment threads, see the GraphQL API documentation or "Pull request reviews" in the REST API documentation. + /// + /// For activity related to pull request review comments, pull request comments, or pull request reviews, use the pull_request_review_comment, issue_comment, or pull_request_review events instead. + /// + /// To subscribe to this event, a GitHub App must have at least read-level access for the "Pull requests" repository permission. + PullRequestReviewThread, + /// This event occurs when a commit or tag is pushed. + /// + /// To subscribe to this event, a GitHub App must have at least read-level access for the "Contents" repository permission. + /// + /// Note: An event will not be created when more than three tags are pushed at once. + Push, + /// This event occurs when there is activity relating to GitHub Packages. For more information, see "Introduction to GitHub Packages." For information about the APIs to manage GitHub Packages, see the GraphQL API documentation or "Packages" in the REST API documentation. + /// + /// To install this event on a GitHub App, the app must have at least read-level access for the "Packages" repository permission. + /// + /// Note: GitHub recommends that you use the newer package event instead. + RegistryPackage, + /// This event occurs when there is activity relating to releases. For more information, see "About releases." For information about the APIs to manage releases, see the GraphQL API documentation or "Releases" in the REST API documentation. + /// + /// To subscribe to this event, a GitHub App must have at least read-level access for the "Contents" repository permission. + Release, + /// This event occurs when there is activity relating to a repository security advisory. For more information about repository security advisories, see "About GitHub Security Advisories for repositories." + /// + /// To subscribe to this event, a GitHub App must have at least read-level access for the "Repository security advisories" permission. + RepositoryAdvisory, + /// This event occurs when there is activity relating to repositories. For more information, see "About repositories." For information about the APIs to manage repositories, see the GraphQL documentation or "Repositories" in the REST API documentation. + /// + /// To subscribe to this event, a GitHub App must have at least read-level access for the "Metadata" repository permission. + Repository, + /// This event occurs when a GitHub App sends a POST request to /repos/{owner}/{repo}/dispatches. For more information, see the REST API documentation for creating a repository dispatch event. + /// + /// To subscribe to this event, a GitHub App must have at least read-level access for the "Contents" repository permission. + RepositoryDispatch, + /// This event occurs when a repository is imported to GitHub. For more information, see "Importing a repository with GitHub Importer." For more information about the API to manage imports, see the REST API documentation. + RepositoryImport, + /// This event occurs when there is activity relating to a security vulnerability alert in a repository. + /// + /// Note: This event is deprecated. Use the dependabot_alert event instead. + RepositoryVulnerabilityAlert, + /// This event occurs when there is activity relating to a secret scanning alert. For more information about secret scanning, see "About secret scanning." For information about the API to manage secret scanning alerts, see "Secret scanning" in the REST API documentation. + /// + /// For activity relating to secret scanning alert locations, use the secret_scanning_alert_location event. + /// + /// To subscribe to this event, a GitHub App must have at least read-level access for the "Secret scanning alerts" repository permission. + SecretScanningAlert, + /// This event occurs when there is activity relating to the locations of a secret in a secret scanning alert. + /// + /// For more information about secret scanning, see "About secret scanning." For information about the API to manage secret scanning alerts, see "Secret scanning" in the REST API documentation. + /// + /// For activity relating to secret scanning alerts, use the secret_scanning_alert event. + /// + /// To subscribe to this event, a GitHub App must have at least read-level access for the "Secret scanning alerts" repository permission. + SecretScanningAlertLocation, + /// This event occurs when there is activity relating to a security advisory that was reviewed by GitHub. A GitHub-reviewed security advisory provides information about security-related vulnerabilities in software on GitHub. For more information about security advisories, see "About GitHub Security Advisories for repositories." For information about the API to manage security advisories, see the GraphQL documentation. + /// + /// GitHub Dependabot alerts are also powered by the security advisory dataset. For more information, see "About Dependabot alerts." + SecurityAdvisory, + /// This event occurs when code security and analysis features are enabled or disabled for a repository. For more information, see "GitHub security features." + /// + /// To subscribe to this event, a GitHub App must have at least read-level access for the "Administration" repository permission. + SecurityAndAnalysis, + /// This event occurs when there is activity relating to a sponsorship listing. For more information, see "About GitHub Sponsors." For information about the API to manage sponsors, see the GraphQL documentation. + /// + /// You can only create a sponsorship webhook on GitHub.com. For more information, see "Configuring webhooks for events in your sponsored account." + Sponsorship, + /// This event occurs when there is activity relating to repository stars. For more information about stars, see "Saving repositories with stars." For information about the APIs to manage stars, see the GraphQL documentation or "Starring" in the REST API documentation. + /// + /// To subscribe to this event, a GitHub App must have at least read-level access for the "Metadata" repository permission. + Star, + /// This event occurs when the status of a Git commit changes. For example, commits can be marked as error, failure, pending, or success. For more information, see "About status checks." For information about the APIs to manage commit statuses, see the GraphQL documentation or "Statuses" in the REST API documentation. + /// + /// To subscribe to this event, a GitHub App must have at least read-level access for the "Commit statuses" repository permission. + Status, + /// This event occurs when a team is added to a repository. For more information, see "Managing teams and people with access to your repository." + /// + /// For activity relating to teams, see the teams event. + /// + /// To subscribe to this event, a GitHub App must have at least read-level access for the "Members" organization permission. + TeamAdd, + /// This event occurs when there is activity relating to teams in an organization. For more information, see "About teams." + /// + /// To subscribe to this event, a GitHub App must have at least read-level access for the "Members" organization permission. + Team, + /// This event occurs when there is activity relating to watching, or subscribing to, a repository. For more information about watching, see "Managing your subscriptions." For information about the APIs to manage watching, see "Watching" in the REST API documentation. + /// + /// To subscribe to this event, a GitHub App must have at least read-level access for the "Metadata" repository permission. + Watch, + /// This event occurs when a GitHub Actions workflow is manually triggered. For more information, see "Manually running a workflow." + /// + /// For activity relating to workflow runs, use the workflow_run event. + /// + /// To subscribe to this event, a GitHub App must have at least read-level access for the "Contents" repository permission. + WorkflowDispatch, + /// This event occurs when there is activity relating to a job in a GitHub Actions workflow. For more information, see "Using jobs in a workflow." For information about the API to manage workflow jobs, see "Workflow jobs" in the REST API documentation. + /// + /// For activity relating to a workflow run instead of a job in a workflow run, use the workflow_run event. + /// + /// To subscribe to this event, a GitHub App must have at least read-level access for the "Actions" repository permission. + WorkflowJob, + /// This event occurs when there is activity relating to a run of a GitHub Actions workflow. For more information, see "About workflows." For information about the APIs to manage workflow runs, see the GraphQL documentation or "Workflow runs" in the REST API documentation. + /// + /// For activity relating to a job in a workflow run, use the workflow_job event. + /// + /// To subscribe to this event, a GitHub App must have at least read-level access for the "Actions" repository permission. + WorkflowRun, +} + +impl WebhookEventType { + /// Parse (and verify) the payload for the specific event kind. + pub fn parse_specific_payload( + self, + data: serde_json::Value, + ) -> Result { + match self { + WebhookEventType::BranchProtectionRule => { + Ok(WebhookEventPayload::BranchProtectionRuleWebhookEvent( + Box::new(serde_json::from_value(data)?), + )) + } + WebhookEventType::CheckRun => Ok(WebhookEventPayload::CheckRunWebhookEvent(Box::new( + serde_json::from_value(data)?, + ))), + WebhookEventType::CheckSuite => Ok(WebhookEventPayload::CheckSuiteWebhookEvent( + Box::new(serde_json::from_value(data)?), + )), + WebhookEventType::CodeScanningAlert => { + Ok(WebhookEventPayload::CodeScanningAlertWebhookEvent( + Box::new(serde_json::from_value(data)?), + )) + } + WebhookEventType::CommitComment => Ok(WebhookEventPayload::CommitCommentWebhookEvent( + Box::new(serde_json::from_value(data)?), + )), + WebhookEventType::Create => Ok(WebhookEventPayload::CreateWebhookEvent(Box::new( + serde_json::from_value(data)?, + ))), + WebhookEventType::Delete => Ok(WebhookEventPayload::DeleteWebhookEvent(Box::new( + serde_json::from_value(data)?, + ))), + WebhookEventType::DependabotAlert => { + Ok(WebhookEventPayload::DependabotAlertWebhookEvent(Box::new( + serde_json::from_value(data)?, + ))) + } + WebhookEventType::DeployKey => Ok(WebhookEventPayload::DeployKeyWebhookEvent( + Box::new(serde_json::from_value(data)?), + )), + WebhookEventType::Deployment => Ok(WebhookEventPayload::DeploymentWebhookEvent( + Box::new(serde_json::from_value(data)?), + )), + WebhookEventType::DeploymentProtectionRule => { + Ok(WebhookEventPayload::DeploymentProtectionRuleWebhookEvent( + Box::new(serde_json::from_value(data)?), + )) + } + WebhookEventType::DeploymentStatus => { + Ok(WebhookEventPayload::DeploymentStatusWebhookEvent(Box::new( + serde_json::from_value(data)?, + ))) + } + WebhookEventType::Discussion => Ok(WebhookEventPayload::DiscussionWebhookEvent( + Box::new(serde_json::from_value(data)?), + )), + WebhookEventType::DiscussionComment => { + Ok(WebhookEventPayload::DiscussionCommentWebhookEvent( + Box::new(serde_json::from_value(data)?), + )) + } + WebhookEventType::Fork => Ok(WebhookEventPayload::ForkWebhookEvent(Box::new( + serde_json::from_value(data)?, + ))), + WebhookEventType::GithubAppAuthorization => { + Ok(WebhookEventPayload::GithubAppAuthorizationWebhookEvent( + Box::new(serde_json::from_value(data)?), + )) + } + WebhookEventType::Gollum => Ok(WebhookEventPayload::GollumWebhookEvent(Box::new( + serde_json::from_value(data)?, + ))), + WebhookEventType::Installation => Ok(WebhookEventPayload::InstallationWebhookEvent( + Box::new(serde_json::from_value(data)?), + )), + WebhookEventType::InstallationRepositories => { + Ok(WebhookEventPayload::InstallationRepositoriesWebhookEvent( + Box::new(serde_json::from_value(data)?), + )) + } + WebhookEventType::InstallationTarget => { + Ok(WebhookEventPayload::InstallationTargetWebhookEvent( + Box::new(serde_json::from_value(data)?), + )) + } + WebhookEventType::IssueComment => Ok(WebhookEventPayload::IssueCommentWebhookEvent( + Box::new(serde_json::from_value(data)?), + )), + WebhookEventType::Issues => Ok(WebhookEventPayload::IssuesWebhookEvent(Box::new( + serde_json::from_value(data)?, + ))), + WebhookEventType::Label => Ok(WebhookEventPayload::LabelWebhookEvent(Box::new( + serde_json::from_value(data)?, + ))), + WebhookEventType::MarketplacePurchase => { + Ok(WebhookEventPayload::MarketplacePurchaseWebhookEvent( + Box::new(serde_json::from_value(data)?), + )) + } + WebhookEventType::Member => Ok(WebhookEventPayload::MemberWebhookEvent(Box::new( + serde_json::from_value(data)?, + ))), + WebhookEventType::Membership => Ok(WebhookEventPayload::MembershipWebhookEvent( + Box::new(serde_json::from_value(data)?), + )), + WebhookEventType::MergeGroup => Ok(WebhookEventPayload::MergeGroupWebhookEvent( + Box::new(serde_json::from_value(data)?), + )), + WebhookEventType::Meta => Ok(WebhookEventPayload::MetaWebhookEvent(Box::new( + serde_json::from_value(data)?, + ))), + WebhookEventType::Milestone => Ok(WebhookEventPayload::MilestoneWebhookEvent( + Box::new(serde_json::from_value(data)?), + )), + WebhookEventType::OrgBlock => Ok(WebhookEventPayload::OrgBlockWebhookEvent(Box::new( + serde_json::from_value(data)?, + ))), + WebhookEventType::Organization => Ok(WebhookEventPayload::OrganizationWebhookEvent( + Box::new(serde_json::from_value(data)?), + )), + WebhookEventType::Package => Ok(WebhookEventPayload::PackageWebhookEvent(Box::new( + serde_json::from_value(data)?, + ))), + WebhookEventType::PageBuild => Ok(WebhookEventPayload::PageBuildWebhookEvent( + Box::new(serde_json::from_value(data)?), + )), + WebhookEventType::PersonalAccessTokenRequest => { + Ok(WebhookEventPayload::PersonalAccessTokenRequestWebhookEvent( + Box::new(serde_json::from_value(data)?), + )) + } + WebhookEventType::Ping => Ok(WebhookEventPayload::PingWebhookEvent(Box::new( + serde_json::from_value(data)?, + ))), + WebhookEventType::ProjectCard => Ok(WebhookEventPayload::ProjectCardWebhookEvent( + Box::new(serde_json::from_value(data)?), + )), + WebhookEventType::Project => Ok(WebhookEventPayload::ProjectWebhookEvent(Box::new( + serde_json::from_value(data)?, + ))), + WebhookEventType::ProjectColumn => Ok(WebhookEventPayload::ProjectColumnWebhookEvent( + Box::new(serde_json::from_value(data)?), + )), + WebhookEventType::ProjectsV2 => Ok(WebhookEventPayload::ProjectsV2WebhookEvent( + Box::new(serde_json::from_value(data)?), + )), + WebhookEventType::ProjectsV2Item => { + Ok(WebhookEventPayload::ProjectsV2ItemWebhookEvent(Box::new( + serde_json::from_value(data)?, + ))) + } + WebhookEventType::Public => Ok(WebhookEventPayload::PublicWebhookEvent(Box::new( + serde_json::from_value(data)?, + ))), + WebhookEventType::PullRequest => Ok(WebhookEventPayload::PullRequestWebhookEvent( + Box::new(serde_json::from_value(data)?), + )), + WebhookEventType::PullRequestReview => { + Ok(WebhookEventPayload::PullRequestReviewWebhookEvent( + Box::new(serde_json::from_value(data)?), + )) + } + WebhookEventType::PullRequestReviewComment => { + Ok(WebhookEventPayload::PullRequestReviewCommentWebhookEvent( + Box::new(serde_json::from_value(data)?), + )) + } + WebhookEventType::PullRequestReviewThread => { + Ok(WebhookEventPayload::PullRequestReviewThreadWebhookEvent( + Box::new(serde_json::from_value(data)?), + )) + } + WebhookEventType::Push => Ok(WebhookEventPayload::PushWebhookEvent(Box::new( + serde_json::from_value(data)?, + ))), + WebhookEventType::RegistryPackage => { + Ok(WebhookEventPayload::RegistryPackageWebhookEvent(Box::new( + serde_json::from_value(data)?, + ))) + } + WebhookEventType::Release => Ok(WebhookEventPayload::ReleaseWebhookEvent(Box::new( + serde_json::from_value(data)?, + ))), + WebhookEventType::RepositoryAdvisory => { + Ok(WebhookEventPayload::RepositoryAdvisoryWebhookEvent( + Box::new(serde_json::from_value(data)?), + )) + } + WebhookEventType::Repository => Ok(WebhookEventPayload::RepositoryWebhookEvent( + Box::new(serde_json::from_value(data)?), + )), + WebhookEventType::RepositoryDispatch => { + Ok(WebhookEventPayload::RepositoryDispatchWebhookEvent( + Box::new(serde_json::from_value(data)?), + )) + } + WebhookEventType::RepositoryImport => { + Ok(WebhookEventPayload::RepositoryImportWebhookEvent(Box::new( + serde_json::from_value(data)?, + ))) + } + WebhookEventType::RepositoryVulnerabilityAlert => Ok( + WebhookEventPayload::RepositoryVulnerabilityAlertWebhookEvent(Box::new( + serde_json::from_value(data)?, + )), + ), + WebhookEventType::SecretScanningAlert => { + Ok(WebhookEventPayload::SecretScanningAlertWebhookEvent( + Box::new(serde_json::from_value(data)?), + )) + } + WebhookEventType::SecretScanningAlertLocation => Ok( + WebhookEventPayload::SecretScanningAlertLocationWebhookEvent(Box::new( + serde_json::from_value(data)?, + )), + ), + WebhookEventType::SecurityAdvisory => { + Ok(WebhookEventPayload::SecurityAdvisoryWebhookEvent(Box::new( + serde_json::from_value(data)?, + ))) + } + WebhookEventType::SecurityAndAnalysis => { + Ok(WebhookEventPayload::SecurityAndAnalysisWebhookEvent( + Box::new(serde_json::from_value(data)?), + )) + } + WebhookEventType::Sponsorship => Ok(WebhookEventPayload::SponsorshipWebhookEvent( + Box::new(serde_json::from_value(data)?), + )), + WebhookEventType::Star => Ok(WebhookEventPayload::StarWebhookEvent(Box::new( + serde_json::from_value(data)?, + ))), + WebhookEventType::Status => Ok(WebhookEventPayload::StatusWebhookEvent(Box::new( + serde_json::from_value(data)?, + ))), + WebhookEventType::TeamAdd => Ok(WebhookEventPayload::TeamAddWebhookEvent(Box::new( + serde_json::from_value(data)?, + ))), + WebhookEventType::Team => Ok(WebhookEventPayload::TeamWebhookEvent(Box::new( + serde_json::from_value(data)?, + ))), + WebhookEventType::Watch => Ok(WebhookEventPayload::WatchWebhookEvent(Box::new( + serde_json::from_value(data)?, + ))), + WebhookEventType::WorkflowDispatch => { + Ok(WebhookEventPayload::WorkflowDispatchWebhookEvent(Box::new( + serde_json::from_value(data)?, + ))) + } + WebhookEventType::WorkflowJob => Ok(WebhookEventPayload::WorkflowJobWebhookEvent( + Box::new(serde_json::from_value(data)?), + )), + WebhookEventType::WorkflowRun => Ok(WebhookEventPayload::WorkflowRunWebhookEvent( + Box::new(serde_json::from_value(data)?), + )), + } + } +} + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[serde(untagged)] +pub enum EventInstallation { + /// A full installation object which is present for `Installation*` related webhook events. + Full(Box), + /// The minimal installation object is present for all other event types. + Minimal(Box), +} + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +pub struct EventInstallationId { + pub id: InstallationId, + pub node_id: String, +} + +/// A repository in installation related webhook events. +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] +pub struct InstallationEventRepository { + pub id: RepositoryId, + pub node_id: String, + pub name: String, + pub full_name: String, + pub private: bool, +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn deserialize_installation_created() { + let json = include_str!("../../tests/resources/installation_created_webhook_event.json"); + let event = WebhookEventType::Installation + .parse_specific_payload(serde_json::from_str(json).unwrap()) + .unwrap(); + } + + #[test] + fn deserialize_installation_deleted() { + let json = include_str!("../../tests/resources/installation_deleted_webhook_event.json"); + let event = WebhookEventType::Installation + .parse_specific_payload(serde_json::from_str(json).unwrap()) + .unwrap(); + } + + #[test] + fn deserialize_installation_repositories_removed() { + let json = include_str!( + "../../tests/resources/installation_repositories_removed_webhook_event.json" + ); + let event = WebhookEventType::InstallationRepositories + .parse_specific_payload(serde_json::from_str(json).unwrap()) + .unwrap(); + } + + #[test] + fn deserialize_issue_comment_created() { + let json = include_str!("../../tests/resources/issue_comment_created_webhook_event.json"); + let event = WebhookEventType::IssueComment + .parse_specific_payload(serde_json::from_str(json).unwrap()) + .unwrap(); + } + + #[test] + fn deserialize_issue_comment_deleted() { + let json = include_str!("../../tests/resources/issue_comment_deleted_webhook_event.json"); + let event = WebhookEventType::IssueComment + .parse_specific_payload(serde_json::from_str(json).unwrap()) + .unwrap(); + } + + #[test] + fn deserialize_issue_comment_edited() { + let json = include_str!("../../tests/resources/issue_comment_edited_webhook_event.json"); + let event = WebhookEventType::IssueComment + .parse_specific_payload(serde_json::from_str(json).unwrap()) + .unwrap(); + } + + #[test] + fn deserialize_issues_labeled() { + let json = include_str!("../../tests/resources/issues_labeled_webhook_event.json"); + let event = WebhookEventType::Issues + .parse_specific_payload(serde_json::from_str(json).unwrap()) + .unwrap(); + } + + #[test] + fn deserialize_issues_opened() { + let json = include_str!("../../tests/resources/issues_opened_webhook_event.json"); + let event = WebhookEventType::Issues + .parse_specific_payload(serde_json::from_str(json).unwrap()) + .unwrap(); + } + + #[test] + fn deserialize_ping() { + let json = include_str!("../../tests/resources/ping_webhook_event.json"); + let event = WebhookEventType::Ping + .parse_specific_payload(serde_json::from_str(json).unwrap()) + .unwrap(); + } + + #[test] + fn deserialize_pull_request_closed() { + let json = include_str!("../../tests/resources/pull_request_closed_webhook_event.json"); + let event = WebhookEventType::PullRequest + .parse_specific_payload(serde_json::from_str(json).unwrap()) + .unwrap(); + } + + #[test] + fn deserialize_pull_request_opened() { + let json = include_str!("../../tests/resources/pull_request_opened_webhook_event.json"); + let event = WebhookEventType::PullRequest + .parse_specific_payload(serde_json::from_str(json).unwrap()) + .unwrap(); + } + + #[test] + fn deserialize_pull_request_synchronize() { + let json = + include_str!("../../tests/resources/pull_request_synchronize_webhook_event.json"); + let event = WebhookEventType::PullRequest + .parse_specific_payload(serde_json::from_str(json).unwrap()) + .unwrap(); + } + + #[test] + fn deserialize_repository_deleted() { + let json = include_str!("../../tests/resources/repository_deleted_webhook_event.json"); + let event = WebhookEventType::Repository + .parse_specific_payload(serde_json::from_str(json).unwrap()) + .unwrap(); + } +} diff --git a/src/models/webhook_events/payload.rs b/src/models/webhook_events/payload.rs new file mode 100644 index 00000000..80e1b73b --- /dev/null +++ b/src/models/webhook_events/payload.rs @@ -0,0 +1,196 @@ +mod branch_protection_rule; +mod check_run; +mod check_suite; +mod code_scanning_alert; +mod commit_comment; +mod create; +mod delete; +mod dependabot_alert; +mod deploy_key; +mod deployment; +mod deployment_protection_rule; +mod deployment_status; +mod discussion; +mod discussion_comment; +mod fork; +mod github_app_authorization; +mod gollum; +mod installation; +mod installation_repositories; +mod installation_target; +mod issue_comment; +mod issues; +mod label; +mod marketplace_purchase; +mod member; +mod membership; +mod merge_group; +mod meta; +mod milestone; +mod org_block; +mod organization; +mod package; +mod page_build; +mod personal_access_token_request; +mod ping; +mod project; +mod project_card; +mod project_column; +mod projects_v2; +mod projects_v2_item; +mod public; +mod pull_request; +mod pull_request_review; +mod pull_request_review_comment; +mod pull_request_review_thread; +mod push; +mod registry_package; +mod release; +mod repository; +mod repository_advisory; +mod repository_dispatch; +mod repository_import; +mod repository_vulnerability_alert; +mod secret_scanning_alert; +mod secret_scanning_alert_location; +mod security_advisory; +mod security_and_analysis; +mod sponsorship; +mod star; +mod status; +mod team; +mod team_add; +mod watch; +mod workflow_dispatch; +mod workflow_job; +mod workflow_run; + +pub use self::{ + branch_protection_rule::*, check_run::*, check_suite::*, code_scanning_alert::*, + commit_comment::*, create::*, delete::*, dependabot_alert::*, deploy_key::*, deployment::*, + deployment_protection_rule::*, deployment_status::*, discussion::*, discussion_comment::*, + fork::*, github_app_authorization::*, gollum::*, installation::*, installation_repositories::*, + installation_target::*, issue_comment::*, issues::*, label::*, marketplace_purchase::*, + member::*, membership::*, merge_group::*, meta::*, milestone::*, org_block::*, organization::*, + package::*, page_build::*, personal_access_token_request::*, ping::*, project::*, + project_card::*, project_column::*, projects_v2::*, projects_v2_item::*, public::*, + pull_request::*, pull_request_review::*, pull_request_review_comment::*, + pull_request_review_thread::*, push::*, registry_package::*, release::*, repository::*, + repository_advisory::*, repository_dispatch::*, repository_import::*, + repository_vulnerability_alert::*, secret_scanning_alert::*, secret_scanning_alert_location::*, + security_advisory::*, security_and_analysis::*, sponsorship::*, star::*, status::*, team::*, + team_add::*, watch::*, workflow_dispatch::*, workflow_job::*, workflow_run::*, +}; + +use serde::{Deserialize, Serialize}; + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] +pub enum WebhookEventPayload { + BranchProtectionRuleWebhookEvent(Box), + CheckRunWebhookEvent(Box), + CheckSuiteWebhookEvent(Box), + CodeScanningAlertWebhookEvent(Box), + CommitCommentWebhookEvent(Box), + CreateWebhookEvent(Box), + DeleteWebhookEvent(Box), + DependabotAlertWebhookEvent(Box), + DeployKeyWebhookEvent(Box), + DeploymentWebhookEvent(Box), + DeploymentProtectionRuleWebhookEvent(Box), + DeploymentStatusWebhookEvent(Box), + DiscussionWebhookEvent(Box), + DiscussionCommentWebhookEvent(Box), + ForkWebhookEvent(Box), + GithubAppAuthorizationWebhookEvent(Box), + GollumWebhookEvent(Box), + InstallationWebhookEvent(Box), + InstallationRepositoriesWebhookEvent(Box), + InstallationTargetWebhookEvent(Box), + IssueCommentWebhookEvent(Box), + IssuesWebhookEvent(Box), + LabelWebhookEvent(Box), + MarketplacePurchaseWebhookEvent(Box), + MemberWebhookEvent(Box), + MembershipWebhookEvent(Box), + MergeGroupWebhookEvent(Box), + MetaWebhookEvent(Box), + MilestoneWebhookEvent(Box), + OrgBlockWebhookEvent(Box), + OrganizationWebhookEvent(Box), + PackageWebhookEvent(Box), + PageBuildWebhookEvent(Box), + PersonalAccessTokenRequestWebhookEvent(Box), + PingWebhookEvent(Box), + ProjectCardWebhookEvent(Box), + ProjectWebhookEvent(Box), + ProjectColumnWebhookEvent(Box), + ProjectsV2WebhookEvent(Box), + ProjectsV2ItemWebhookEvent(Box), + PublicWebhookEvent(Box), + PullRequestWebhookEvent(Box), + PullRequestReviewWebhookEvent(Box), + PullRequestReviewCommentWebhookEvent(Box), + PullRequestReviewThreadWebhookEvent(Box), + PushWebhookEvent(Box), + RegistryPackageWebhookEvent(Box), + ReleaseWebhookEvent(Box), + RepositoryAdvisoryWebhookEvent(Box), + RepositoryWebhookEvent(Box), + RepositoryDispatchWebhookEvent(Box), + RepositoryImportWebhookEvent(Box), + RepositoryVulnerabilityAlertWebhookEvent(Box), + SecretScanningAlertWebhookEvent(Box), + SecretScanningAlertLocationWebhookEvent(Box), + SecurityAdvisoryWebhookEvent(Box), + SecurityAndAnalysisWebhookEvent(Box), + SponsorshipWebhookEvent(Box), + StarWebhookEvent(Box), + StatusWebhookEvent(Box), + TeamAddWebhookEvent(Box), + TeamWebhookEvent(Box), + WatchWebhookEvent(Box), + WorkflowDispatchWebhookEvent(Box), + WorkflowJobWebhookEvent(Box), + WorkflowRunWebhookEvent(Box), + UnknownWebhookEvent(Box), +} + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[serde(rename_all = "SCREAMING_SNAKE_CASE")] +#[non_exhaustive] +pub enum AuthorAssociation { + Collaborator, + Contributor, + FirstTimer, + FirstTimeContributor, + Mannequin, + Member, + None, + Owner, +} + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[serde(rename_all = "snake_case")] +#[non_exhaustive] +pub enum RefType { + Tag, + Branch, +} + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[serde(rename_all = "snake_case")] +#[non_exhaustive] +pub enum PusherType { + User, + #[serde(untagged)] + DeployKey(String), +} + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[serde(rename_all = "snake_case")] +#[non_exhaustive] +pub enum MembershipScope { + Team, + Organization, +} diff --git a/src/models/webhook_events/payload/branch_protection_rule.rs b/src/models/webhook_events/payload/branch_protection_rule.rs new file mode 100644 index 00000000..220e7d6d --- /dev/null +++ b/src/models/webhook_events/payload/branch_protection_rule.rs @@ -0,0 +1,18 @@ +use serde::{Deserialize, Serialize}; + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] +pub struct BranchProtectionRuleWebhookEventPayload { + pub action: BranchProtectionRuleWebhookEventAction, + pub enterprise: Option, + pub rule: serde_json::Value, +} + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[serde(rename_all = "snake_case")] +#[non_exhaustive] +pub enum BranchProtectionRuleWebhookEventAction { + Created, + Deleted, + Edited, +} diff --git a/src/models/webhook_events/payload/check_run.rs b/src/models/webhook_events/payload/check_run.rs new file mode 100644 index 00000000..12f19f03 --- /dev/null +++ b/src/models/webhook_events/payload/check_run.rs @@ -0,0 +1,18 @@ +use serde::{Deserialize, Serialize}; + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] +pub struct CheckRunWebhookEventPayload { + pub action: CheckRunWebhookEventAction, + pub check_run: serde_json::Value, +} + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[serde(rename_all = "snake_case")] +#[non_exhaustive] +pub enum CheckRunWebhookEventAction { + Completed, + Created, + RequestedAction, + Rerequested, +} diff --git a/src/models/webhook_events/payload/check_suite.rs b/src/models/webhook_events/payload/check_suite.rs new file mode 100644 index 00000000..b64fb86a --- /dev/null +++ b/src/models/webhook_events/payload/check_suite.rs @@ -0,0 +1,18 @@ +use serde::{Deserialize, Serialize}; + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] +pub struct CheckSuiteWebhookEventPayload { + pub action: CheckSuiteWebhookEventAction, + pub enterprise: Option, + pub check_suite: serde_json::Value, +} + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[serde(rename_all = "snake_case")] +#[non_exhaustive] +pub enum CheckSuiteWebhookEventAction { + Completed, + Requested, + Rerequested, +} diff --git a/src/models/webhook_events/payload/code_scanning_alert.rs b/src/models/webhook_events/payload/code_scanning_alert.rs new file mode 100644 index 00000000..848b3aa7 --- /dev/null +++ b/src/models/webhook_events/payload/code_scanning_alert.rs @@ -0,0 +1,25 @@ +use serde::{Deserialize, Serialize}; + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] +pub struct CodeScanningAlertWebhookEventPayload { + pub action: CodeScanningAlertWebhookEventAction, + pub alert: serde_json::Value, + /// The commit SHA of the code scanning alert. When the action is reopened_by_user or closed_by_user, the event was triggered by the sender and this value will be empty. + pub commit_oid: String, + pub enterprise: Option, + /// The Git reference of the code scanning alert. When the action is reopened_by_user or closed_by_user, the event was triggered by the sender and this value will be empty. + pub r#ref: String, +} + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[serde(rename_all = "snake_case")] +#[non_exhaustive] +pub enum CodeScanningAlertWebhookEventAction { + AppearedInBranch, + ClosedByUser, + Created, + Fixed, + Reopened, + ReopenedByUser, +} diff --git a/src/models/webhook_events/payload/commit_comment.rs b/src/models/webhook_events/payload/commit_comment.rs new file mode 100644 index 00000000..dd0b1a2f --- /dev/null +++ b/src/models/webhook_events/payload/commit_comment.rs @@ -0,0 +1,42 @@ +use std::collections::HashMap; + +use serde::{Deserialize, Serialize}; +use url::Url; + +use crate::models::{reactions::ReactionContent, Author, CommentId}; + +use super::AuthorAssociation; + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] +pub struct CommitCommentWebhookEventPayload { + pub action: CommitCommentWebhookEventAction, + pub comment: CommitComment, +} + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[serde(rename_all = "snake_case")] +#[non_exhaustive] +pub enum CommitCommentWebhookEventAction { + Created, +} + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[serde(rename_all = "snake_case")] +#[non_exhaustive] +pub struct CommitComment { + pub author_association: AuthorAssociation, + pub body: String, + pub commit_id: String, + pub created_at: String, + pub html_url: Url, + pub id: CommentId, + pub line: Option, + pub node_id: String, + pub path: Option, + pub position: Option, + pub reactions: Option>, + pub updated_at: String, + pub url: Url, + pub user: Option, +} diff --git a/src/models/webhook_events/payload/create.rs b/src/models/webhook_events/payload/create.rs new file mode 100644 index 00000000..0f10d634 --- /dev/null +++ b/src/models/webhook_events/payload/create.rs @@ -0,0 +1,14 @@ +use serde::{Deserialize, Serialize}; + +use super::{PusherType, RefType}; + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] +pub struct CreateWebhookEventPayload { + pub description: Option, + pub enterprise: Option, + pub master_branch: String, + pub pusher_type: PusherType, + pub r#ref: String, + pub ref_type: RefType, +} diff --git a/src/models/webhook_events/payload/delete.rs b/src/models/webhook_events/payload/delete.rs new file mode 100644 index 00000000..aae210b7 --- /dev/null +++ b/src/models/webhook_events/payload/delete.rs @@ -0,0 +1,21 @@ +use serde::{Deserialize, Serialize}; + +use super::{PusherType, RefType}; + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] +pub struct DeleteWebhookEventPayload { + pub enterprise: Option, + pub pusher_type: PusherType, + pub r#ref: String, + pub ref_type: RefType, +} + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[serde(rename_all = "snake_case")] +#[non_exhaustive] +pub enum DeleteWebhookEventAction { + Created, + Deleted, + Edited, +} diff --git a/src/models/webhook_events/payload/dependabot_alert.rs b/src/models/webhook_events/payload/dependabot_alert.rs new file mode 100644 index 00000000..83b7a93c --- /dev/null +++ b/src/models/webhook_events/payload/dependabot_alert.rs @@ -0,0 +1,22 @@ +use serde::{Deserialize, Serialize}; + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] +pub struct DependabotAlertWebhookEventPayload { + pub action: DependabotAlertWebhookEventAction, + pub alert: serde_json::Value, + pub enterprise: Option, +} + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[serde(rename_all = "snake_case")] +#[non_exhaustive] +pub enum DependabotAlertWebhookEventAction { + AutoDismissed, + AutoReopened, + Created, + Dismissed, + Fixed, + Reintroduced, + Reopened, +} diff --git a/src/models/webhook_events/payload/deploy_key.rs b/src/models/webhook_events/payload/deploy_key.rs new file mode 100644 index 00000000..be0aca5a --- /dev/null +++ b/src/models/webhook_events/payload/deploy_key.rs @@ -0,0 +1,17 @@ +use serde::{Deserialize, Serialize}; + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] +pub struct DeployKeyWebhookEventPayload { + pub action: DeployKeyWebhookEventAction, + pub enterprise: Option, + pub key: serde_json::Value, +} + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[serde(rename_all = "snake_case")] +#[non_exhaustive] +pub enum DeployKeyWebhookEventAction { + Created, + Deleted, +} diff --git a/src/models/webhook_events/payload/deployment.rs b/src/models/webhook_events/payload/deployment.rs new file mode 100644 index 00000000..99ec6bc7 --- /dev/null +++ b/src/models/webhook_events/payload/deployment.rs @@ -0,0 +1,18 @@ +use serde::{Deserialize, Serialize}; + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] +pub struct DeploymentWebhookEventPayload { + pub action: DeploymentWebhookEventAction, + pub deployment: serde_json::Value, + pub enterprise: Option, + pub workflow: serde_json::Value, + pub workflow_run: serde_json::Value, +} + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[serde(rename_all = "snake_case")] +#[non_exhaustive] +pub enum DeploymentWebhookEventAction { + Created, +} diff --git a/src/models/webhook_events/payload/deployment_protection_rule.rs b/src/models/webhook_events/payload/deployment_protection_rule.rs new file mode 100644 index 00000000..ca43e209 --- /dev/null +++ b/src/models/webhook_events/payload/deployment_protection_rule.rs @@ -0,0 +1,19 @@ +use serde::{Deserialize, Serialize}; + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] +pub struct DeploymentProtectionRuleWebhookEventPayload { + pub action: DeploymentProtectionRuleWebhookEventAction, + pub environment: Option, + pub event: Option, + pub deployment_callback_url: Option, + pub deployment: Option, + pub pull_requests: Option>, +} + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[serde(rename_all = "snake_case")] +#[non_exhaustive] +pub enum DeploymentProtectionRuleWebhookEventAction { + Requested, +} diff --git a/src/models/webhook_events/payload/deployment_status.rs b/src/models/webhook_events/payload/deployment_status.rs new file mode 100644 index 00000000..6ab03af9 --- /dev/null +++ b/src/models/webhook_events/payload/deployment_status.rs @@ -0,0 +1,20 @@ +use serde::{Deserialize, Serialize}; + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] +pub struct DeploymentStatusWebhookEventPayload { + pub action: DeploymentStatusWebhookEventAction, + pub check_run: Option, + pub deployment: serde_json::Value, + pub deployment_status: serde_json::Value, + pub enterprise: Option, + pub workflow: Option, + pub workflow_run: Option, +} + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[serde(rename_all = "snake_case")] +#[non_exhaustive] +pub enum DeploymentStatusWebhookEventAction { + Created, +} diff --git a/src/models/webhook_events/payload/discussion.rs b/src/models/webhook_events/payload/discussion.rs new file mode 100644 index 00000000..0d5b8ea9 --- /dev/null +++ b/src/models/webhook_events/payload/discussion.rs @@ -0,0 +1,33 @@ +use serde::{Deserialize, Serialize}; + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] +pub struct DiscussionWebhookEventPayload { + pub action: DiscussionWebhookEventAction, + pub answer: Option, + pub discussion: serde_json::Value, + pub enterprise: Option, + pub changes: Option, + pub label: Option, +} + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[serde(rename_all = "snake_case")] +#[non_exhaustive] +pub enum DiscussionWebhookEventAction { + Answered, + CategoryChanged, + Closed, + Created, + Deleted, + Edited, + Labeled, + Locked, + Pinned, + Reopened, + Transferred, + Unanswered, + Unlabeled, + Unlocked, + Unpinned, +} diff --git a/src/models/webhook_events/payload/discussion_comment.rs b/src/models/webhook_events/payload/discussion_comment.rs new file mode 100644 index 00000000..be7ea472 --- /dev/null +++ b/src/models/webhook_events/payload/discussion_comment.rs @@ -0,0 +1,20 @@ +use serde::{Deserialize, Serialize}; + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] +pub struct DiscussionCommentWebhookEventPayload { + pub action: DiscussionCommentWebhookEventAction, + pub changes: Option, + pub comment: serde_json::Value, + pub discussion: serde_json::Value, + pub enterprise: Option, +} + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[serde(rename_all = "snake_case")] +#[non_exhaustive] +pub enum DiscussionCommentWebhookEventAction { + Created, + Deleted, + Edited, +} diff --git a/src/models/webhook_events/payload/fork.rs b/src/models/webhook_events/payload/fork.rs new file mode 100644 index 00000000..3f21958c --- /dev/null +++ b/src/models/webhook_events/payload/fork.rs @@ -0,0 +1,11 @@ +use serde::{Deserialize, Serialize}; + +use crate::models::Repository; + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] +pub struct ForkWebhookEventPayload { + // TODO: Make sure that it's a crate::models::Repository + pub forkee: Repository, + pub enterprise: Option, +} diff --git a/src/models/webhook_events/payload/github_app_authorization.rs b/src/models/webhook_events/payload/github_app_authorization.rs new file mode 100644 index 00000000..da2bd376 --- /dev/null +++ b/src/models/webhook_events/payload/github_app_authorization.rs @@ -0,0 +1,15 @@ +use serde::{Deserialize, Serialize}; + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] +pub struct GithubAppAuthorizationWebhookEventPayload { + pub action: GithubAppAuthorizationWebhookEventAction, + pub enterprise: Option, +} + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[serde(rename_all = "snake_case")] +#[non_exhaustive] +pub enum GithubAppAuthorizationWebhookEventAction { + Revoked, +} diff --git a/src/models/webhook_events/payload/gollum.rs b/src/models/webhook_events/payload/gollum.rs new file mode 100644 index 00000000..b3fc53b9 --- /dev/null +++ b/src/models/webhook_events/payload/gollum.rs @@ -0,0 +1,9 @@ +use serde::{Deserialize, Serialize}; + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] +pub struct GollumWebhookEventPayload { + pub enterprise: Option, + /// The pages that were updated + pub pages: Vec, +} diff --git a/src/models/webhook_events/payload/installation.rs b/src/models/webhook_events/payload/installation.rs new file mode 100644 index 00000000..af3e4159 --- /dev/null +++ b/src/models/webhook_events/payload/installation.rs @@ -0,0 +1,23 @@ +use serde::{Deserialize, Serialize}; + +use crate::models::webhook_events::InstallationEventRepository; + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] +pub struct InstallationWebhookEventPayload { + pub action: InstallationWebhookEventAction, + pub enterprise: Option, + pub repositories: Vec, + pub requester: Option, +} + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[serde(rename_all = "snake_case")] +#[non_exhaustive] +pub enum InstallationWebhookEventAction { + Created, + Deleted, + NewPermissionsAccepted, + Suspend, + Unsuspend, +} diff --git a/src/models/webhook_events/payload/installation_repositories.rs b/src/models/webhook_events/payload/installation_repositories.rs new file mode 100644 index 00000000..cda98984 --- /dev/null +++ b/src/models/webhook_events/payload/installation_repositories.rs @@ -0,0 +1,30 @@ +use serde::{Deserialize, Serialize}; + +use crate::models::webhook_events::InstallationEventRepository; + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] +pub struct InstallationRepositoriesWebhookEventPayload { + pub action: InstallationRepositoriesWebhookEventAction, + pub enterprise: Option, + pub repositories_added: Vec, + pub repositories_removed: Vec, + pub repository_selection: InstallationRepositoriesWebhookEventSelection, + pub requester: Option, +} + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[serde(rename_all = "snake_case")] +#[non_exhaustive] +pub enum InstallationRepositoriesWebhookEventAction { + Added, + Removed, +} + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[serde(rename_all = "snake_case")] +#[non_exhaustive] +pub enum InstallationRepositoriesWebhookEventSelection { + All, + Selected, +} diff --git a/src/models/webhook_events/payload/installation_target.rs b/src/models/webhook_events/payload/installation_target.rs new file mode 100644 index 00000000..e72a0043 --- /dev/null +++ b/src/models/webhook_events/payload/installation_target.rs @@ -0,0 +1,11 @@ +use serde::{Deserialize, Serialize}; + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] +pub struct InstallationTargetWebhookEventPayload { + pub account: serde_json::Value, + pub action: String, + pub changes: serde_json::Value, + pub enterprise: Option, + pub target_type: String, +} diff --git a/src/models/webhook_events/payload/issue_comment.rs b/src/models/webhook_events/payload/issue_comment.rs new file mode 100644 index 00000000..ea120842 --- /dev/null +++ b/src/models/webhook_events/payload/issue_comment.rs @@ -0,0 +1,23 @@ +use serde::{Deserialize, Serialize}; + +use crate::models::issues::Issue; + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] +pub struct IssueCommentWebhookEventPayload { + pub action: IssueCommentWebhookEventAction, + pub changes: Option, + pub comment: serde_json::Value, + pub enterprise: Option, + // TODO: check whether models::issues::Issue is correct + pub issue: Issue, +} + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[serde(rename_all = "snake_case")] +#[non_exhaustive] +pub enum IssueCommentWebhookEventAction { + Created, + Deleted, + Edited, +} diff --git a/src/models/webhook_events/payload/issues.rs b/src/models/webhook_events/payload/issues.rs new file mode 100644 index 00000000..a55fbc0d --- /dev/null +++ b/src/models/webhook_events/payload/issues.rs @@ -0,0 +1,39 @@ +use serde::{Deserialize, Serialize}; + +use crate::models::{issues::Issue, Author}; + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] +pub struct IssuesWebhookEventPayload { + pub action: IssuesWebhookEventAction, + // TODO: Check that Author is enough. + pub assignee: Option, + pub enterprise: Option, + // TODO: Check that Issue is enough. + pub issue: Issue, + pub milestone: Option, + pub label: Option, + pub changes: Option, +} + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[serde(rename_all = "snake_case")] +#[non_exhaustive] +pub enum IssuesWebhookEventAction { + Assigned, + Closed, + Deleted, + Demilestoned, + Edited, + Labeled, + Locked, + Milestoned, + Opened, + Pinned, + Reopened, + Transferred, + Unassigned, + Unlabeled, + Unlocked, + Unpinned, +} diff --git a/src/models/webhook_events/payload/label.rs b/src/models/webhook_events/payload/label.rs new file mode 100644 index 00000000..aa44d674 --- /dev/null +++ b/src/models/webhook_events/payload/label.rs @@ -0,0 +1,19 @@ +use serde::{Deserialize, Serialize}; + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] +pub struct LabelWebhookEventPayload { + pub action: LabelWebhookEventAction, + pub enterprise: Option, + pub label: serde_json::Value, + pub changes: Option, +} + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[serde(rename_all = "snake_case")] +#[non_exhaustive] +pub enum LabelWebhookEventAction { + Created, + Deleted, + Edited, +} diff --git a/src/models/webhook_events/payload/marketplace_purchase.rs b/src/models/webhook_events/payload/marketplace_purchase.rs new file mode 100644 index 00000000..86152b88 --- /dev/null +++ b/src/models/webhook_events/payload/marketplace_purchase.rs @@ -0,0 +1,21 @@ +use serde::{Deserialize, Serialize}; + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] +pub struct MarketplacePurchaseWebhookEventPayload { + pub action: MarketplacePurchaseWebhookEventAction, + pub effective_date: Option, + pub marketplace_purchase: serde_json::Value, + pub previous_marketplace_purchase: Option, +} + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[serde(rename_all = "snake_case")] +#[non_exhaustive] +pub enum MarketplacePurchaseWebhookEventAction { + Cancelled, + Changed, + PendingChange, + PendingChangeCancelled, + Purchased, +} diff --git a/src/models/webhook_events/payload/member.rs b/src/models/webhook_events/payload/member.rs new file mode 100644 index 00000000..af49f23b --- /dev/null +++ b/src/models/webhook_events/payload/member.rs @@ -0,0 +1,19 @@ +use serde::{Deserialize, Serialize}; + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] +pub struct MemberWebhookEventPayload { + pub action: MemberWebhookEventAction, + pub changes: Option, + pub enterprise: Option, + pub member: serde_json::Value, +} + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[serde(rename_all = "snake_case")] +#[non_exhaustive] +pub enum MemberWebhookEventAction { + Added, + Edited, + Removed, +} diff --git a/src/models/webhook_events/payload/membership.rs b/src/models/webhook_events/payload/membership.rs new file mode 100644 index 00000000..d17b9956 --- /dev/null +++ b/src/models/webhook_events/payload/membership.rs @@ -0,0 +1,21 @@ +use serde::{Deserialize, Serialize}; + +use super::MembershipScope; + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] +pub struct MembershipWebhookEventPayload { + pub action: MembershipWebhookEventAction, + pub enterprise: Option, + pub member: serde_json::Value, + pub scope: MembershipScope, + pub team: serde_json::Value, +} + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[serde(rename_all = "snake_case")] +#[non_exhaustive] +pub enum MembershipWebhookEventAction { + Added, + Removed, +} diff --git a/src/models/webhook_events/payload/merge_group.rs b/src/models/webhook_events/payload/merge_group.rs new file mode 100644 index 00000000..7c9c53f1 --- /dev/null +++ b/src/models/webhook_events/payload/merge_group.rs @@ -0,0 +1,26 @@ +use serde::{Deserialize, Serialize}; + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] +pub struct MergeGroupWebhookEventPayload { + pub action: MergeGroupWebhookEventAction, + pub merge_group: serde_json::Value, + pub reason: Option, +} + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[serde(rename_all = "snake_case")] +#[non_exhaustive] +pub enum MergeGroupWebhookEventAction { + ChecksRequested, + Destroyed, +} + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[serde(rename_all = "snake_case")] +#[non_exhaustive] +pub enum MergeGroupDestructionReason { + Merged, + Invalidated, + Dequeued, +} diff --git a/src/models/webhook_events/payload/meta.rs b/src/models/webhook_events/payload/meta.rs new file mode 100644 index 00000000..1d659c37 --- /dev/null +++ b/src/models/webhook_events/payload/meta.rs @@ -0,0 +1,19 @@ +use serde::{Deserialize, Serialize}; + +use crate::models::HookId; + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] +pub struct MetaWebhookEventPayload { + pub action: MetaWebhookEventAction, + pub hook: serde_json::Value, + pub enterprise: Option, + pub hook_id: HookId, +} + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[serde(rename_all = "snake_case")] +#[non_exhaustive] +pub enum MetaWebhookEventAction { + Deleted, +} diff --git a/src/models/webhook_events/payload/milestone.rs b/src/models/webhook_events/payload/milestone.rs new file mode 100644 index 00000000..bc3b9b98 --- /dev/null +++ b/src/models/webhook_events/payload/milestone.rs @@ -0,0 +1,21 @@ +use serde::{Deserialize, Serialize}; + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] +pub struct MilestoneWebhookEventPayload { + pub action: MilestoneWebhookEventAction, + pub milestone: serde_json::Value, + pub enterprise: Option, + pub changes: Option, +} + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[serde(rename_all = "snake_case")] +#[non_exhaustive] +pub enum MilestoneWebhookEventAction { + Closed, + Created, + Deleted, + Edited, + Opened, +} diff --git a/src/models/webhook_events/payload/org_block.rs b/src/models/webhook_events/payload/org_block.rs new file mode 100644 index 00000000..bc841c53 --- /dev/null +++ b/src/models/webhook_events/payload/org_block.rs @@ -0,0 +1,17 @@ +use serde::{Deserialize, Serialize}; + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] +pub struct OrgBlockWebhookEventPayload { + pub action: OrgBlockWebhookEventAction, + pub blocked_user: serde_json::Value, + pub enterprise: Option, +} + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[serde(rename_all = "snake_case")] +#[non_exhaustive] +pub enum OrgBlockWebhookEventAction { + Blocked, + Unblocked, +} diff --git a/src/models/webhook_events/payload/organization.rs b/src/models/webhook_events/payload/organization.rs new file mode 100644 index 00000000..897ff98a --- /dev/null +++ b/src/models/webhook_events/payload/organization.rs @@ -0,0 +1,21 @@ +use serde::{Deserialize, Serialize}; + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] +pub struct OrganizationWebhookEventPayload { + pub action: OrganizationWebhookEventAction, + pub enterprise: Option, + pub membership: Option, + pub changes: Option, +} + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[serde(rename_all = "snake_case")] +#[non_exhaustive] +pub enum OrganizationWebhookEventAction { + Deleted, + MemberAdded, + MemberInvited, + MemberRemoved, + Renamed, +} diff --git a/src/models/webhook_events/payload/package.rs b/src/models/webhook_events/payload/package.rs new file mode 100644 index 00000000..f8715db0 --- /dev/null +++ b/src/models/webhook_events/payload/package.rs @@ -0,0 +1,17 @@ +use serde::{Deserialize, Serialize}; + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] +pub struct PackageWebhookEventPayload { + pub action: PackageWebhookEventAction, + pub enterprise: Option, + pub package: serde_json::Value, +} + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[serde(rename_all = "snake_case")] +#[non_exhaustive] +pub enum PackageWebhookEventAction { + Published, + Updated, +} diff --git a/src/models/webhook_events/payload/page_build.rs b/src/models/webhook_events/payload/page_build.rs new file mode 100644 index 00000000..d7104b89 --- /dev/null +++ b/src/models/webhook_events/payload/page_build.rs @@ -0,0 +1,9 @@ +use serde::{Deserialize, Serialize}; + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] +pub struct PageBuildWebhookEventPayload { + pub build: serde_json::Value, + pub enterprise: Option, + pub id: u64, +} diff --git a/src/models/webhook_events/payload/personal_access_token_request.rs b/src/models/webhook_events/payload/personal_access_token_request.rs new file mode 100644 index 00000000..c2b90115 --- /dev/null +++ b/src/models/webhook_events/payload/personal_access_token_request.rs @@ -0,0 +1,18 @@ +use serde::{Deserialize, Serialize}; + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] +pub struct PersonalAccessTokenRequestWebhookEventPayload { + pub action: PersonalAccessTokenRequestWebhookEventAction, + pub personal_access_token_request: serde_json::Value, +} + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[serde(rename_all = "snake_case")] +#[non_exhaustive] +pub enum PersonalAccessTokenRequestWebhookEventAction { + Approved, + Cancelled, + Created, + Denied, +} diff --git a/src/models/webhook_events/payload/ping.rs b/src/models/webhook_events/payload/ping.rs new file mode 100644 index 00000000..bf988d82 --- /dev/null +++ b/src/models/webhook_events/payload/ping.rs @@ -0,0 +1,11 @@ +use serde::{Deserialize, Serialize}; + +use crate::models::HookId; + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] +pub struct PingWebhookEventPayload { + pub hook: Option, + pub hook_id: Option, + pub zen: Option, +} diff --git a/src/models/webhook_events/payload/project.rs b/src/models/webhook_events/payload/project.rs new file mode 100644 index 00000000..a9b4d441 --- /dev/null +++ b/src/models/webhook_events/payload/project.rs @@ -0,0 +1,21 @@ +use serde::{Deserialize, Serialize}; + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] +pub struct ProjectWebhookEventPayload { + pub action: ProjectWebhookEventAction, + pub enterprise: Option, + pub project: serde_json::Value, + pub changes: Option, +} + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[serde(rename_all = "snake_case")] +#[non_exhaustive] +pub enum ProjectWebhookEventAction { + Closed, + Created, + Deleted, + Edited, + Reopened, +} diff --git a/src/models/webhook_events/payload/project_card.rs b/src/models/webhook_events/payload/project_card.rs new file mode 100644 index 00000000..0ce47042 --- /dev/null +++ b/src/models/webhook_events/payload/project_card.rs @@ -0,0 +1,21 @@ +use serde::{Deserialize, Serialize}; + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] +pub struct ProjectCardWebhookEventPayload { + pub action: ProjectCardWebhookEventAction, + pub enterprise: Option, + pub project_card: serde_json::Value, + pub changes: Option, +} + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[serde(rename_all = "snake_case")] +#[non_exhaustive] +pub enum ProjectCardWebhookEventAction { + Converted, + Created, + Deleted, + Edited, + Moved, +} diff --git a/src/models/webhook_events/payload/project_column.rs b/src/models/webhook_events/payload/project_column.rs new file mode 100644 index 00000000..ed3d4437 --- /dev/null +++ b/src/models/webhook_events/payload/project_column.rs @@ -0,0 +1,20 @@ +use serde::{Deserialize, Serialize}; + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] +pub struct ProjectColumnWebhookEventPayload { + pub action: ProjectColumnWebhookEventAction, + pub enterprise: Option, + pub project_column: serde_json::Value, + pub changes: Option, +} + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[serde(rename_all = "snake_case")] +#[non_exhaustive] +pub enum ProjectColumnWebhookEventAction { + Created, + Deleted, + Edited, + Moved, +} diff --git a/src/models/webhook_events/payload/projects_v2.rs b/src/models/webhook_events/payload/projects_v2.rs new file mode 100644 index 00000000..ef50df4f --- /dev/null +++ b/src/models/webhook_events/payload/projects_v2.rs @@ -0,0 +1,20 @@ +use serde::{Deserialize, Serialize}; + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] +pub struct ProjectsV2WebhookEventPayload { + pub action: ProjectsV2WebhookEventAction, + pub projects_v2: serde_json::Value, + pub changes: Option, +} + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[serde(rename_all = "snake_case")] +#[non_exhaustive] +pub enum ProjectsV2WebhookEventAction { + Closed, + Created, + Deleted, + Edited, + Reopened, +} diff --git a/src/models/webhook_events/payload/projects_v2_item.rs b/src/models/webhook_events/payload/projects_v2_item.rs new file mode 100644 index 00000000..2bc4d846 --- /dev/null +++ b/src/models/webhook_events/payload/projects_v2_item.rs @@ -0,0 +1,22 @@ +use serde::{Deserialize, Serialize}; + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] +pub struct ProjectsV2ItemWebhookEventPayload { + pub action: ProjectsV2ItemWebhookEventAction, + pub changes: Option, + pub projects_v2_item: serde_json::Value, +} + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[serde(rename_all = "snake_case")] +#[non_exhaustive] +pub enum ProjectsV2ItemWebhookEventAction { + Archived, + Converted, + Created, + Deleted, + Edited, + Reordered, + Restored, +} diff --git a/src/models/webhook_events/payload/public.rs b/src/models/webhook_events/payload/public.rs new file mode 100644 index 00000000..2f30eb91 --- /dev/null +++ b/src/models/webhook_events/payload/public.rs @@ -0,0 +1,7 @@ +use serde::{Deserialize, Serialize}; + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] +pub struct PublicWebhookEventPayload { + pub enterprise: Option, +} diff --git a/src/models/webhook_events/payload/pull_request.rs b/src/models/webhook_events/payload/pull_request.rs new file mode 100644 index 00000000..7dfe0e2a --- /dev/null +++ b/src/models/webhook_events/payload/pull_request.rs @@ -0,0 +1,45 @@ +use serde::{Deserialize, Serialize}; + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] +pub struct PullRequestWebhookEventPayload { + pub action: PullRequestWebhookEventAction, + pub assignee: Option, + pub enterprise: Option, + pub number: u64, + pub pull_request: serde_json::Value, + pub reason: Option, + pub milestone: Option, + pub label: Option, + pub after: Option, + pub before: Option, + pub requested_reviewer: Option, + pub requested_team: Option, +} + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[serde(rename_all = "snake_case")] +#[non_exhaustive] +pub enum PullRequestWebhookEventAction { + Assigned, + AutoMergeDisabled, + AutoMergeEnabled, + Closed, + ConvertedToDraft, + Demilestoned, + Dequeued, + Edited, + Enqueued, + Labeled, + Locked, + Milestoned, + Opened, + ReadyForReview, + Reopened, + ReviewRequestRemoved, + ReviewRequested, + Synchronize, + Unassigned, + Unlabeled, + Unlocked, +} diff --git a/src/models/webhook_events/payload/pull_request_review.rs b/src/models/webhook_events/payload/pull_request_review.rs new file mode 100644 index 00000000..5508f8ec --- /dev/null +++ b/src/models/webhook_events/payload/pull_request_review.rs @@ -0,0 +1,19 @@ +use serde::{Deserialize, Serialize}; + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] +pub struct PullRequestReviewWebhookEventPayload { + pub action: PullRequestReviewWebhookEventAction, + pub pull_request: serde_json::Value, + pub review: serde_json::Value, + pub changes: Option, +} + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[serde(rename_all = "snake_case")] +#[non_exhaustive] +pub enum PullRequestReviewWebhookEventAction { + Dismissed, + Edited, + Submitted, +} diff --git a/src/models/webhook_events/payload/pull_request_review_comment.rs b/src/models/webhook_events/payload/pull_request_review_comment.rs new file mode 100644 index 00000000..d8cfc794 --- /dev/null +++ b/src/models/webhook_events/payload/pull_request_review_comment.rs @@ -0,0 +1,20 @@ +use serde::{Deserialize, Serialize}; + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] +pub struct PullRequestReviewCommentWebhookEventPayload { + pub action: PullRequestReviewCommentWebhookEventAction, + pub enterprise: Option, + pub comment: serde_json::Value, + pub changes: Option, + pub pull_request: serde_json::Value, +} + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[serde(rename_all = "snake_case")] +#[non_exhaustive] +pub enum PullRequestReviewCommentWebhookEventAction { + Created, + Deleted, + Edited, +} diff --git a/src/models/webhook_events/payload/pull_request_review_thread.rs b/src/models/webhook_events/payload/pull_request_review_thread.rs new file mode 100644 index 00000000..643957c5 --- /dev/null +++ b/src/models/webhook_events/payload/pull_request_review_thread.rs @@ -0,0 +1,17 @@ +use serde::{Deserialize, Serialize}; + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] +pub struct PullRequestReviewThreadWebhookEventPayload { + pub action: PullRequestReviewThreadWebhookEventAction, + pub pull_request: serde_json::Value, + pub thread: serde_json::Value, +} + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[serde(rename_all = "snake_case")] +#[non_exhaustive] +pub enum PullRequestReviewThreadWebhookEventAction { + Resolved, + Unresolved, +} diff --git a/src/models/webhook_events/payload/push.rs b/src/models/webhook_events/payload/push.rs new file mode 100644 index 00000000..099c3379 --- /dev/null +++ b/src/models/webhook_events/payload/push.rs @@ -0,0 +1,19 @@ +use serde::{Deserialize, Serialize}; +use url::Url; + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] +pub struct PushWebhookEventPayload { + pub enterprise: Option, + pub after: String, + pub base_ref: Option, + pub before: String, + pub commits: Vec, + pub compare: Url, + pub created: bool, + pub deleted: bool, + pub forced: bool, + pub head_commit: Option, + pub pusher: serde_json::Value, + pub r#ref: String, +} diff --git a/src/models/webhook_events/payload/registry_package.rs b/src/models/webhook_events/payload/registry_package.rs new file mode 100644 index 00000000..5c5b441a --- /dev/null +++ b/src/models/webhook_events/payload/registry_package.rs @@ -0,0 +1,17 @@ +use serde::{Deserialize, Serialize}; + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] +pub struct RegistryPackageWebhookEventPayload { + pub action: RegistryPackageWebhookEventAction, + pub registry_package: serde_json::Value, + pub enterprise: Option, +} + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[serde(rename_all = "snake_case")] +#[non_exhaustive] +pub enum RegistryPackageWebhookEventAction { + Published, + Default, +} diff --git a/src/models/webhook_events/payload/release.rs b/src/models/webhook_events/payload/release.rs new file mode 100644 index 00000000..aa49da6e --- /dev/null +++ b/src/models/webhook_events/payload/release.rs @@ -0,0 +1,23 @@ +use serde::{Deserialize, Serialize}; + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] +pub struct ReleaseWebhookEventPayload { + pub action: ReleaseWebhookEventAction, + pub enterprise: Option, + pub release: serde_json::Value, + pub changes: Option, +} + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[serde(rename_all = "snake_case")] +#[non_exhaustive] +pub enum ReleaseWebhookEventAction { + Created, + Deleted, + Edited, + Prereleased, + Published, + Released, + Unpublished, +} diff --git a/src/models/webhook_events/payload/repository.rs b/src/models/webhook_events/payload/repository.rs new file mode 100644 index 00000000..8bcdbe45 --- /dev/null +++ b/src/models/webhook_events/payload/repository.rs @@ -0,0 +1,24 @@ +use serde::{Deserialize, Serialize}; + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] +pub struct RepositoryWebhookEventPayload { + pub action: RepositoryWebhookEventAction, + pub enterprise: Option, + pub changes: Option, +} + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[serde(rename_all = "snake_case")] +#[non_exhaustive] +pub enum RepositoryWebhookEventAction { + Archived, + Created, + Deleted, + Edited, + Privatized, + Publicized, + Renamed, + Transferred, + Unarchived, +} diff --git a/src/models/webhook_events/payload/repository_advisory.rs b/src/models/webhook_events/payload/repository_advisory.rs new file mode 100644 index 00000000..073396a8 --- /dev/null +++ b/src/models/webhook_events/payload/repository_advisory.rs @@ -0,0 +1,18 @@ +use serde::{Deserialize, Serialize}; + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] +pub struct RepositoryAdvisoryWebhookEventPayload { + pub action: RepositoryAdvisoryWebhookEventAction, + pub enterprise: Option, + pub repository: serde_json::Value, + pub repository_advisory: serde_json::Value, +} + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[serde(rename_all = "snake_case")] +#[non_exhaustive] +pub enum RepositoryAdvisoryWebhookEventAction { + Published, + Reported, +} diff --git a/src/models/webhook_events/payload/repository_dispatch.rs b/src/models/webhook_events/payload/repository_dispatch.rs new file mode 100644 index 00000000..4315be7d --- /dev/null +++ b/src/models/webhook_events/payload/repository_dispatch.rs @@ -0,0 +1,10 @@ +use serde::{Deserialize, Serialize}; + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] +pub struct RepositoryDispatchWebhookEventPayload { + pub action: String, + pub branch: String, + pub client_payload: serde_json::Value, + pub enterprise: Option, +} diff --git a/src/models/webhook_events/payload/repository_import.rs b/src/models/webhook_events/payload/repository_import.rs new file mode 100644 index 00000000..d0c56f4e --- /dev/null +++ b/src/models/webhook_events/payload/repository_import.rs @@ -0,0 +1,17 @@ +use serde::{Deserialize, Serialize}; + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] +pub struct RepositoryImportWebhookEventPayload { + pub enterprise: Option, + pub status: RepositoryImportWebhookEventStatus, +} + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[serde(rename_all = "snake_case")] +#[non_exhaustive] +pub enum RepositoryImportWebhookEventStatus { + Success, + Cancelled, + Failure, +} diff --git a/src/models/webhook_events/payload/repository_vulnerability_alert.rs b/src/models/webhook_events/payload/repository_vulnerability_alert.rs new file mode 100644 index 00000000..f11425cc --- /dev/null +++ b/src/models/webhook_events/payload/repository_vulnerability_alert.rs @@ -0,0 +1,19 @@ +use serde::{Deserialize, Serialize}; + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] +pub struct RepositoryVulnerabilityAlertWebhookEventPayload { + pub action: RepositoryVulnerabilityAlertWebhookEventAction, + pub enterprise: Option, + pub alert: serde_json::Value, +} + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[serde(rename_all = "snake_case")] +#[non_exhaustive] +pub enum RepositoryVulnerabilityAlertWebhookEventAction { + Create, + Dismiss, + Reopen, + Resolve, +} diff --git a/src/models/webhook_events/payload/secret_scanning_alert.rs b/src/models/webhook_events/payload/secret_scanning_alert.rs new file mode 100644 index 00000000..23e1dd12 --- /dev/null +++ b/src/models/webhook_events/payload/secret_scanning_alert.rs @@ -0,0 +1,19 @@ +use serde::{Deserialize, Serialize}; + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] +pub struct SecretScanningAlertWebhookEventPayload { + pub action: SecretScanningAlertWebhookEventAction, + pub alert: serde_json::Value, + pub enterprise: Option, +} + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[serde(rename_all = "snake_case")] +#[non_exhaustive] +pub enum SecretScanningAlertWebhookEventAction { + Created, + Reopened, + Resolved, + Revoked, +} diff --git a/src/models/webhook_events/payload/secret_scanning_alert_location.rs b/src/models/webhook_events/payload/secret_scanning_alert_location.rs new file mode 100644 index 00000000..8c2c5946 --- /dev/null +++ b/src/models/webhook_events/payload/secret_scanning_alert_location.rs @@ -0,0 +1,16 @@ +use serde::{Deserialize, Serialize}; + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] +pub struct SecretScanningAlertLocationWebhookEventPayload { + pub action: SecretScanningAlertLocationWebhookEventAction, + pub alert: serde_json::Value, + pub location: serde_json::Value, +} + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[serde(rename_all = "snake_case")] +#[non_exhaustive] +pub enum SecretScanningAlertLocationWebhookEventAction { + Created, +} diff --git a/src/models/webhook_events/payload/security_advisory.rs b/src/models/webhook_events/payload/security_advisory.rs new file mode 100644 index 00000000..9e5c2da7 --- /dev/null +++ b/src/models/webhook_events/payload/security_advisory.rs @@ -0,0 +1,18 @@ +use serde::{Deserialize, Serialize}; + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] +pub struct SecurityAdvisoryWebhookEventPayload { + pub action: SecurityAdvisoryWebhookEventAction, + pub enterprise: Option, + pub security_advisory: serde_json::Value, +} + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[serde(rename_all = "snake_case")] +#[non_exhaustive] +pub enum SecurityAdvisoryWebhookEventAction { + Published, + Updated, + Withdrawn, +} diff --git a/src/models/webhook_events/payload/security_and_analysis.rs b/src/models/webhook_events/payload/security_and_analysis.rs new file mode 100644 index 00000000..77227923 --- /dev/null +++ b/src/models/webhook_events/payload/security_and_analysis.rs @@ -0,0 +1,8 @@ +use serde::{Deserialize, Serialize}; + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] +pub struct SecurityAndAnalysisWebhookEventPayload { + pub changes: serde_json::Value, + pub enterprise: Option, +} diff --git a/src/models/webhook_events/payload/sponsorship.rs b/src/models/webhook_events/payload/sponsorship.rs new file mode 100644 index 00000000..76ee5df2 --- /dev/null +++ b/src/models/webhook_events/payload/sponsorship.rs @@ -0,0 +1,23 @@ +use serde::{Deserialize, Serialize}; + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] +pub struct SponsorshipWebhookEventPayload { + pub action: SponsorshipWebhookEventAction, + pub sponsorship: serde_json::Value, + pub enterprise: Option, + pub changes: Option, + pub effective_date: Option, +} + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[serde(rename_all = "snake_case")] +#[non_exhaustive] +pub enum SponsorshipWebhookEventAction { + Cancelled, + Created, + Edited, + PendingCancellation, + PendingTierChange, + TierChanged, +} diff --git a/src/models/webhook_events/payload/star.rs b/src/models/webhook_events/payload/star.rs new file mode 100644 index 00000000..c38e1d49 --- /dev/null +++ b/src/models/webhook_events/payload/star.rs @@ -0,0 +1,18 @@ +use chrono::{DateTime, Utc}; +use serde::{Deserialize, Serialize}; + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] +pub struct StarWebhookEventPayload { + pub action: StarWebhookEventAction, + pub enterprise: Option, + pub starred_at: Option>, +} + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[serde(rename_all = "snake_case")] +#[non_exhaustive] +pub enum StarWebhookEventAction { + Created, + Deleted, +} diff --git a/src/models/webhook_events/payload/status.rs b/src/models/webhook_events/payload/status.rs new file mode 100644 index 00000000..9eeb39e7 --- /dev/null +++ b/src/models/webhook_events/payload/status.rs @@ -0,0 +1,32 @@ +use serde::{Deserialize, Serialize}; +use url::Url; + +use crate::models::StatusId; + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] +pub struct StatusWebhookEventPayload { + pub avatar_url: Option, + pub branches: Vec, + pub commit: serde_json::Value, + pub context: String, + pub created_at: String, + pub description: Option, + pub enterprise: Option, + pub id: StatusId, + pub name: String, + pub sha: String, + pub state: CommitState, + pub target_url: Option, + pub updated_at: String, +} + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[serde(rename_all = "snake_case")] +#[non_exhaustive] +pub enum CommitState { + Pending, + Success, + Failure, + Error, +} diff --git a/src/models/webhook_events/payload/team.rs b/src/models/webhook_events/payload/team.rs new file mode 100644 index 00000000..8744644a --- /dev/null +++ b/src/models/webhook_events/payload/team.rs @@ -0,0 +1,21 @@ +use serde::{Deserialize, Serialize}; + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] +pub struct TeamWebhookEventPayload { + pub action: TeamWebhookEventAction, + pub enterprise: Option, + pub team: serde_json::Value, + pub changes: Option, +} + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[serde(rename_all = "snake_case")] +#[non_exhaustive] +pub enum TeamWebhookEventAction { + AddedToRepository, + Created, + Deleted, + Edited, + RemovedFromRepository, +} diff --git a/src/models/webhook_events/payload/team_add.rs b/src/models/webhook_events/payload/team_add.rs new file mode 100644 index 00000000..76d24faa --- /dev/null +++ b/src/models/webhook_events/payload/team_add.rs @@ -0,0 +1,8 @@ +use serde::{Deserialize, Serialize}; + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] +pub struct TeamAddWebhookEventPayload { + pub enterprise: Option, + pub team: serde_json::Value, +} diff --git a/src/models/webhook_events/payload/watch.rs b/src/models/webhook_events/payload/watch.rs new file mode 100644 index 00000000..003c8af6 --- /dev/null +++ b/src/models/webhook_events/payload/watch.rs @@ -0,0 +1,15 @@ +use serde::{Deserialize, Serialize}; + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] +pub struct WatchWebhookEventPayload { + pub action: WatchWebhookEventAction, + pub enterprise: Option, +} + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[serde(rename_all = "snake_case")] +#[non_exhaustive] +pub enum WatchWebhookEventAction { + Started, +} diff --git a/src/models/webhook_events/payload/workflow_dispatch.rs b/src/models/webhook_events/payload/workflow_dispatch.rs new file mode 100644 index 00000000..6a54ab41 --- /dev/null +++ b/src/models/webhook_events/payload/workflow_dispatch.rs @@ -0,0 +1,10 @@ +use serde::{Deserialize, Serialize}; + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] +pub struct WorkflowDispatchWebhookEventPayload { + pub enterprise: Option, + pub inputs: serde_json::Value, + pub r#ref: String, + pub workflow: String, +} diff --git a/src/models/webhook_events/payload/workflow_job.rs b/src/models/webhook_events/payload/workflow_job.rs new file mode 100644 index 00000000..0b8058c4 --- /dev/null +++ b/src/models/webhook_events/payload/workflow_job.rs @@ -0,0 +1,20 @@ +use serde::{Deserialize, Serialize}; + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] +pub struct WorkflowJobWebhookEventPayload { + pub action: WorkflowJobWebhookEventAction, + pub enterprise: Option, + pub workflow_job: serde_json::Value, + pub deployment: Option, +} + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[serde(rename_all = "snake_case")] +#[non_exhaustive] +pub enum WorkflowJobWebhookEventAction { + Completed, + InProgress, + Queued, + Waiting, +} diff --git a/src/models/webhook_events/payload/workflow_run.rs b/src/models/webhook_events/payload/workflow_run.rs new file mode 100644 index 00000000..a127bd84 --- /dev/null +++ b/src/models/webhook_events/payload/workflow_run.rs @@ -0,0 +1,19 @@ +use serde::{Deserialize, Serialize}; + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[non_exhaustive] +pub struct WorkflowRunWebhookEventPayload { + pub action: WorkflowRunWebhookEventAction, + pub enterprise: Option, + pub workflow: Option, + pub workflow_run: serde_json::Value, +} + +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[serde(rename_all = "snake_case")] +#[non_exhaustive] +pub enum WorkflowRunWebhookEventAction { + Completed, + InProgress, + Requested, +} diff --git a/tests/resources/installation_created_webhook_event.json b/tests/resources/installation_created_webhook_event.json new file mode 100644 index 00000000..b3fe5522 --- /dev/null +++ b/tests/resources/installation_created_webhook_event.json @@ -0,0 +1,102 @@ +{ + "action": "created", + "installation": { + "id": 39593433, + "account": { + "login": "gagbo", + "id": 10496163, + "node_id": "MDQ6VXNlcjEwNDk2MTYz", + "avatar_url": "https://avatars.githubusercontent.com/u/10496163?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/gagbo", + "html_url": "https://github.com/gagbo", + "followers_url": "https://api.github.com/users/gagbo/followers", + "following_url": "https://api.github.com/users/gagbo/following{/other_user}", + "gists_url": "https://api.github.com/users/gagbo/gists{/gist_id}", + "starred_url": "https://api.github.com/users/gagbo/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/gagbo/subscriptions", + "organizations_url": "https://api.github.com/users/gagbo/orgs", + "repos_url": "https://api.github.com/users/gagbo/repos", + "events_url": "https://api.github.com/users/gagbo/events{/privacy}", + "received_events_url": "https://api.github.com/users/gagbo/received_events", + "type": "User", + "site_admin": false + }, + "repository_selection": "all", + "access_tokens_url": "https://api.github.com/app/installations/39593433/access_tokens", + "repositories_url": "https://api.github.com/installation/repositories", + "html_url": "https://github.com/settings/installations/39593433", + "app_id": 360617, + "app_slug": "gagbo-test-app", + "target_id": 10496163, + "target_type": "User", + "permissions": { + "issues": "write", + "actions": "write", + "metadata": "read", + "pull_requests": "write" + }, + "events": [ + "issues", + "issue_comment", + "pull_request", + "pull_request_review", + "pull_request_review_comment", + "pull_request_review_thread", + "repository" + ], + "created_at": "2023-07-13T11:33:20.000+02:00", + "updated_at": "2023-07-13T11:33:21.000+02:00", + "single_file_name": null, + "has_multiple_single_files": false, + "single_file_paths": [ + + ], + "suspended_by": null, + "suspended_at": null + }, + "repositories": [ + { + "id": 29128586, + "node_id": "MDEwOlJlcG9zaXRvcnkyOTEyODU4Ng==", + "name": "ViscoElRebound", + "full_name": "gagbo/ViscoElRebound", + "private": false + }, + { + "id": 51965720, + "node_id": "MDEwOlJlcG9zaXRvcnk1MTk2NTcyMA==", + "name": "Sizr", + "full_name": "gagbo/Sizr", + "private": true + }, + { + "id": 665086759, + "node_id": "R_kgDOJ6RrJw", + "name": "octocrab", + "full_name": "gagbo/octocrab", + "private": false + } + ], + "requester": null, + "sender": { + "login": "gagbo", + "id": 10496163, + "node_id": "MDQ6VXNlcjEwNDk2MTYz", + "avatar_url": "https://avatars.githubusercontent.com/u/10496163?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/gagbo", + "html_url": "https://github.com/gagbo", + "followers_url": "https://api.github.com/users/gagbo/followers", + "following_url": "https://api.github.com/users/gagbo/following{/other_user}", + "gists_url": "https://api.github.com/users/gagbo/gists{/gist_id}", + "starred_url": "https://api.github.com/users/gagbo/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/gagbo/subscriptions", + "organizations_url": "https://api.github.com/users/gagbo/orgs", + "repos_url": "https://api.github.com/users/gagbo/repos", + "events_url": "https://api.github.com/users/gagbo/events{/privacy}", + "received_events_url": "https://api.github.com/users/gagbo/received_events", + "type": "User", + "site_admin": false + } +} diff --git a/tests/resources/installation_deleted_webhook_event.json b/tests/resources/installation_deleted_webhook_event.json new file mode 100644 index 00000000..253af106 --- /dev/null +++ b/tests/resources/installation_deleted_webhook_event.json @@ -0,0 +1,101 @@ +{ + "action": "deleted", + "installation": { + "id": 39593433, + "account": { + "login": "gagbo", + "id": 10496163, + "node_id": "MDQ6VXNlcjEwNDk2MTYz", + "avatar_url": "https://avatars.githubusercontent.com/u/10496163?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/gagbo", + "html_url": "https://github.com/gagbo", + "followers_url": "https://api.github.com/users/gagbo/followers", + "following_url": "https://api.github.com/users/gagbo/following{/other_user}", + "gists_url": "https://api.github.com/users/gagbo/gists{/gist_id}", + "starred_url": "https://api.github.com/users/gagbo/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/gagbo/subscriptions", + "organizations_url": "https://api.github.com/users/gagbo/orgs", + "repos_url": "https://api.github.com/users/gagbo/repos", + "events_url": "https://api.github.com/users/gagbo/events{/privacy}", + "received_events_url": "https://api.github.com/users/gagbo/received_events", + "type": "User", + "site_admin": false + }, + "repository_selection": "all", + "access_tokens_url": "https://api.github.com/app/installations/39593433/access_tokens", + "repositories_url": "https://api.github.com/installation/repositories", + "html_url": "https://github.com/settings/installations/39593433", + "app_id": 360617, + "app_slug": "gagbo-test-app", + "target_id": 10496163, + "target_type": "User", + "permissions": { + "issues": "write", + "actions": "write", + "metadata": "read", + "pull_requests": "write" + }, + "events": [ + "issues", + "issue_comment", + "pull_request", + "pull_request_review", + "pull_request_review_comment", + "pull_request_review_thread", + "repository" + ], + "created_at": "2023-07-13T09:33:20.000Z", + "updated_at": "2023-07-13T09:33:21.000Z", + "single_file_name": null, + "has_multiple_single_files": false, + "single_file_paths": [ + + ], + "suspended_by": null, + "suspended_at": null + }, + "repositories": [ + { + "id": 29128586, + "node_id": "MDEwOlJlcG9zaXRvcnkyOTEyODU4Ng==", + "name": "ViscoElRebound", + "full_name": "gagbo/ViscoElRebound", + "private": false + }, + { + "id": 51965720, + "node_id": "MDEwOlJlcG9zaXRvcnk1MTk2NTcyMA==", + "name": "Sizr", + "full_name": "gagbo/Sizr", + "private": true + }, + { + "id": 665086759, + "node_id": "R_kgDOJ6RrJw", + "name": "octocrab", + "full_name": "gagbo/octocrab", + "private": false + } + ], + "sender": { + "login": "gagbo", + "id": 10496163, + "node_id": "MDQ6VXNlcjEwNDk2MTYz", + "avatar_url": "https://avatars.githubusercontent.com/u/10496163?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/gagbo", + "html_url": "https://github.com/gagbo", + "followers_url": "https://api.github.com/users/gagbo/followers", + "following_url": "https://api.github.com/users/gagbo/following{/other_user}", + "gists_url": "https://api.github.com/users/gagbo/gists{/gist_id}", + "starred_url": "https://api.github.com/users/gagbo/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/gagbo/subscriptions", + "organizations_url": "https://api.github.com/users/gagbo/orgs", + "repos_url": "https://api.github.com/users/gagbo/repos", + "events_url": "https://api.github.com/users/gagbo/events{/privacy}", + "received_events_url": "https://api.github.com/users/gagbo/received_events", + "type": "User", + "site_admin": false + } +} diff --git a/tests/resources/installation_repositories_removed_webhook_event.json b/tests/resources/installation_repositories_removed_webhook_event.json new file mode 100644 index 00000000..8fa44756 --- /dev/null +++ b/tests/resources/installation_repositories_removed_webhook_event.json @@ -0,0 +1,92 @@ +{ + "action": "removed", + "installation": { + "id": 7777777, + "account": { + "login": "gagbo", + "id": 10496163, + "node_id": "MDQ6VXNlcjEwNDk2MTYz", + "avatar_url": "https://avatars.githubusercontent.com/u/10496163?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/gagbo", + "html_url": "https://github.com/gagbo", + "followers_url": "https://api.github.com/users/gagbo/followers", + "following_url": "https://api.github.com/users/gagbo/following{/other_user}", + "gists_url": "https://api.github.com/users/gagbo/gists{/gist_id}", + "starred_url": "https://api.github.com/users/gagbo/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/gagbo/subscriptions", + "organizations_url": "https://api.github.com/users/gagbo/orgs", + "repos_url": "https://api.github.com/users/gagbo/repos", + "events_url": "https://api.github.com/users/gagbo/events{/privacy}", + "received_events_url": "https://api.github.com/users/gagbo/received_events", + "type": "User", + "site_admin": false + }, + "repository_selection": "all", + "access_tokens_url": "https://api.github.com/app/installations/7777777/access_tokens", + "repositories_url": "https://api.github.com/installation/repositories", + "html_url": "https://github.com/settings/installations/7777777", + "app_id": 360617, + "app_slug": "gagbo-test-app", + "target_id": 10496163, + "target_type": "User", + "permissions": { + "issues": "write", + "actions": "write", + "metadata": "read", + "pull_requests": "write" + }, + "events": [ + "issues", + "issue_comment", + "pull_request", + "pull_request_review", + "pull_request_review_comment", + "pull_request_review_thread", + "repository" + ], + "created_at": "2023-07-13T09:35:31.000Z", + "updated_at": "2023-07-13T09:35:32.000Z", + "single_file_name": null, + "has_multiple_single_files": false, + "single_file_paths": [ + + ], + "suspended_by": null, + "suspended_at": null + }, + "repository_selection": "all", + "repositories_added": [ + + ], + "repositories_removed": [ + { + "id": 455581571, + "node_id": "R_kgDOGyefgw", + "name": "otp", + "full_name": "gagbo/otp", + "private": false + } + ], + "requester": null, + "sender": { + "login": "gagbo", + "id": 10496163, + "node_id": "MDQ6VXNlcjEwNDk2MTYz", + "avatar_url": "https://avatars.githubusercontent.com/u/10496163?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/gagbo", + "html_url": "https://github.com/gagbo", + "followers_url": "https://api.github.com/users/gagbo/followers", + "following_url": "https://api.github.com/users/gagbo/following{/other_user}", + "gists_url": "https://api.github.com/users/gagbo/gists{/gist_id}", + "starred_url": "https://api.github.com/users/gagbo/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/gagbo/subscriptions", + "organizations_url": "https://api.github.com/users/gagbo/orgs", + "repos_url": "https://api.github.com/users/gagbo/repos", + "events_url": "https://api.github.com/users/gagbo/events{/privacy}", + "received_events_url": "https://api.github.com/users/gagbo/received_events", + "type": "User", + "site_admin": false + } +} diff --git a/tests/resources/issue_comment_created_webhook_event.json b/tests/resources/issue_comment_created_webhook_event.json new file mode 100644 index 00000000..72d658b2 --- /dev/null +++ b/tests/resources/issue_comment_created_webhook_event.json @@ -0,0 +1,237 @@ +{ + "action": "created", + "issue": { + "url": "https://api.github.com/repos/gagbo/ouro-closures/issues/1", + "repository_url": "https://api.github.com/repos/gagbo/ouro-closures", + "labels_url": "https://api.github.com/repos/gagbo/ouro-closures/issues/1/labels{/name}", + "comments_url": "https://api.github.com/repos/gagbo/ouro-closures/issues/1/comments", + "events_url": "https://api.github.com/repos/gagbo/ouro-closures/issues/1/events", + "html_url": "https://github.com/gagbo/ouro-closures/issues/1", + "id": 1802701778, + "node_id": "I_kwDOIAlVv85rcwvS", + "number": 1, + "title": "Ping", + "user": { + "login": "gagbo", + "id": 10496163, + "node_id": "MDQ6VXNlcjEwNDk2MTYz", + "avatar_url": "https://avatars.githubusercontent.com/u/10496163?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/gagbo", + "html_url": "https://github.com/gagbo", + "followers_url": "https://api.github.com/users/gagbo/followers", + "following_url": "https://api.github.com/users/gagbo/following{/other_user}", + "gists_url": "https://api.github.com/users/gagbo/gists{/gist_id}", + "starred_url": "https://api.github.com/users/gagbo/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/gagbo/subscriptions", + "organizations_url": "https://api.github.com/users/gagbo/orgs", + "repos_url": "https://api.github.com/users/gagbo/repos", + "events_url": "https://api.github.com/users/gagbo/events{/privacy}", + "received_events_url": "https://api.github.com/users/gagbo/received_events", + "type": "User", + "site_admin": false + }, + "labels": [ + + ], + "state": "open", + "locked": false, + "assignee": null, + "assignees": [ + + ], + "milestone": null, + "comments": 1, + "created_at": "2023-07-13T10:20:09Z", + "updated_at": "2023-07-13T10:20:10Z", + "closed_at": null, + "author_association": "OWNER", + "active_lock_reason": null, + "body": null, + "reactions": { + "url": "https://api.github.com/repos/gagbo/ouro-closures/issues/1/reactions", + "total_count": 0, + "+1": 0, + "-1": 0, + "laugh": 0, + "hooray": 0, + "confused": 0, + "heart": 0, + "rocket": 0, + "eyes": 0 + }, + "timeline_url": "https://api.github.com/repos/gagbo/ouro-closures/issues/1/timeline", + "performed_via_github_app": null, + "state_reason": null + }, + "comment": { + "url": "https://api.github.com/repos/gagbo/ouro-closures/issues/comments/1633968123", + "html_url": "https://github.com/gagbo/ouro-closures/issues/1#issuecomment-1633968123", + "issue_url": "https://api.github.com/repos/gagbo/ouro-closures/issues/1", + "id": 1633968123, + "node_id": "IC_kwDOIAlVv85hZF_7", + "user": { + "login": "gagbo-test-app[bot]", + "id": 139451816, + "node_id": "BOT_kgDOCE_dqA", + "avatar_url": "https://avatars.githubusercontent.com/u/10496163?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/gagbo-test-app%5Bbot%5D", + "html_url": "https://github.com/apps/gagbo-test-app", + "followers_url": "https://api.github.com/users/gagbo-test-app%5Bbot%5D/followers", + "following_url": "https://api.github.com/users/gagbo-test-app%5Bbot%5D/following{/other_user}", + "gists_url": "https://api.github.com/users/gagbo-test-app%5Bbot%5D/gists{/gist_id}", + "starred_url": "https://api.github.com/users/gagbo-test-app%5Bbot%5D/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/gagbo-test-app%5Bbot%5D/subscriptions", + "organizations_url": "https://api.github.com/users/gagbo-test-app%5Bbot%5D/orgs", + "repos_url": "https://api.github.com/users/gagbo-test-app%5Bbot%5D/repos", + "events_url": "https://api.github.com/users/gagbo-test-app%5Bbot%5D/events{/privacy}", + "received_events_url": "https://api.github.com/users/gagbo-test-app%5Bbot%5D/received_events", + "type": "Bot", + "site_admin": false + }, + "created_at": "2023-07-13T10:20:10Z", + "updated_at": "2023-07-13T10:20:10Z", + "author_association": "NONE", + "body": "Just received an event for that issue IssuesEventPayload { action: Opened, issue: Issue { id: IssueId(1802701778), node_id: \"I_kwDOIAlVv85rcwvS\", url: Url { scheme: \"https\", cannot_be_a_base: false, username: \"\", password: None, host: Some(Domain(\"api.github.com\")), port: None, path: \"/repos/gagbo/ouro-closures/issues/1\", query: None, fragment: None }, repository_url: Url { scheme: \"https\", cannot_be_a_base: false, username: \"\", password: None, host: Some(Domain(\"api.github.com\")), port: None, path: \"/repos/gagbo/ouro-closures\", query: None, fragment: None }, labels_url: Url { scheme: \"https\", cannot_be_a_base: false, username: \"\", password: None, host: Some(Domain(\"api.github.com\")), port: None, path: \"/repos/gagbo/ouro-closures/issues/1/labels%7B/name%7D\", query: None, fragment: None }, comments_url: Url { scheme: \"https\", cannot_be_a_base: false, username: \"\", password: None, host: Some(Domain(\"api.github.com\")), port: None, path: \"/repos/gagbo/ouro-closures/issues/1/comments\", query: None, fragment: None }, events_url: Url { scheme: \"https\", cannot_be_a_base: false, username: \"\", password: None, host: Some(Domain(\"api.github.com\")), port: None, path: \"/repos/gagbo/ouro-closures/issues/1/events\", query: None, fragment: None }, html_url: Url { scheme: \"https\", cannot_be_a_base: false, username: \"\", password: None, host: Some(Domain(\"github.com\")), port: None, path: \"/gagbo/ouro-closures/issues/1\", query: None, fragment: None }, number: 1, state: Open, state_reason: None, title: \"Ping\", body: None, body_text: None, body_html: None, user: Author { login: \"gagbo\", id: UserId(10496163), node_id: \"MDQ6VXNlcjEwNDk2MTYz\", avatar_url: Url { scheme: \"https\", cannot_be_a_base: false, username: \"\", password: None, host: Some(Domain(\"avatars.githubusercontent.com\")), port: None, path: \"/u/10496163\", query: Some(\"v=4\"), fragment: None }, gravatar_id: \"\", url: Url { scheme: \"https\", cannot_be_a_base: false, username: \"\", password: None, host: Some(Domain(\"api.github.com\")), port: None, path: \"/users/gagbo\", query: None, fragment: None }, html_url: Url { scheme: \"https\", cannot_be_a_base: false, username: \"\", password: None, host: Some(Domain(\"github.com\")), port: None, path: \"/gagbo\", query: None, fragment: None }, followers_url: Url { scheme: \"https\", cannot_be_a_base: false, username: \"\", password: None, host: Some(Domain(\"api.github.com\")), port: None, path: \"/users/gagbo/followers\", query: None, fragment: None }, following_url: Url { scheme: \"https\", cannot_be_a_base: false, username: \"\", password: None, host: Some(Domain(\"api.github.com\")), port: None, path: \"/users/gagbo/following%7B/other_user%7D\", query: None, fragment: None }, gists_url: Url { scheme: \"https\", cannot_be_a_base: false, username: \"\", password: None, host: Some(Domain(\"api.github.com\")), port: None, path: \"/users/gagbo/gists%7B/gist_id%7D\", query: None, fragment: None }, starred_url: Url { scheme: \"https\", cannot_be_a_base: false, username: \"\", password: None, host: Some(Domain(\"api.github.com\")), port: None, path: \"/users/gagbo/starred%7B/owner%7D%7B/repo%7D\", query: None, fragment: None }, subscriptions_url: Url { scheme: \"https\", cannot_be_a_base: false, username: \"\", password: None, host: Some(Domain(\"api.github.com\")), port: None, path: \"/users/gagbo/subscriptions\", query: None, fragment: None }, organizations_url: Url { scheme: \"https\", cannot_be_a_base: false, username: \"\", password: None, host: Some(Domain(\"api.github.com\")), port: None, path: \"/users/gagbo/orgs\", query: None, fragment: None }, repos_url: Url { scheme: \"https\", cannot_be_a_base: false, username: \"\", password: None, host: Some(Domain(\"api.github.com\")), port: None, path: \"/users/gagbo/repos\", query: None, fragment: None }, events_url: Url { scheme: \"https\", cannot_be_a_base: false, username: \"\", password: None, host: Some(Domain(\"api.github.com\")), port: None, path: \"/users/gagbo/events%7B/privacy%7D\", query: None, fragment: None }, received_events_url: Url { scheme: \"https\", cannot_be_a_base: false, username: \"\", password: None, host: Some(Domain(\"api.github.com\")), port: None, path: \"/users/gagbo/received_events\", query: None, fragment: None }, type: \"User\", site_admin: false }, labels: [], assignee: None, assignees: [], author_association: \"OWNER\", milestone: None, locked: false, active_lock_reason: None, comments: 0, pull_request: None, closed_at: None, created_at: 2023-07-13T10:20:09Z, updated_at: 2023-07-13T10:20:09Z }, changes: None, assignee: None, label: None }", + "reactions": { + "url": "https://api.github.com/repos/gagbo/ouro-closures/issues/comments/1633968123/reactions", + "total_count": 0, + "+1": 0, + "-1": 0, + "laugh": 0, + "hooray": 0, + "confused": 0, + "heart": 0, + "rocket": 0, + "eyes": 0 + }, + "performed_via_github_app": null + }, + "repository": { + "id": 537482687, + "node_id": "R_kgDOIAlVvw", + "name": "ouro-closures", + "full_name": "gagbo/ouro-closures", + "private": false, + "owner": { + "login": "gagbo", + "id": 10496163, + "node_id": "MDQ6VXNlcjEwNDk2MTYz", + "avatar_url": "https://avatars.githubusercontent.com/u/10496163?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/gagbo", + "html_url": "https://github.com/gagbo", + "followers_url": "https://api.github.com/users/gagbo/followers", + "following_url": "https://api.github.com/users/gagbo/following{/other_user}", + "gists_url": "https://api.github.com/users/gagbo/gists{/gist_id}", + "starred_url": "https://api.github.com/users/gagbo/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/gagbo/subscriptions", + "organizations_url": "https://api.github.com/users/gagbo/orgs", + "repos_url": "https://api.github.com/users/gagbo/repos", + "events_url": "https://api.github.com/users/gagbo/events{/privacy}", + "received_events_url": "https://api.github.com/users/gagbo/received_events", + "type": "User", + "site_admin": false + }, + "html_url": "https://github.com/gagbo/ouro-closures", + "description": "Draft to test self-referencing closure captures for r7", + "fork": false, + "url": "https://api.github.com/repos/gagbo/ouro-closures", + "forks_url": "https://api.github.com/repos/gagbo/ouro-closures/forks", + "keys_url": "https://api.github.com/repos/gagbo/ouro-closures/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/gagbo/ouro-closures/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/gagbo/ouro-closures/teams", + "hooks_url": "https://api.github.com/repos/gagbo/ouro-closures/hooks", + "issue_events_url": "https://api.github.com/repos/gagbo/ouro-closures/issues/events{/number}", + "events_url": "https://api.github.com/repos/gagbo/ouro-closures/events", + "assignees_url": "https://api.github.com/repos/gagbo/ouro-closures/assignees{/user}", + "branches_url": "https://api.github.com/repos/gagbo/ouro-closures/branches{/branch}", + "tags_url": "https://api.github.com/repos/gagbo/ouro-closures/tags", + "blobs_url": "https://api.github.com/repos/gagbo/ouro-closures/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/gagbo/ouro-closures/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/gagbo/ouro-closures/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/gagbo/ouro-closures/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/gagbo/ouro-closures/statuses/{sha}", + "languages_url": "https://api.github.com/repos/gagbo/ouro-closures/languages", + "stargazers_url": "https://api.github.com/repos/gagbo/ouro-closures/stargazers", + "contributors_url": "https://api.github.com/repos/gagbo/ouro-closures/contributors", + "subscribers_url": "https://api.github.com/repos/gagbo/ouro-closures/subscribers", + "subscription_url": "https://api.github.com/repos/gagbo/ouro-closures/subscription", + "commits_url": "https://api.github.com/repos/gagbo/ouro-closures/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/gagbo/ouro-closures/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/gagbo/ouro-closures/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/gagbo/ouro-closures/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/gagbo/ouro-closures/contents/{+path}", + "compare_url": "https://api.github.com/repos/gagbo/ouro-closures/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/gagbo/ouro-closures/merges", + "archive_url": "https://api.github.com/repos/gagbo/ouro-closures/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/gagbo/ouro-closures/downloads", + "issues_url": "https://api.github.com/repos/gagbo/ouro-closures/issues{/number}", + "pulls_url": "https://api.github.com/repos/gagbo/ouro-closures/pulls{/number}", + "milestones_url": "https://api.github.com/repos/gagbo/ouro-closures/milestones{/number}", + "notifications_url": "https://api.github.com/repos/gagbo/ouro-closures/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/gagbo/ouro-closures/labels{/name}", + "releases_url": "https://api.github.com/repos/gagbo/ouro-closures/releases{/id}", + "deployments_url": "https://api.github.com/repos/gagbo/ouro-closures/deployments", + "created_at": "2022-09-16T14:02:04Z", + "updated_at": "2022-09-16T14:05:56Z", + "pushed_at": "2022-09-16T14:05:51Z", + "git_url": "git://github.com/gagbo/ouro-closures.git", + "ssh_url": "git@github.com:gagbo/ouro-closures.git", + "clone_url": "https://github.com/gagbo/ouro-closures.git", + "svn_url": "https://github.com/gagbo/ouro-closures", + "homepage": null, + "size": 2, + "stargazers_count": 0, + "watchers_count": 0, + "language": "Rust", + "has_issues": true, + "has_projects": true, + "has_downloads": true, + "has_wiki": true, + "has_pages": false, + "has_discussions": false, + "forks_count": 0, + "mirror_url": null, + "archived": false, + "disabled": false, + "open_issues_count": 1, + "license": null, + "allow_forking": true, + "is_template": false, + "web_commit_signoff_required": false, + "topics": [ + + ], + "visibility": "public", + "forks": 0, + "open_issues": 1, + "watchers": 0, + "default_branch": "trunk" + }, + "sender": { + "login": "gagbo-test-app[bot]", + "id": 139451816, + "node_id": "BOT_kgDOCE_dqA", + "avatar_url": "https://avatars.githubusercontent.com/u/10496163?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/gagbo-test-app%5Bbot%5D", + "html_url": "https://github.com/apps/gagbo-test-app", + "followers_url": "https://api.github.com/users/gagbo-test-app%5Bbot%5D/followers", + "following_url": "https://api.github.com/users/gagbo-test-app%5Bbot%5D/following{/other_user}", + "gists_url": "https://api.github.com/users/gagbo-test-app%5Bbot%5D/gists{/gist_id}", + "starred_url": "https://api.github.com/users/gagbo-test-app%5Bbot%5D/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/gagbo-test-app%5Bbot%5D/subscriptions", + "organizations_url": "https://api.github.com/users/gagbo-test-app%5Bbot%5D/orgs", + "repos_url": "https://api.github.com/users/gagbo-test-app%5Bbot%5D/repos", + "events_url": "https://api.github.com/users/gagbo-test-app%5Bbot%5D/events{/privacy}", + "received_events_url": "https://api.github.com/users/gagbo-test-app%5Bbot%5D/received_events", + "type": "Bot", + "site_admin": false + }, + "installation": { + "id": 7777777, + "node_id": "WHEmPF0sNlxkQU1lPnEiWUdUTDwwYVo9QGlNaEkiQmQhdi1uZCEvc2E1NX1FOA==" + } +} diff --git a/tests/resources/issue_comment_deleted_webhook_event.json b/tests/resources/issue_comment_deleted_webhook_event.json new file mode 100644 index 00000000..3a7dc08a --- /dev/null +++ b/tests/resources/issue_comment_deleted_webhook_event.json @@ -0,0 +1,245 @@ +{ + "action": "deleted", + "issue": { + "url": "https://api.github.com/repos/gagbo/ouro-closures/issues/5", + "repository_url": "https://api.github.com/repos/gagbo/ouro-closures", + "labels_url": "https://api.github.com/repos/gagbo/ouro-closures/issues/5/labels{/name}", + "comments_url": "https://api.github.com/repos/gagbo/ouro-closures/issues/5/comments", + "events_url": "https://api.github.com/repos/gagbo/ouro-closures/issues/5/events", + "html_url": "https://github.com/gagbo/ouro-closures/pull/5", + "id": 1809968711, + "node_id": "PR_kwDOIAlVv85VycFv", + "number": 5, + "title": "[do not merge] test commit", + "user": { + "login": "gagbo", + "id": 10496163, + "node_id": "MDQ6VXNlcjEwNDk2MTYz", + "avatar_url": "https://avatars.githubusercontent.com/u/10496163?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/gagbo", + "html_url": "https://github.com/gagbo", + "followers_url": "https://api.github.com/users/gagbo/followers", + "following_url": "https://api.github.com/users/gagbo/following{/other_user}", + "gists_url": "https://api.github.com/users/gagbo/gists{/gist_id}", + "starred_url": "https://api.github.com/users/gagbo/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/gagbo/subscriptions", + "organizations_url": "https://api.github.com/users/gagbo/orgs", + "repos_url": "https://api.github.com/users/gagbo/repos", + "events_url": "https://api.github.com/users/gagbo/events{/privacy}", + "received_events_url": "https://api.github.com/users/gagbo/received_events", + "type": "User", + "site_admin": false + }, + "labels": [ + + ], + "state": "open", + "locked": false, + "assignee": null, + "assignees": [ + + ], + "milestone": null, + "comments": 2, + "created_at": "2023-07-18T13:43:27Z", + "updated_at": "2023-07-18T13:54:28Z", + "closed_at": null, + "author_association": "OWNER", + "active_lock_reason": null, + "draft": false, + "pull_request": { + "url": "https://api.github.com/repos/gagbo/ouro-closures/pulls/5", + "html_url": "https://github.com/gagbo/ouro-closures/pull/5", + "diff_url": "https://github.com/gagbo/ouro-closures/pull/5.diff", + "patch_url": "https://github.com/gagbo/ouro-closures/pull/5.patch", + "merged_at": null + }, + "body": null, + "reactions": { + "url": "https://api.github.com/repos/gagbo/ouro-closures/issues/5/reactions", + "total_count": 0, + "+1": 0, + "-1": 0, + "laugh": 0, + "hooray": 0, + "confused": 0, + "heart": 0, + "rocket": 0, + "eyes": 0 + }, + "timeline_url": "https://api.github.com/repos/gagbo/ouro-closures/issues/5/timeline", + "performed_via_github_app": null, + "state_reason": null + }, + "comment": { + "url": "https://api.github.com/repos/gagbo/ouro-closures/issues/comments/1640276806", + "html_url": "https://github.com/gagbo/ouro-closures/pull/5#issuecomment-1640276806", + "issue_url": "https://api.github.com/repos/gagbo/ouro-closures/issues/5", + "id": 1640276806, + "node_id": "IC_kwDOIAlVv85hxKNG", + "user": { + "login": "gagbo-test-app[bot]", + "id": 139451816, + "node_id": "BOT_kgDOCE_dqA", + "avatar_url": "https://avatars.githubusercontent.com/u/10496163?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/gagbo-test-app%5Bbot%5D", + "html_url": "https://github.com/apps/gagbo-test-app", + "followers_url": "https://api.github.com/users/gagbo-test-app%5Bbot%5D/followers", + "following_url": "https://api.github.com/users/gagbo-test-app%5Bbot%5D/following{/other_user}", + "gists_url": "https://api.github.com/users/gagbo-test-app%5Bbot%5D/gists{/gist_id}", + "starred_url": "https://api.github.com/users/gagbo-test-app%5Bbot%5D/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/gagbo-test-app%5Bbot%5D/subscriptions", + "organizations_url": "https://api.github.com/users/gagbo-test-app%5Bbot%5D/orgs", + "repos_url": "https://api.github.com/users/gagbo-test-app%5Bbot%5D/repos", + "events_url": "https://api.github.com/users/gagbo-test-app%5Bbot%5D/events{/privacy}", + "received_events_url": "https://api.github.com/users/gagbo-test-app%5Bbot%5D/received_events", + "type": "Bot", + "site_admin": false + }, + "created_at": "2023-07-18T13:54:28Z", + "updated_at": "2023-07-18T13:54:28Z", + "author_association": "NONE", + "body": "Just received an event for that issue IssuesEventPayload { action: Edited, issue: Issue { id: IssueId(1809968711), node_id: \"PR_kwDOIAlVv85VycFv\", url: Url { scheme: \"https\", cannot_be_a_base: false, username: \"\", password: None, host: Some(Domain(\"api.github.com\")), port: None, path: \"/repos/gagbo/ouro-closures/issues/5\", query: None, fragment: None }, repository_url: Url { scheme: \"https\", cannot_be_a_base: false, username: \"\", password: None, host: Some(Domain(\"api.github.com\")), port: None, path: \"/repos/gagbo/ouro-closures\", query: None, fragment: None }, labels_url: Url { scheme: \"https\", cannot_be_a_base: false, username: \"\", password: None, host: Some(Domain(\"api.github.com\")), port: None, path: \"/repos/gagbo/ouro-closures/issues/5/labels%7B/name%7D\", query: None, fragment: None }, comments_url: Url { scheme: \"https\", cannot_be_a_base: false, username: \"\", password: None, host: Some(Domain(\"api.github.com\")), port: None, path: \"/repos/gagbo/ouro-closures/issues/5/comments\", query: None, fragment: None }, events_url: Url { scheme: \"https\", cannot_be_a_base: false, username: \"\", password: None, host: Some(Domain(\"api.github.com\")), port: None, path: \"/repos/gagbo/ouro-closures/issues/5/events\", query: None, fragment: None }, html_url: Url { scheme: \"https\", cannot_be_a_base: false, username: \"\", password: None, host: Some(Domain(\"github.com\")), port: None, path: \"/gagbo/ouro-closures/pull/5\", query: None, fragment: None }, number: 5, state: Open, state_reason: None, title: \"[do not merge] test commit\", body: None, body_text: None, body_html: None, user: Author { login: \"gagbo\", id: UserId(10496163), node_id: \"MDQ6VXNlcjEwNDk2MTYz\", avatar_url: Url { scheme: \"https\", cannot_be_a_base: false, username: \"\", password: None, host: Some(Domain(\"avatars.githubusercontent.com\")), port: None, path: \"/u/10496163\", query: Some(\"v=4\"), fragment: None }, gravatar_id: \"\", url: Url { scheme: \"https\", cannot_be_a_base: false, username: \"\", password: None, host: Some(Domain(\"api.github.com\")), port: None, path: \"/users/gagbo\", query: None, fragment: None }, html_url: Url { scheme: \"https\", cannot_be_a_base: false, username: \"\", password: None, host: Some(Domain(\"github.com\")), port: None, path: \"/gagbo\", query: None, fragment: None }, followers_url: Url { scheme: \"https\", cannot_be_a_base: false, username: \"\", password: None, host: Some(Domain(\"api.github.com\")), port: None, path: \"/users/gagbo/followers\", query: None, fragment: None }, following_url: Url { scheme: \"https\", cannot_be_a_base: false, username: \"\", password: None, host: Some(Domain(\"api.github.com\")), port: None, path: \"/users/gagbo/following%7B/other_user%7D\", query: None, fragment: None }, gists_url: Url { scheme: \"https\", cannot_be_a_base: false, username: \"\", password: None, host: Some(Domain(\"api.github.com\")), port: None, path: \"/users/gagbo/gists%7B/gist_id%7D\", query: None, fragment: None }, starred_url: Url { scheme: \"https\", cannot_be_a_base: false, username: \"\", password: None, host: Some(Domain(\"api.github.com\")), port: None, path: \"/users/gagbo/starred%7B/owner%7D%7B/repo%7D\", query: None, fragment: None }, subscriptions_url: Url { scheme: \"https\", cannot_be_a_base: false, username: \"\", password: None, host: Some(Domain(\"api.github.com\")), port: None, path: \"/users/gagbo/subscriptions\", query: None, fragment: None }, organizations_url: Url { scheme: \"https\", cannot_be_a_base: false, username: \"\", password: None, host: Some(Domain(\"api.github.com\")), port: None, path: \"/users/gagbo/orgs\", query: None, fragment: None }, repos_url: Url { scheme: \"https\", cannot_be_a_base: false, username: \"\", password: None, host: Some(Domain(\"api.github.com\")), port: None, path: \"/users/gagbo/repos\", query: None, fragment: None }, events_url: Url { scheme: \"https\", cannot_be_a_base: false, username: \"\", password: None, host: Some(Domain(\"api.github.com\")), port: None, path: \"/users/gagbo/events%7B/privacy%7D\", query: None, fragment: None }, received_events_url: Url { scheme: \"https\", cannot_be_a_base: false, username: \"\", password: None, host: Some(Domain(\"api.github.com\")), port: None, path: \"/users/gagbo/received_events\", query: None, fragment: None }, type: \"User\", site_admin: false }, labels: [], assignee: None, assignees: [], author_association: \"OWNER\", milestone: None, locked: false, active_lock_reason: None, comments: 1, pull_request: Some(PullRequestLink { url: Url { scheme: \"https\", cannot_be_a_base: false, username: \"\", password: None, host: Some(Domain(\"api.github.com\")), port: None, path: \"/repos/gagbo/ouro-closures/pulls/5\", query: None, fragment: None }, html_url: Url { scheme: \"https\", cannot_be_a_base: false, username: \"\", password: None, host: Some(Domain(\"github.com\")), port: None, path: \"/gagbo/ouro-closures/pull/5\", query: None, fragment: None }, diff_url: Url { scheme: \"https\", cannot_be_a_base: false, username: \"\", password: None, host: Some(Domain(\"github.com\")), port: None, path: \"/gagbo/ouro-closures/pull/5.diff\", query: None, fragment: None }, patch_url: Url { scheme: \"https\", cannot_be_a_base: false, username: \"\", password: None, host: Some(Domain(\"github.com\")), port: None, path: \"/gagbo/ouro-closures/pull/5.patch\", query: None, fragment: None } }), closed_at: None, created_at: 2023-07-18T13:43:27Z, updated_at: 2023-07-18T13:54:26Z }, changes: Some(Body(IssuesEventChangesFrom { from: \"# ![Autometrics logo](https://explorer.autometrics.dev/favicon.raw.19b993d4.svg) Autometrics Report\\nComparison from ea6cd405a443e34aca1f57485ee151fb15a34729 -> 36afaef2afdf0ce794d7e4663e7f327664aaa4d7\\nNo change\\n\\n\\n\\nAutometrics\" })), assignee: None, label: None }", + "reactions": { + "url": "https://api.github.com/repos/gagbo/ouro-closures/issues/comments/1640276806/reactions", + "total_count": 0, + "+1": 0, + "-1": 0, + "laugh": 0, + "hooray": 0, + "confused": 0, + "heart": 0, + "rocket": 0, + "eyes": 0 + }, + "performed_via_github_app": null + }, + "repository": { + "id": 537482687, + "node_id": "R_kgDOIAlVvw", + "name": "ouro-closures", + "full_name": "gagbo/ouro-closures", + "private": false, + "owner": { + "login": "gagbo", + "id": 10496163, + "node_id": "MDQ6VXNlcjEwNDk2MTYz", + "avatar_url": "https://avatars.githubusercontent.com/u/10496163?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/gagbo", + "html_url": "https://github.com/gagbo", + "followers_url": "https://api.github.com/users/gagbo/followers", + "following_url": "https://api.github.com/users/gagbo/following{/other_user}", + "gists_url": "https://api.github.com/users/gagbo/gists{/gist_id}", + "starred_url": "https://api.github.com/users/gagbo/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/gagbo/subscriptions", + "organizations_url": "https://api.github.com/users/gagbo/orgs", + "repos_url": "https://api.github.com/users/gagbo/repos", + "events_url": "https://api.github.com/users/gagbo/events{/privacy}", + "received_events_url": "https://api.github.com/users/gagbo/received_events", + "type": "User", + "site_admin": false + }, + "html_url": "https://github.com/gagbo/ouro-closures", + "description": "Draft to test self-referencing closure captures for r7", + "fork": false, + "url": "https://api.github.com/repos/gagbo/ouro-closures", + "forks_url": "https://api.github.com/repos/gagbo/ouro-closures/forks", + "keys_url": "https://api.github.com/repos/gagbo/ouro-closures/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/gagbo/ouro-closures/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/gagbo/ouro-closures/teams", + "hooks_url": "https://api.github.com/repos/gagbo/ouro-closures/hooks", + "issue_events_url": "https://api.github.com/repos/gagbo/ouro-closures/issues/events{/number}", + "events_url": "https://api.github.com/repos/gagbo/ouro-closures/events", + "assignees_url": "https://api.github.com/repos/gagbo/ouro-closures/assignees{/user}", + "branches_url": "https://api.github.com/repos/gagbo/ouro-closures/branches{/branch}", + "tags_url": "https://api.github.com/repos/gagbo/ouro-closures/tags", + "blobs_url": "https://api.github.com/repos/gagbo/ouro-closures/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/gagbo/ouro-closures/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/gagbo/ouro-closures/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/gagbo/ouro-closures/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/gagbo/ouro-closures/statuses/{sha}", + "languages_url": "https://api.github.com/repos/gagbo/ouro-closures/languages", + "stargazers_url": "https://api.github.com/repos/gagbo/ouro-closures/stargazers", + "contributors_url": "https://api.github.com/repos/gagbo/ouro-closures/contributors", + "subscribers_url": "https://api.github.com/repos/gagbo/ouro-closures/subscribers", + "subscription_url": "https://api.github.com/repos/gagbo/ouro-closures/subscription", + "commits_url": "https://api.github.com/repos/gagbo/ouro-closures/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/gagbo/ouro-closures/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/gagbo/ouro-closures/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/gagbo/ouro-closures/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/gagbo/ouro-closures/contents/{+path}", + "compare_url": "https://api.github.com/repos/gagbo/ouro-closures/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/gagbo/ouro-closures/merges", + "archive_url": "https://api.github.com/repos/gagbo/ouro-closures/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/gagbo/ouro-closures/downloads", + "issues_url": "https://api.github.com/repos/gagbo/ouro-closures/issues{/number}", + "pulls_url": "https://api.github.com/repos/gagbo/ouro-closures/pulls{/number}", + "milestones_url": "https://api.github.com/repos/gagbo/ouro-closures/milestones{/number}", + "notifications_url": "https://api.github.com/repos/gagbo/ouro-closures/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/gagbo/ouro-closures/labels{/name}", + "releases_url": "https://api.github.com/repos/gagbo/ouro-closures/releases{/id}", + "deployments_url": "https://api.github.com/repos/gagbo/ouro-closures/deployments", + "created_at": "2022-09-16T14:02:04Z", + "updated_at": "2022-09-16T14:05:56Z", + "pushed_at": "2023-07-18T13:54:23Z", + "git_url": "git://github.com/gagbo/ouro-closures.git", + "ssh_url": "git@github.com:gagbo/ouro-closures.git", + "clone_url": "https://github.com/gagbo/ouro-closures.git", + "svn_url": "https://github.com/gagbo/ouro-closures", + "homepage": null, + "size": 2, + "stargazers_count": 0, + "watchers_count": 0, + "language": "Rust", + "has_issues": true, + "has_projects": true, + "has_downloads": true, + "has_wiki": true, + "has_pages": false, + "has_discussions": false, + "forks_count": 0, + "mirror_url": null, + "archived": false, + "disabled": false, + "open_issues_count": 2, + "license": null, + "allow_forking": true, + "is_template": false, + "web_commit_signoff_required": false, + "topics": [ + + ], + "visibility": "public", + "forks": 0, + "open_issues": 2, + "watchers": 0, + "default_branch": "trunk" + }, + "sender": { + "login": "gagbo", + "id": 10496163, + "node_id": "MDQ6VXNlcjEwNDk2MTYz", + "avatar_url": "https://avatars.githubusercontent.com/u/10496163?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/gagbo", + "html_url": "https://github.com/gagbo", + "followers_url": "https://api.github.com/users/gagbo/followers", + "following_url": "https://api.github.com/users/gagbo/following{/other_user}", + "gists_url": "https://api.github.com/users/gagbo/gists{/gist_id}", + "starred_url": "https://api.github.com/users/gagbo/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/gagbo/subscriptions", + "organizations_url": "https://api.github.com/users/gagbo/orgs", + "repos_url": "https://api.github.com/users/gagbo/repos", + "events_url": "https://api.github.com/users/gagbo/events{/privacy}", + "received_events_url": "https://api.github.com/users/gagbo/received_events", + "type": "User", + "site_admin": false + }, + "installation": { + "id": 7777777, + "node_id": "WHEmPF0sNlxkQU1lPnEiWUdUTDwwYVo9QGlNaEkiQmQhdi1uZCEvc2E1NX1FOA==" + } +} diff --git a/tests/resources/issue_comment_edited_webhook_event.json b/tests/resources/issue_comment_edited_webhook_event.json new file mode 100644 index 00000000..91d2063c --- /dev/null +++ b/tests/resources/issue_comment_edited_webhook_event.json @@ -0,0 +1,250 @@ +{ + "action": "edited", + "changes": { + "body": { + "from": "# ![Autometrics logo](https://explorer.autometrics.dev/favicon.raw.19b993d4.svg) Autometrics Report\nComparison from ea6cd405a443e34aca1f57485ee151fb15a34729 -> 36afaef2afdf0ce794d7e4663e7f327664aaa4d7\nNo change\n\n\n\nAutometrics" + } + }, + "issue": { + "url": "https://api.github.com/repos/gagbo/ouro-closures/issues/5", + "repository_url": "https://api.github.com/repos/gagbo/ouro-closures", + "labels_url": "https://api.github.com/repos/gagbo/ouro-closures/issues/5/labels{/name}", + "comments_url": "https://api.github.com/repos/gagbo/ouro-closures/issues/5/comments", + "events_url": "https://api.github.com/repos/gagbo/ouro-closures/issues/5/events", + "html_url": "https://github.com/gagbo/ouro-closures/pull/5", + "id": 1809968711, + "node_id": "PR_kwDOIAlVv85VycFv", + "number": 5, + "title": "[do not merge] test commit", + "user": { + "login": "gagbo", + "id": 10496163, + "node_id": "MDQ6VXNlcjEwNDk2MTYz", + "avatar_url": "https://avatars.githubusercontent.com/u/10496163?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/gagbo", + "html_url": "https://github.com/gagbo", + "followers_url": "https://api.github.com/users/gagbo/followers", + "following_url": "https://api.github.com/users/gagbo/following{/other_user}", + "gists_url": "https://api.github.com/users/gagbo/gists{/gist_id}", + "starred_url": "https://api.github.com/users/gagbo/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/gagbo/subscriptions", + "organizations_url": "https://api.github.com/users/gagbo/orgs", + "repos_url": "https://api.github.com/users/gagbo/repos", + "events_url": "https://api.github.com/users/gagbo/events{/privacy}", + "received_events_url": "https://api.github.com/users/gagbo/received_events", + "type": "User", + "site_admin": false + }, + "labels": [ + + ], + "state": "open", + "locked": false, + "assignee": null, + "assignees": [ + + ], + "milestone": null, + "comments": 1, + "created_at": "2023-07-18T13:43:27Z", + "updated_at": "2023-07-18T13:54:26Z", + "closed_at": null, + "author_association": "OWNER", + "active_lock_reason": null, + "draft": false, + "pull_request": { + "url": "https://api.github.com/repos/gagbo/ouro-closures/pulls/5", + "html_url": "https://github.com/gagbo/ouro-closures/pull/5", + "diff_url": "https://github.com/gagbo/ouro-closures/pull/5.diff", + "patch_url": "https://github.com/gagbo/ouro-closures/pull/5.patch", + "merged_at": null + }, + "body": null, + "reactions": { + "url": "https://api.github.com/repos/gagbo/ouro-closures/issues/5/reactions", + "total_count": 0, + "+1": 0, + "-1": 0, + "laugh": 0, + "hooray": 0, + "confused": 0, + "heart": 0, + "rocket": 0, + "eyes": 0 + }, + "timeline_url": "https://api.github.com/repos/gagbo/ouro-closures/issues/5/timeline", + "performed_via_github_app": null, + "state_reason": null + }, + "comment": { + "url": "https://api.github.com/repos/gagbo/ouro-closures/issues/comments/1640255529", + "html_url": "https://github.com/gagbo/ouro-closures/pull/5#issuecomment-1640255529", + "issue_url": "https://api.github.com/repos/gagbo/ouro-closures/issues/5", + "id": 1640255529, + "node_id": "IC_kwDOIAlVv85hxFAp", + "user": { + "login": "gagbo-test-app[bot]", + "id": 139451816, + "node_id": "BOT_kgDOCE_dqA", + "avatar_url": "https://avatars.githubusercontent.com/u/10496163?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/gagbo-test-app%5Bbot%5D", + "html_url": "https://github.com/apps/gagbo-test-app", + "followers_url": "https://api.github.com/users/gagbo-test-app%5Bbot%5D/followers", + "following_url": "https://api.github.com/users/gagbo-test-app%5Bbot%5D/following{/other_user}", + "gists_url": "https://api.github.com/users/gagbo-test-app%5Bbot%5D/gists{/gist_id}", + "starred_url": "https://api.github.com/users/gagbo-test-app%5Bbot%5D/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/gagbo-test-app%5Bbot%5D/subscriptions", + "organizations_url": "https://api.github.com/users/gagbo-test-app%5Bbot%5D/orgs", + "repos_url": "https://api.github.com/users/gagbo-test-app%5Bbot%5D/repos", + "events_url": "https://api.github.com/users/gagbo-test-app%5Bbot%5D/events{/privacy}", + "received_events_url": "https://api.github.com/users/gagbo-test-app%5Bbot%5D/received_events", + "type": "Bot", + "site_admin": false + }, + "created_at": "2023-07-18T13:43:30Z", + "updated_at": "2023-07-18T13:54:26Z", + "author_association": "NONE", + "body": "# ![Autometrics logo](https://explorer.autometrics.dev/favicon.raw.19b993d4.svg) Autometrics Report\nComparison from ea6cd405a443e34aca1f57485ee151fb15a34729 -> 7e39d83fc6a99f2c6a02cc7637c4de8db50da6ca\nNo change\n\n\n\nAutometrics", + "reactions": { + "url": "https://api.github.com/repos/gagbo/ouro-closures/issues/comments/1640255529/reactions", + "total_count": 0, + "+1": 0, + "-1": 0, + "laugh": 0, + "hooray": 0, + "confused": 0, + "heart": 0, + "rocket": 0, + "eyes": 0 + }, + "performed_via_github_app": null + }, + "repository": { + "id": 537482687, + "node_id": "R_kgDOIAlVvw", + "name": "ouro-closures", + "full_name": "gagbo/ouro-closures", + "private": false, + "owner": { + "login": "gagbo", + "id": 10496163, + "node_id": "MDQ6VXNlcjEwNDk2MTYz", + "avatar_url": "https://avatars.githubusercontent.com/u/10496163?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/gagbo", + "html_url": "https://github.com/gagbo", + "followers_url": "https://api.github.com/users/gagbo/followers", + "following_url": "https://api.github.com/users/gagbo/following{/other_user}", + "gists_url": "https://api.github.com/users/gagbo/gists{/gist_id}", + "starred_url": "https://api.github.com/users/gagbo/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/gagbo/subscriptions", + "organizations_url": "https://api.github.com/users/gagbo/orgs", + "repos_url": "https://api.github.com/users/gagbo/repos", + "events_url": "https://api.github.com/users/gagbo/events{/privacy}", + "received_events_url": "https://api.github.com/users/gagbo/received_events", + "type": "User", + "site_admin": false + }, + "html_url": "https://github.com/gagbo/ouro-closures", + "description": "Draft to test self-referencing closure captures for r7", + "fork": false, + "url": "https://api.github.com/repos/gagbo/ouro-closures", + "forks_url": "https://api.github.com/repos/gagbo/ouro-closures/forks", + "keys_url": "https://api.github.com/repos/gagbo/ouro-closures/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/gagbo/ouro-closures/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/gagbo/ouro-closures/teams", + "hooks_url": "https://api.github.com/repos/gagbo/ouro-closures/hooks", + "issue_events_url": "https://api.github.com/repos/gagbo/ouro-closures/issues/events{/number}", + "events_url": "https://api.github.com/repos/gagbo/ouro-closures/events", + "assignees_url": "https://api.github.com/repos/gagbo/ouro-closures/assignees{/user}", + "branches_url": "https://api.github.com/repos/gagbo/ouro-closures/branches{/branch}", + "tags_url": "https://api.github.com/repos/gagbo/ouro-closures/tags", + "blobs_url": "https://api.github.com/repos/gagbo/ouro-closures/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/gagbo/ouro-closures/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/gagbo/ouro-closures/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/gagbo/ouro-closures/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/gagbo/ouro-closures/statuses/{sha}", + "languages_url": "https://api.github.com/repos/gagbo/ouro-closures/languages", + "stargazers_url": "https://api.github.com/repos/gagbo/ouro-closures/stargazers", + "contributors_url": "https://api.github.com/repos/gagbo/ouro-closures/contributors", + "subscribers_url": "https://api.github.com/repos/gagbo/ouro-closures/subscribers", + "subscription_url": "https://api.github.com/repos/gagbo/ouro-closures/subscription", + "commits_url": "https://api.github.com/repos/gagbo/ouro-closures/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/gagbo/ouro-closures/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/gagbo/ouro-closures/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/gagbo/ouro-closures/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/gagbo/ouro-closures/contents/{+path}", + "compare_url": "https://api.github.com/repos/gagbo/ouro-closures/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/gagbo/ouro-closures/merges", + "archive_url": "https://api.github.com/repos/gagbo/ouro-closures/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/gagbo/ouro-closures/downloads", + "issues_url": "https://api.github.com/repos/gagbo/ouro-closures/issues{/number}", + "pulls_url": "https://api.github.com/repos/gagbo/ouro-closures/pulls{/number}", + "milestones_url": "https://api.github.com/repos/gagbo/ouro-closures/milestones{/number}", + "notifications_url": "https://api.github.com/repos/gagbo/ouro-closures/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/gagbo/ouro-closures/labels{/name}", + "releases_url": "https://api.github.com/repos/gagbo/ouro-closures/releases{/id}", + "deployments_url": "https://api.github.com/repos/gagbo/ouro-closures/deployments", + "created_at": "2022-09-16T14:02:04Z", + "updated_at": "2022-09-16T14:05:56Z", + "pushed_at": "2023-07-18T13:54:23Z", + "git_url": "git://github.com/gagbo/ouro-closures.git", + "ssh_url": "git@github.com:gagbo/ouro-closures.git", + "clone_url": "https://github.com/gagbo/ouro-closures.git", + "svn_url": "https://github.com/gagbo/ouro-closures", + "homepage": null, + "size": 2, + "stargazers_count": 0, + "watchers_count": 0, + "language": "Rust", + "has_issues": true, + "has_projects": true, + "has_downloads": true, + "has_wiki": true, + "has_pages": false, + "has_discussions": false, + "forks_count": 0, + "mirror_url": null, + "archived": false, + "disabled": false, + "open_issues_count": 2, + "license": null, + "allow_forking": true, + "is_template": false, + "web_commit_signoff_required": false, + "topics": [ + + ], + "visibility": "public", + "forks": 0, + "open_issues": 2, + "watchers": 0, + "default_branch": "trunk" + }, + "sender": { + "login": "gagbo-test-app[bot]", + "id": 139451816, + "node_id": "BOT_kgDOCE_dqA", + "avatar_url": "https://avatars.githubusercontent.com/u/10496163?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/gagbo-test-app%5Bbot%5D", + "html_url": "https://github.com/apps/gagbo-test-app", + "followers_url": "https://api.github.com/users/gagbo-test-app%5Bbot%5D/followers", + "following_url": "https://api.github.com/users/gagbo-test-app%5Bbot%5D/following{/other_user}", + "gists_url": "https://api.github.com/users/gagbo-test-app%5Bbot%5D/gists{/gist_id}", + "starred_url": "https://api.github.com/users/gagbo-test-app%5Bbot%5D/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/gagbo-test-app%5Bbot%5D/subscriptions", + "organizations_url": "https://api.github.com/users/gagbo-test-app%5Bbot%5D/orgs", + "repos_url": "https://api.github.com/users/gagbo-test-app%5Bbot%5D/repos", + "events_url": "https://api.github.com/users/gagbo-test-app%5Bbot%5D/events{/privacy}", + "received_events_url": "https://api.github.com/users/gagbo-test-app%5Bbot%5D/received_events", + "type": "Bot", + "site_admin": false + }, + "installation": { + "id": 7777777, + "node_id": "WHEmPF0sNlxkQU1lPnEiWUdUTDwwYVo9QGlNaEkiQmQhdi1uZCEvc2E1NX1FOA==" + } +} diff --git a/tests/resources/issues_labeled_webhook_event.json b/tests/resources/issues_labeled_webhook_event.json new file mode 100644 index 00000000..8ca7985f --- /dev/null +++ b/tests/resources/issues_labeled_webhook_event.json @@ -0,0 +1,213 @@ +{ + "action": "labeled", + "issue": { + "url": "https://api.github.com/repos/gagbo/circadian.nvim/issues/1", + "repository_url": "https://api.github.com/repos/gagbo/circadian.nvim", + "labels_url": "https://api.github.com/repos/gagbo/circadian.nvim/issues/1/labels{/name}", + "comments_url": "https://api.github.com/repos/gagbo/circadian.nvim/issues/1/comments", + "events_url": "https://api.github.com/repos/gagbo/circadian.nvim/issues/1/events", + "html_url": "https://github.com/gagbo/circadian.nvim/issues/1", + "id": 1802626324, + "node_id": "I_kwDOI6LULc5rceUU", + "number": 1, + "title": "Add option to remove the notification", + "user": { + "login": "gagbo", + "id": 10496163, + "node_id": "MDQ6VXNlcjEwNDk2MTYz", + "avatar_url": "https://avatars.githubusercontent.com/u/10496163?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/gagbo", + "html_url": "https://github.com/gagbo", + "followers_url": "https://api.github.com/users/gagbo/followers", + "following_url": "https://api.github.com/users/gagbo/following{/other_user}", + "gists_url": "https://api.github.com/users/gagbo/gists{/gist_id}", + "starred_url": "https://api.github.com/users/gagbo/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/gagbo/subscriptions", + "organizations_url": "https://api.github.com/users/gagbo/orgs", + "repos_url": "https://api.github.com/users/gagbo/repos", + "events_url": "https://api.github.com/users/gagbo/events{/privacy}", + "received_events_url": "https://api.github.com/users/gagbo/received_events", + "type": "User", + "site_admin": false + }, + "labels": [ + { + "id": 5119871185, + "node_id": "LA_kwDOI6LULc8AAAABMSsI0Q", + "url": "https://api.github.com/repos/gagbo/circadian.nvim/labels/enhancement", + "name": "enhancement", + "color": "a2eeef", + "default": true, + "description": "New feature or request" + } + ], + "state": "open", + "locked": false, + "assignee": null, + "assignees": [ + + ], + "milestone": null, + "comments": 0, + "created_at": "2023-07-13T09:37:01Z", + "updated_at": "2023-07-13T09:39:59Z", + "closed_at": null, + "author_association": "OWNER", + "active_lock_reason": null, + "body": "The notification can be annoying for non noice users, so it should be an option in setup to remove it.", + "reactions": { + "url": "https://api.github.com/repos/gagbo/circadian.nvim/issues/1/reactions", + "total_count": 0, + "+1": 0, + "-1": 0, + "laugh": 0, + "hooray": 0, + "confused": 0, + "heart": 0, + "rocket": 0, + "eyes": 0 + }, + "timeline_url": "https://api.github.com/repos/gagbo/circadian.nvim/issues/1/timeline", + "performed_via_github_app": null, + "state_reason": null + }, + "label": { + "id": 5119871185, + "node_id": "LA_kwDOI6LULc8AAAABMSsI0Q", + "url": "https://api.github.com/repos/gagbo/circadian.nvim/labels/enhancement", + "name": "enhancement", + "color": "a2eeef", + "default": true, + "description": "New feature or request" + }, + "repository": { + "id": 597873709, + "node_id": "R_kgDOI6LULQ", + "name": "circadian.nvim", + "full_name": "gagbo/circadian.nvim", + "private": false, + "owner": { + "login": "gagbo", + "id": 10496163, + "node_id": "MDQ6VXNlcjEwNDk2MTYz", + "avatar_url": "https://avatars.githubusercontent.com/u/10496163?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/gagbo", + "html_url": "https://github.com/gagbo", + "followers_url": "https://api.github.com/users/gagbo/followers", + "following_url": "https://api.github.com/users/gagbo/following{/other_user}", + "gists_url": "https://api.github.com/users/gagbo/gists{/gist_id}", + "starred_url": "https://api.github.com/users/gagbo/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/gagbo/subscriptions", + "organizations_url": "https://api.github.com/users/gagbo/orgs", + "repos_url": "https://api.github.com/users/gagbo/repos", + "events_url": "https://api.github.com/users/gagbo/events{/privacy}", + "received_events_url": "https://api.github.com/users/gagbo/received_events", + "type": "User", + "site_admin": false + }, + "html_url": "https://github.com/gagbo/circadian.nvim", + "description": "An automatic neovim theme-switcher following the Sun", + "fork": false, + "url": "https://api.github.com/repos/gagbo/circadian.nvim", + "forks_url": "https://api.github.com/repos/gagbo/circadian.nvim/forks", + "keys_url": "https://api.github.com/repos/gagbo/circadian.nvim/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/gagbo/circadian.nvim/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/gagbo/circadian.nvim/teams", + "hooks_url": "https://api.github.com/repos/gagbo/circadian.nvim/hooks", + "issue_events_url": "https://api.github.com/repos/gagbo/circadian.nvim/issues/events{/number}", + "events_url": "https://api.github.com/repos/gagbo/circadian.nvim/events", + "assignees_url": "https://api.github.com/repos/gagbo/circadian.nvim/assignees{/user}", + "branches_url": "https://api.github.com/repos/gagbo/circadian.nvim/branches{/branch}", + "tags_url": "https://api.github.com/repos/gagbo/circadian.nvim/tags", + "blobs_url": "https://api.github.com/repos/gagbo/circadian.nvim/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/gagbo/circadian.nvim/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/gagbo/circadian.nvim/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/gagbo/circadian.nvim/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/gagbo/circadian.nvim/statuses/{sha}", + "languages_url": "https://api.github.com/repos/gagbo/circadian.nvim/languages", + "stargazers_url": "https://api.github.com/repos/gagbo/circadian.nvim/stargazers", + "contributors_url": "https://api.github.com/repos/gagbo/circadian.nvim/contributors", + "subscribers_url": "https://api.github.com/repos/gagbo/circadian.nvim/subscribers", + "subscription_url": "https://api.github.com/repos/gagbo/circadian.nvim/subscription", + "commits_url": "https://api.github.com/repos/gagbo/circadian.nvim/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/gagbo/circadian.nvim/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/gagbo/circadian.nvim/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/gagbo/circadian.nvim/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/gagbo/circadian.nvim/contents/{+path}", + "compare_url": "https://api.github.com/repos/gagbo/circadian.nvim/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/gagbo/circadian.nvim/merges", + "archive_url": "https://api.github.com/repos/gagbo/circadian.nvim/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/gagbo/circadian.nvim/downloads", + "issues_url": "https://api.github.com/repos/gagbo/circadian.nvim/issues{/number}", + "pulls_url": "https://api.github.com/repos/gagbo/circadian.nvim/pulls{/number}", + "milestones_url": "https://api.github.com/repos/gagbo/circadian.nvim/milestones{/number}", + "notifications_url": "https://api.github.com/repos/gagbo/circadian.nvim/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/gagbo/circadian.nvim/labels{/name}", + "releases_url": "https://api.github.com/repos/gagbo/circadian.nvim/releases{/id}", + "deployments_url": "https://api.github.com/repos/gagbo/circadian.nvim/deployments", + "created_at": "2023-02-05T21:57:39Z", + "updated_at": "2023-02-05T22:23:24Z", + "pushed_at": "2023-02-05T22:21:53Z", + "git_url": "git://github.com/gagbo/circadian.nvim.git", + "ssh_url": "git@github.com:gagbo/circadian.nvim.git", + "clone_url": "https://github.com/gagbo/circadian.nvim.git", + "svn_url": "https://github.com/gagbo/circadian.nvim", + "homepage": "", + "size": 9, + "stargazers_count": 0, + "watchers_count": 0, + "language": "Lua", + "has_issues": true, + "has_projects": true, + "has_downloads": true, + "has_wiki": true, + "has_pages": false, + "has_discussions": false, + "forks_count": 0, + "mirror_url": null, + "archived": false, + "disabled": false, + "open_issues_count": 1, + "license": null, + "allow_forking": true, + "is_template": false, + "web_commit_signoff_required": false, + "topics": [ + "circadian", + "neovim", + "neovim-plugin", + "neovim-theme" + ], + "visibility": "public", + "forks": 0, + "open_issues": 1, + "watchers": 0, + "default_branch": "trunk" + }, + "sender": { + "login": "gagbo", + "id": 10496163, + "node_id": "MDQ6VXNlcjEwNDk2MTYz", + "avatar_url": "https://avatars.githubusercontent.com/u/10496163?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/gagbo", + "html_url": "https://github.com/gagbo", + "followers_url": "https://api.github.com/users/gagbo/followers", + "following_url": "https://api.github.com/users/gagbo/following{/other_user}", + "gists_url": "https://api.github.com/users/gagbo/gists{/gist_id}", + "starred_url": "https://api.github.com/users/gagbo/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/gagbo/subscriptions", + "organizations_url": "https://api.github.com/users/gagbo/orgs", + "repos_url": "https://api.github.com/users/gagbo/repos", + "events_url": "https://api.github.com/users/gagbo/events{/privacy}", + "received_events_url": "https://api.github.com/users/gagbo/received_events", + "type": "User", + "site_admin": false + }, + "installation": { + "id": 7777777, + "node_id": "WHEmPF0sNlxkQU1lPnEiWUdUTDwwYVo9QGlNaEkiQmQhdi1uZCEvc2E1NX1FOA==" + } +} diff --git a/tests/resources/issues_opened_webhook_event.json b/tests/resources/issues_opened_webhook_event.json new file mode 100644 index 00000000..ef6a782a --- /dev/null +++ b/tests/resources/issues_opened_webhook_event.json @@ -0,0 +1,196 @@ +{ + "action": "opened", + "issue": { + "url": "https://api.github.com/repos/gagbo/circadian.nvim/issues/1", + "repository_url": "https://api.github.com/repos/gagbo/circadian.nvim", + "labels_url": "https://api.github.com/repos/gagbo/circadian.nvim/issues/1/labels{/name}", + "comments_url": "https://api.github.com/repos/gagbo/circadian.nvim/issues/1/comments", + "events_url": "https://api.github.com/repos/gagbo/circadian.nvim/issues/1/events", + "html_url": "https://github.com/gagbo/circadian.nvim/issues/1", + "id": 1802626324, + "node_id": "I_kwDOI6LULc5rceUU", + "number": 1, + "title": "Add option to remove the notification", + "user": { + "login": "gagbo", + "id": 10496163, + "node_id": "MDQ6VXNlcjEwNDk2MTYz", + "avatar_url": "https://avatars.githubusercontent.com/u/10496163?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/gagbo", + "html_url": "https://github.com/gagbo", + "followers_url": "https://api.github.com/users/gagbo/followers", + "following_url": "https://api.github.com/users/gagbo/following{/other_user}", + "gists_url": "https://api.github.com/users/gagbo/gists{/gist_id}", + "starred_url": "https://api.github.com/users/gagbo/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/gagbo/subscriptions", + "organizations_url": "https://api.github.com/users/gagbo/orgs", + "repos_url": "https://api.github.com/users/gagbo/repos", + "events_url": "https://api.github.com/users/gagbo/events{/privacy}", + "received_events_url": "https://api.github.com/users/gagbo/received_events", + "type": "User", + "site_admin": false + }, + "labels": [ + + ], + "state": "open", + "locked": false, + "assignee": null, + "assignees": [ + + ], + "milestone": null, + "comments": 0, + "created_at": "2023-07-13T09:37:01Z", + "updated_at": "2023-07-13T09:37:01Z", + "closed_at": null, + "author_association": "OWNER", + "active_lock_reason": null, + "body": "The notification can be annoying for non noice users, so it should be an option in setup to remove it.", + "reactions": { + "url": "https://api.github.com/repos/gagbo/circadian.nvim/issues/1/reactions", + "total_count": 0, + "+1": 0, + "-1": 0, + "laugh": 0, + "hooray": 0, + "confused": 0, + "heart": 0, + "rocket": 0, + "eyes": 0 + }, + "timeline_url": "https://api.github.com/repos/gagbo/circadian.nvim/issues/1/timeline", + "performed_via_github_app": null, + "state_reason": null + }, + "repository": { + "id": 597873709, + "node_id": "R_kgDOI6LULQ", + "name": "circadian.nvim", + "full_name": "gagbo/circadian.nvim", + "private": false, + "owner": { + "login": "gagbo", + "id": 10496163, + "node_id": "MDQ6VXNlcjEwNDk2MTYz", + "avatar_url": "https://avatars.githubusercontent.com/u/10496163?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/gagbo", + "html_url": "https://github.com/gagbo", + "followers_url": "https://api.github.com/users/gagbo/followers", + "following_url": "https://api.github.com/users/gagbo/following{/other_user}", + "gists_url": "https://api.github.com/users/gagbo/gists{/gist_id}", + "starred_url": "https://api.github.com/users/gagbo/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/gagbo/subscriptions", + "organizations_url": "https://api.github.com/users/gagbo/orgs", + "repos_url": "https://api.github.com/users/gagbo/repos", + "events_url": "https://api.github.com/users/gagbo/events{/privacy}", + "received_events_url": "https://api.github.com/users/gagbo/received_events", + "type": "User", + "site_admin": false + }, + "html_url": "https://github.com/gagbo/circadian.nvim", + "description": "An automatic neovim theme-switcher following the Sun", + "fork": false, + "url": "https://api.github.com/repos/gagbo/circadian.nvim", + "forks_url": "https://api.github.com/repos/gagbo/circadian.nvim/forks", + "keys_url": "https://api.github.com/repos/gagbo/circadian.nvim/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/gagbo/circadian.nvim/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/gagbo/circadian.nvim/teams", + "hooks_url": "https://api.github.com/repos/gagbo/circadian.nvim/hooks", + "issue_events_url": "https://api.github.com/repos/gagbo/circadian.nvim/issues/events{/number}", + "events_url": "https://api.github.com/repos/gagbo/circadian.nvim/events", + "assignees_url": "https://api.github.com/repos/gagbo/circadian.nvim/assignees{/user}", + "branches_url": "https://api.github.com/repos/gagbo/circadian.nvim/branches{/branch}", + "tags_url": "https://api.github.com/repos/gagbo/circadian.nvim/tags", + "blobs_url": "https://api.github.com/repos/gagbo/circadian.nvim/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/gagbo/circadian.nvim/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/gagbo/circadian.nvim/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/gagbo/circadian.nvim/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/gagbo/circadian.nvim/statuses/{sha}", + "languages_url": "https://api.github.com/repos/gagbo/circadian.nvim/languages", + "stargazers_url": "https://api.github.com/repos/gagbo/circadian.nvim/stargazers", + "contributors_url": "https://api.github.com/repos/gagbo/circadian.nvim/contributors", + "subscribers_url": "https://api.github.com/repos/gagbo/circadian.nvim/subscribers", + "subscription_url": "https://api.github.com/repos/gagbo/circadian.nvim/subscription", + "commits_url": "https://api.github.com/repos/gagbo/circadian.nvim/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/gagbo/circadian.nvim/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/gagbo/circadian.nvim/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/gagbo/circadian.nvim/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/gagbo/circadian.nvim/contents/{+path}", + "compare_url": "https://api.github.com/repos/gagbo/circadian.nvim/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/gagbo/circadian.nvim/merges", + "archive_url": "https://api.github.com/repos/gagbo/circadian.nvim/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/gagbo/circadian.nvim/downloads", + "issues_url": "https://api.github.com/repos/gagbo/circadian.nvim/issues{/number}", + "pulls_url": "https://api.github.com/repos/gagbo/circadian.nvim/pulls{/number}", + "milestones_url": "https://api.github.com/repos/gagbo/circadian.nvim/milestones{/number}", + "notifications_url": "https://api.github.com/repos/gagbo/circadian.nvim/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/gagbo/circadian.nvim/labels{/name}", + "releases_url": "https://api.github.com/repos/gagbo/circadian.nvim/releases{/id}", + "deployments_url": "https://api.github.com/repos/gagbo/circadian.nvim/deployments", + "created_at": "2023-02-05T21:57:39Z", + "updated_at": "2023-02-05T22:23:24Z", + "pushed_at": "2023-02-05T22:21:53Z", + "git_url": "git://github.com/gagbo/circadian.nvim.git", + "ssh_url": "git@github.com:gagbo/circadian.nvim.git", + "clone_url": "https://github.com/gagbo/circadian.nvim.git", + "svn_url": "https://github.com/gagbo/circadian.nvim", + "homepage": "", + "size": 9, + "stargazers_count": 0, + "watchers_count": 0, + "language": "Lua", + "has_issues": true, + "has_projects": true, + "has_downloads": true, + "has_wiki": true, + "has_pages": false, + "has_discussions": false, + "forks_count": 0, + "mirror_url": null, + "archived": false, + "disabled": false, + "open_issues_count": 1, + "license": null, + "allow_forking": true, + "is_template": false, + "web_commit_signoff_required": false, + "topics": [ + "circadian", + "neovim", + "neovim-plugin", + "neovim-theme" + ], + "visibility": "public", + "forks": 0, + "open_issues": 1, + "watchers": 0, + "default_branch": "trunk" + }, + "sender": { + "login": "gagbo", + "id": 10496163, + "node_id": "MDQ6VXNlcjEwNDk2MTYz", + "avatar_url": "https://avatars.githubusercontent.com/u/10496163?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/gagbo", + "html_url": "https://github.com/gagbo", + "followers_url": "https://api.github.com/users/gagbo/followers", + "following_url": "https://api.github.com/users/gagbo/following{/other_user}", + "gists_url": "https://api.github.com/users/gagbo/gists{/gist_id}", + "starred_url": "https://api.github.com/users/gagbo/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/gagbo/subscriptions", + "organizations_url": "https://api.github.com/users/gagbo/orgs", + "repos_url": "https://api.github.com/users/gagbo/repos", + "events_url": "https://api.github.com/users/gagbo/events{/privacy}", + "received_events_url": "https://api.github.com/users/gagbo/received_events", + "type": "User", + "site_admin": false + }, + "installation": { + "id": 7777777, + "node_id": "WHEmPF0sNlxkQU1lPnEiWUdUTDwwYVo9QGlNaEkiQmQhdi1uZCEvc2E1NX1FOA==" + } +} diff --git a/tests/resources/ping_webhook_event.json b/tests/resources/ping_webhook_event.json new file mode 100644 index 00000000..a2cb875b --- /dev/null +++ b/tests/resources/ping_webhook_event.json @@ -0,0 +1,30 @@ +{ + "zen": "Design for failure.", + "hook_id": 423885699, + "hook": { + "type": "App", + "id": 423885699, + "name": "web", + "active": true, + "events": [ + "issues", + "issue_comment", + "meta", + "pull_request", + "pull_request_review", + "pull_request_review_comment", + "pull_request_review_thread", + "repository" + ], + "config": { + "content_type": "json", + "insecure_ssl": "0", + "secret": "********", + "url": "https://smee.io/RQujlVQ91fwoIu" + }, + "updated_at": "2023-07-13T09:30:45Z", + "created_at": "2023-07-13T09:30:45Z", + "app_id": 360617, + "deliveries_url": "https://api.github.com/app/hook/deliveries" + } +} diff --git a/tests/resources/pull_request_closed_webhook_event.json b/tests/resources/pull_request_closed_webhook_event.json new file mode 100644 index 00000000..011d5cf6 --- /dev/null +++ b/tests/resources/pull_request_closed_webhook_event.json @@ -0,0 +1,506 @@ +{ + "action": "closed", + "number": 2, + "pull_request": { + "url": "https://api.github.com/repos/gagbo/ouro-closures/pulls/2", + "id": 1439239600, + "node_id": "PR_kwDOIAlVv85VyQ2w", + "html_url": "https://github.com/gagbo/ouro-closures/pull/2", + "diff_url": "https://github.com/gagbo/ouro-closures/pull/2.diff", + "patch_url": "https://github.com/gagbo/ouro-closures/pull/2.patch", + "issue_url": "https://api.github.com/repos/gagbo/ouro-closures/issues/2", + "number": 2, + "state": "closed", + "locked": false, + "title": "[do not merge] test commit", + "user": { + "login": "gagbo", + "id": 10496163, + "node_id": "MDQ6VXNlcjEwNDk2MTYz", + "avatar_url": "https://avatars.githubusercontent.com/u/10496163?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/gagbo", + "html_url": "https://github.com/gagbo", + "followers_url": "https://api.github.com/users/gagbo/followers", + "following_url": "https://api.github.com/users/gagbo/following{/other_user}", + "gists_url": "https://api.github.com/users/gagbo/gists{/gist_id}", + "starred_url": "https://api.github.com/users/gagbo/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/gagbo/subscriptions", + "organizations_url": "https://api.github.com/users/gagbo/orgs", + "repos_url": "https://api.github.com/users/gagbo/repos", + "events_url": "https://api.github.com/users/gagbo/events{/privacy}", + "received_events_url": "https://api.github.com/users/gagbo/received_events", + "type": "User", + "site_admin": false + }, + "body": null, + "created_at": "2023-07-18T13:15:41Z", + "updated_at": "2023-07-18T13:22:27Z", + "closed_at": "2023-07-18T13:22:27Z", + "merged_at": null, + "merge_commit_sha": "569605edb950caefdf9006dec7f9b40b232d05a7", + "assignee": null, + "assignees": [ + + ], + "requested_reviewers": [ + + ], + "requested_teams": [ + + ], + "labels": [ + + ], + "milestone": null, + "draft": false, + "commits_url": "https://api.github.com/repos/gagbo/ouro-closures/pulls/2/commits", + "review_comments_url": "https://api.github.com/repos/gagbo/ouro-closures/pulls/2/comments", + "review_comment_url": "https://api.github.com/repos/gagbo/ouro-closures/pulls/comments{/number}", + "comments_url": "https://api.github.com/repos/gagbo/ouro-closures/issues/2/comments", + "statuses_url": "https://api.github.com/repos/gagbo/ouro-closures/statuses/36afaef2afdf0ce794d7e4663e7f327664aaa4d7", + "head": { + "label": "gagbo:test_pr", + "ref": "test_pr", + "sha": "36afaef2afdf0ce794d7e4663e7f327664aaa4d7", + "user": { + "login": "gagbo", + "id": 10496163, + "node_id": "MDQ6VXNlcjEwNDk2MTYz", + "avatar_url": "https://avatars.githubusercontent.com/u/10496163?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/gagbo", + "html_url": "https://github.com/gagbo", + "followers_url": "https://api.github.com/users/gagbo/followers", + "following_url": "https://api.github.com/users/gagbo/following{/other_user}", + "gists_url": "https://api.github.com/users/gagbo/gists{/gist_id}", + "starred_url": "https://api.github.com/users/gagbo/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/gagbo/subscriptions", + "organizations_url": "https://api.github.com/users/gagbo/orgs", + "repos_url": "https://api.github.com/users/gagbo/repos", + "events_url": "https://api.github.com/users/gagbo/events{/privacy}", + "received_events_url": "https://api.github.com/users/gagbo/received_events", + "type": "User", + "site_admin": false + }, + "repo": { + "id": 537482687, + "node_id": "R_kgDOIAlVvw", + "name": "ouro-closures", + "full_name": "gagbo/ouro-closures", + "private": false, + "owner": { + "login": "gagbo", + "id": 10496163, + "node_id": "MDQ6VXNlcjEwNDk2MTYz", + "avatar_url": "https://avatars.githubusercontent.com/u/10496163?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/gagbo", + "html_url": "https://github.com/gagbo", + "followers_url": "https://api.github.com/users/gagbo/followers", + "following_url": "https://api.github.com/users/gagbo/following{/other_user}", + "gists_url": "https://api.github.com/users/gagbo/gists{/gist_id}", + "starred_url": "https://api.github.com/users/gagbo/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/gagbo/subscriptions", + "organizations_url": "https://api.github.com/users/gagbo/orgs", + "repos_url": "https://api.github.com/users/gagbo/repos", + "events_url": "https://api.github.com/users/gagbo/events{/privacy}", + "received_events_url": "https://api.github.com/users/gagbo/received_events", + "type": "User", + "site_admin": false + }, + "html_url": "https://github.com/gagbo/ouro-closures", + "description": "Draft to test self-referencing closure captures for r7", + "fork": false, + "url": "https://api.github.com/repos/gagbo/ouro-closures", + "forks_url": "https://api.github.com/repos/gagbo/ouro-closures/forks", + "keys_url": "https://api.github.com/repos/gagbo/ouro-closures/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/gagbo/ouro-closures/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/gagbo/ouro-closures/teams", + "hooks_url": "https://api.github.com/repos/gagbo/ouro-closures/hooks", + "issue_events_url": "https://api.github.com/repos/gagbo/ouro-closures/issues/events{/number}", + "events_url": "https://api.github.com/repos/gagbo/ouro-closures/events", + "assignees_url": "https://api.github.com/repos/gagbo/ouro-closures/assignees{/user}", + "branches_url": "https://api.github.com/repos/gagbo/ouro-closures/branches{/branch}", + "tags_url": "https://api.github.com/repos/gagbo/ouro-closures/tags", + "blobs_url": "https://api.github.com/repos/gagbo/ouro-closures/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/gagbo/ouro-closures/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/gagbo/ouro-closures/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/gagbo/ouro-closures/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/gagbo/ouro-closures/statuses/{sha}", + "languages_url": "https://api.github.com/repos/gagbo/ouro-closures/languages", + "stargazers_url": "https://api.github.com/repos/gagbo/ouro-closures/stargazers", + "contributors_url": "https://api.github.com/repos/gagbo/ouro-closures/contributors", + "subscribers_url": "https://api.github.com/repos/gagbo/ouro-closures/subscribers", + "subscription_url": "https://api.github.com/repos/gagbo/ouro-closures/subscription", + "commits_url": "https://api.github.com/repos/gagbo/ouro-closures/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/gagbo/ouro-closures/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/gagbo/ouro-closures/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/gagbo/ouro-closures/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/gagbo/ouro-closures/contents/{+path}", + "compare_url": "https://api.github.com/repos/gagbo/ouro-closures/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/gagbo/ouro-closures/merges", + "archive_url": "https://api.github.com/repos/gagbo/ouro-closures/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/gagbo/ouro-closures/downloads", + "issues_url": "https://api.github.com/repos/gagbo/ouro-closures/issues{/number}", + "pulls_url": "https://api.github.com/repos/gagbo/ouro-closures/pulls{/number}", + "milestones_url": "https://api.github.com/repos/gagbo/ouro-closures/milestones{/number}", + "notifications_url": "https://api.github.com/repos/gagbo/ouro-closures/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/gagbo/ouro-closures/labels{/name}", + "releases_url": "https://api.github.com/repos/gagbo/ouro-closures/releases{/id}", + "deployments_url": "https://api.github.com/repos/gagbo/ouro-closures/deployments", + "created_at": "2022-09-16T14:02:04Z", + "updated_at": "2022-09-16T14:05:56Z", + "pushed_at": "2023-07-18T13:15:41Z", + "git_url": "git://github.com/gagbo/ouro-closures.git", + "ssh_url": "git@github.com:gagbo/ouro-closures.git", + "clone_url": "https://github.com/gagbo/ouro-closures.git", + "svn_url": "https://github.com/gagbo/ouro-closures", + "homepage": null, + "size": 2, + "stargazers_count": 0, + "watchers_count": 0, + "language": "Rust", + "has_issues": true, + "has_projects": true, + "has_downloads": true, + "has_wiki": true, + "has_pages": false, + "has_discussions": false, + "forks_count": 0, + "mirror_url": null, + "archived": false, + "disabled": false, + "open_issues_count": 1, + "license": null, + "allow_forking": true, + "is_template": false, + "web_commit_signoff_required": false, + "topics": [ + + ], + "visibility": "public", + "forks": 0, + "open_issues": 1, + "watchers": 0, + "default_branch": "trunk", + "allow_squash_merge": true, + "allow_merge_commit": true, + "allow_rebase_merge": true, + "allow_auto_merge": false, + "delete_branch_on_merge": false, + "allow_update_branch": false, + "use_squash_pr_title_as_default": false, + "squash_merge_commit_message": "COMMIT_MESSAGES", + "squash_merge_commit_title": "COMMIT_OR_PR_TITLE", + "merge_commit_message": "PR_TITLE", + "merge_commit_title": "MERGE_MESSAGE" + } + }, + "base": { + "label": "gagbo:trunk", + "ref": "trunk", + "sha": "ea6cd405a443e34aca1f57485ee151fb15a34729", + "user": { + "login": "gagbo", + "id": 10496163, + "node_id": "MDQ6VXNlcjEwNDk2MTYz", + "avatar_url": "https://avatars.githubusercontent.com/u/10496163?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/gagbo", + "html_url": "https://github.com/gagbo", + "followers_url": "https://api.github.com/users/gagbo/followers", + "following_url": "https://api.github.com/users/gagbo/following{/other_user}", + "gists_url": "https://api.github.com/users/gagbo/gists{/gist_id}", + "starred_url": "https://api.github.com/users/gagbo/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/gagbo/subscriptions", + "organizations_url": "https://api.github.com/users/gagbo/orgs", + "repos_url": "https://api.github.com/users/gagbo/repos", + "events_url": "https://api.github.com/users/gagbo/events{/privacy}", + "received_events_url": "https://api.github.com/users/gagbo/received_events", + "type": "User", + "site_admin": false + }, + "repo": { + "id": 537482687, + "node_id": "R_kgDOIAlVvw", + "name": "ouro-closures", + "full_name": "gagbo/ouro-closures", + "private": false, + "owner": { + "login": "gagbo", + "id": 10496163, + "node_id": "MDQ6VXNlcjEwNDk2MTYz", + "avatar_url": "https://avatars.githubusercontent.com/u/10496163?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/gagbo", + "html_url": "https://github.com/gagbo", + "followers_url": "https://api.github.com/users/gagbo/followers", + "following_url": "https://api.github.com/users/gagbo/following{/other_user}", + "gists_url": "https://api.github.com/users/gagbo/gists{/gist_id}", + "starred_url": "https://api.github.com/users/gagbo/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/gagbo/subscriptions", + "organizations_url": "https://api.github.com/users/gagbo/orgs", + "repos_url": "https://api.github.com/users/gagbo/repos", + "events_url": "https://api.github.com/users/gagbo/events{/privacy}", + "received_events_url": "https://api.github.com/users/gagbo/received_events", + "type": "User", + "site_admin": false + }, + "html_url": "https://github.com/gagbo/ouro-closures", + "description": "Draft to test self-referencing closure captures for r7", + "fork": false, + "url": "https://api.github.com/repos/gagbo/ouro-closures", + "forks_url": "https://api.github.com/repos/gagbo/ouro-closures/forks", + "keys_url": "https://api.github.com/repos/gagbo/ouro-closures/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/gagbo/ouro-closures/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/gagbo/ouro-closures/teams", + "hooks_url": "https://api.github.com/repos/gagbo/ouro-closures/hooks", + "issue_events_url": "https://api.github.com/repos/gagbo/ouro-closures/issues/events{/number}", + "events_url": "https://api.github.com/repos/gagbo/ouro-closures/events", + "assignees_url": "https://api.github.com/repos/gagbo/ouro-closures/assignees{/user}", + "branches_url": "https://api.github.com/repos/gagbo/ouro-closures/branches{/branch}", + "tags_url": "https://api.github.com/repos/gagbo/ouro-closures/tags", + "blobs_url": "https://api.github.com/repos/gagbo/ouro-closures/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/gagbo/ouro-closures/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/gagbo/ouro-closures/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/gagbo/ouro-closures/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/gagbo/ouro-closures/statuses/{sha}", + "languages_url": "https://api.github.com/repos/gagbo/ouro-closures/languages", + "stargazers_url": "https://api.github.com/repos/gagbo/ouro-closures/stargazers", + "contributors_url": "https://api.github.com/repos/gagbo/ouro-closures/contributors", + "subscribers_url": "https://api.github.com/repos/gagbo/ouro-closures/subscribers", + "subscription_url": "https://api.github.com/repos/gagbo/ouro-closures/subscription", + "commits_url": "https://api.github.com/repos/gagbo/ouro-closures/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/gagbo/ouro-closures/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/gagbo/ouro-closures/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/gagbo/ouro-closures/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/gagbo/ouro-closures/contents/{+path}", + "compare_url": "https://api.github.com/repos/gagbo/ouro-closures/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/gagbo/ouro-closures/merges", + "archive_url": "https://api.github.com/repos/gagbo/ouro-closures/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/gagbo/ouro-closures/downloads", + "issues_url": "https://api.github.com/repos/gagbo/ouro-closures/issues{/number}", + "pulls_url": "https://api.github.com/repos/gagbo/ouro-closures/pulls{/number}", + "milestones_url": "https://api.github.com/repos/gagbo/ouro-closures/milestones{/number}", + "notifications_url": "https://api.github.com/repos/gagbo/ouro-closures/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/gagbo/ouro-closures/labels{/name}", + "releases_url": "https://api.github.com/repos/gagbo/ouro-closures/releases{/id}", + "deployments_url": "https://api.github.com/repos/gagbo/ouro-closures/deployments", + "created_at": "2022-09-16T14:02:04Z", + "updated_at": "2022-09-16T14:05:56Z", + "pushed_at": "2023-07-18T13:15:41Z", + "git_url": "git://github.com/gagbo/ouro-closures.git", + "ssh_url": "git@github.com:gagbo/ouro-closures.git", + "clone_url": "https://github.com/gagbo/ouro-closures.git", + "svn_url": "https://github.com/gagbo/ouro-closures", + "homepage": null, + "size": 2, + "stargazers_count": 0, + "watchers_count": 0, + "language": "Rust", + "has_issues": true, + "has_projects": true, + "has_downloads": true, + "has_wiki": true, + "has_pages": false, + "has_discussions": false, + "forks_count": 0, + "mirror_url": null, + "archived": false, + "disabled": false, + "open_issues_count": 1, + "license": null, + "allow_forking": true, + "is_template": false, + "web_commit_signoff_required": false, + "topics": [ + + ], + "visibility": "public", + "forks": 0, + "open_issues": 1, + "watchers": 0, + "default_branch": "trunk", + "allow_squash_merge": true, + "allow_merge_commit": true, + "allow_rebase_merge": true, + "allow_auto_merge": false, + "delete_branch_on_merge": false, + "allow_update_branch": false, + "use_squash_pr_title_as_default": false, + "squash_merge_commit_message": "COMMIT_MESSAGES", + "squash_merge_commit_title": "COMMIT_OR_PR_TITLE", + "merge_commit_message": "PR_TITLE", + "merge_commit_title": "MERGE_MESSAGE" + } + }, + "_links": { + "self": { + "href": "https://api.github.com/repos/gagbo/ouro-closures/pulls/2" + }, + "html": { + "href": "https://github.com/gagbo/ouro-closures/pull/2" + }, + "issue": { + "href": "https://api.github.com/repos/gagbo/ouro-closures/issues/2" + }, + "comments": { + "href": "https://api.github.com/repos/gagbo/ouro-closures/issues/2/comments" + }, + "review_comments": { + "href": "https://api.github.com/repos/gagbo/ouro-closures/pulls/2/comments" + }, + "review_comment": { + "href": "https://api.github.com/repos/gagbo/ouro-closures/pulls/comments{/number}" + }, + "commits": { + "href": "https://api.github.com/repos/gagbo/ouro-closures/pulls/2/commits" + }, + "statuses": { + "href": "https://api.github.com/repos/gagbo/ouro-closures/statuses/36afaef2afdf0ce794d7e4663e7f327664aaa4d7" + } + }, + "author_association": "OWNER", + "auto_merge": null, + "active_lock_reason": null, + "merged": false, + "mergeable": true, + "rebaseable": false, + "mergeable_state": "clean", + "merged_by": null, + "comments": 0, + "review_comments": 0, + "maintainer_can_modify": false, + "commits": 1, + "additions": 1, + "deletions": 0, + "changed_files": 1 + }, + "repository": { + "id": 537482687, + "node_id": "R_kgDOIAlVvw", + "name": "ouro-closures", + "full_name": "gagbo/ouro-closures", + "private": false, + "owner": { + "login": "gagbo", + "id": 10496163, + "node_id": "MDQ6VXNlcjEwNDk2MTYz", + "avatar_url": "https://avatars.githubusercontent.com/u/10496163?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/gagbo", + "html_url": "https://github.com/gagbo", + "followers_url": "https://api.github.com/users/gagbo/followers", + "following_url": "https://api.github.com/users/gagbo/following{/other_user}", + "gists_url": "https://api.github.com/users/gagbo/gists{/gist_id}", + "starred_url": "https://api.github.com/users/gagbo/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/gagbo/subscriptions", + "organizations_url": "https://api.github.com/users/gagbo/orgs", + "repos_url": "https://api.github.com/users/gagbo/repos", + "events_url": "https://api.github.com/users/gagbo/events{/privacy}", + "received_events_url": "https://api.github.com/users/gagbo/received_events", + "type": "User", + "site_admin": false + }, + "html_url": "https://github.com/gagbo/ouro-closures", + "description": "Draft to test self-referencing closure captures for r7", + "fork": false, + "url": "https://api.github.com/repos/gagbo/ouro-closures", + "forks_url": "https://api.github.com/repos/gagbo/ouro-closures/forks", + "keys_url": "https://api.github.com/repos/gagbo/ouro-closures/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/gagbo/ouro-closures/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/gagbo/ouro-closures/teams", + "hooks_url": "https://api.github.com/repos/gagbo/ouro-closures/hooks", + "issue_events_url": "https://api.github.com/repos/gagbo/ouro-closures/issues/events{/number}", + "events_url": "https://api.github.com/repos/gagbo/ouro-closures/events", + "assignees_url": "https://api.github.com/repos/gagbo/ouro-closures/assignees{/user}", + "branches_url": "https://api.github.com/repos/gagbo/ouro-closures/branches{/branch}", + "tags_url": "https://api.github.com/repos/gagbo/ouro-closures/tags", + "blobs_url": "https://api.github.com/repos/gagbo/ouro-closures/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/gagbo/ouro-closures/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/gagbo/ouro-closures/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/gagbo/ouro-closures/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/gagbo/ouro-closures/statuses/{sha}", + "languages_url": "https://api.github.com/repos/gagbo/ouro-closures/languages", + "stargazers_url": "https://api.github.com/repos/gagbo/ouro-closures/stargazers", + "contributors_url": "https://api.github.com/repos/gagbo/ouro-closures/contributors", + "subscribers_url": "https://api.github.com/repos/gagbo/ouro-closures/subscribers", + "subscription_url": "https://api.github.com/repos/gagbo/ouro-closures/subscription", + "commits_url": "https://api.github.com/repos/gagbo/ouro-closures/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/gagbo/ouro-closures/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/gagbo/ouro-closures/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/gagbo/ouro-closures/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/gagbo/ouro-closures/contents/{+path}", + "compare_url": "https://api.github.com/repos/gagbo/ouro-closures/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/gagbo/ouro-closures/merges", + "archive_url": "https://api.github.com/repos/gagbo/ouro-closures/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/gagbo/ouro-closures/downloads", + "issues_url": "https://api.github.com/repos/gagbo/ouro-closures/issues{/number}", + "pulls_url": "https://api.github.com/repos/gagbo/ouro-closures/pulls{/number}", + "milestones_url": "https://api.github.com/repos/gagbo/ouro-closures/milestones{/number}", + "notifications_url": "https://api.github.com/repos/gagbo/ouro-closures/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/gagbo/ouro-closures/labels{/name}", + "releases_url": "https://api.github.com/repos/gagbo/ouro-closures/releases{/id}", + "deployments_url": "https://api.github.com/repos/gagbo/ouro-closures/deployments", + "created_at": "2022-09-16T14:02:04Z", + "updated_at": "2022-09-16T14:05:56Z", + "pushed_at": "2023-07-18T13:15:41Z", + "git_url": "git://github.com/gagbo/ouro-closures.git", + "ssh_url": "git@github.com:gagbo/ouro-closures.git", + "clone_url": "https://github.com/gagbo/ouro-closures.git", + "svn_url": "https://github.com/gagbo/ouro-closures", + "homepage": null, + "size": 2, + "stargazers_count": 0, + "watchers_count": 0, + "language": "Rust", + "has_issues": true, + "has_projects": true, + "has_downloads": true, + "has_wiki": true, + "has_pages": false, + "has_discussions": false, + "forks_count": 0, + "mirror_url": null, + "archived": false, + "disabled": false, + "open_issues_count": 1, + "license": null, + "allow_forking": true, + "is_template": false, + "web_commit_signoff_required": false, + "topics": [ + + ], + "visibility": "public", + "forks": 0, + "open_issues": 1, + "watchers": 0, + "default_branch": "trunk" + }, + "sender": { + "login": "gagbo", + "id": 10496163, + "node_id": "MDQ6VXNlcjEwNDk2MTYz", + "avatar_url": "https://avatars.githubusercontent.com/u/10496163?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/gagbo", + "html_url": "https://github.com/gagbo", + "followers_url": "https://api.github.com/users/gagbo/followers", + "following_url": "https://api.github.com/users/gagbo/following{/other_user}", + "gists_url": "https://api.github.com/users/gagbo/gists{/gist_id}", + "starred_url": "https://api.github.com/users/gagbo/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/gagbo/subscriptions", + "organizations_url": "https://api.github.com/users/gagbo/orgs", + "repos_url": "https://api.github.com/users/gagbo/repos", + "events_url": "https://api.github.com/users/gagbo/events{/privacy}", + "received_events_url": "https://api.github.com/users/gagbo/received_events", + "type": "User", + "site_admin": false + }, + "installation": { + "id": 7777777, + "node_id": "WHEmPF0sNlxkQU1lPnEiWUdUTDwwYVo9QGlNaEkiQmQhdi1uZCEvc2E1NX1FOA==" + } +} diff --git a/tests/resources/pull_request_opened_webhook_event.json b/tests/resources/pull_request_opened_webhook_event.json new file mode 100644 index 00000000..18925d20 --- /dev/null +++ b/tests/resources/pull_request_opened_webhook_event.json @@ -0,0 +1,506 @@ +{ + "action": "opened", + "number": 2, + "pull_request": { + "url": "https://api.github.com/repos/gagbo/ouro-closures/pulls/2", + "id": 1439239600, + "node_id": "PR_kwDOIAlVv85VyQ2w", + "html_url": "https://github.com/gagbo/ouro-closures/pull/2", + "diff_url": "https://github.com/gagbo/ouro-closures/pull/2.diff", + "patch_url": "https://github.com/gagbo/ouro-closures/pull/2.patch", + "issue_url": "https://api.github.com/repos/gagbo/ouro-closures/issues/2", + "number": 2, + "state": "open", + "locked": false, + "title": "[do not merge] test commit", + "user": { + "login": "gagbo", + "id": 10496163, + "node_id": "MDQ6VXNlcjEwNDk2MTYz", + "avatar_url": "https://avatars.githubusercontent.com/u/10496163?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/gagbo", + "html_url": "https://github.com/gagbo", + "followers_url": "https://api.github.com/users/gagbo/followers", + "following_url": "https://api.github.com/users/gagbo/following{/other_user}", + "gists_url": "https://api.github.com/users/gagbo/gists{/gist_id}", + "starred_url": "https://api.github.com/users/gagbo/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/gagbo/subscriptions", + "organizations_url": "https://api.github.com/users/gagbo/orgs", + "repos_url": "https://api.github.com/users/gagbo/repos", + "events_url": "https://api.github.com/users/gagbo/events{/privacy}", + "received_events_url": "https://api.github.com/users/gagbo/received_events", + "type": "User", + "site_admin": false + }, + "body": null, + "created_at": "2023-07-18T13:15:41Z", + "updated_at": "2023-07-18T13:15:41Z", + "closed_at": null, + "merged_at": null, + "merge_commit_sha": null, + "assignee": null, + "assignees": [ + + ], + "requested_reviewers": [ + + ], + "requested_teams": [ + + ], + "labels": [ + + ], + "milestone": null, + "draft": false, + "commits_url": "https://api.github.com/repos/gagbo/ouro-closures/pulls/2/commits", + "review_comments_url": "https://api.github.com/repos/gagbo/ouro-closures/pulls/2/comments", + "review_comment_url": "https://api.github.com/repos/gagbo/ouro-closures/pulls/comments{/number}", + "comments_url": "https://api.github.com/repos/gagbo/ouro-closures/issues/2/comments", + "statuses_url": "https://api.github.com/repos/gagbo/ouro-closures/statuses/36afaef2afdf0ce794d7e4663e7f327664aaa4d7", + "head": { + "label": "gagbo:test_pr", + "ref": "test_pr", + "sha": "36afaef2afdf0ce794d7e4663e7f327664aaa4d7", + "user": { + "login": "gagbo", + "id": 10496163, + "node_id": "MDQ6VXNlcjEwNDk2MTYz", + "avatar_url": "https://avatars.githubusercontent.com/u/10496163?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/gagbo", + "html_url": "https://github.com/gagbo", + "followers_url": "https://api.github.com/users/gagbo/followers", + "following_url": "https://api.github.com/users/gagbo/following{/other_user}", + "gists_url": "https://api.github.com/users/gagbo/gists{/gist_id}", + "starred_url": "https://api.github.com/users/gagbo/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/gagbo/subscriptions", + "organizations_url": "https://api.github.com/users/gagbo/orgs", + "repos_url": "https://api.github.com/users/gagbo/repos", + "events_url": "https://api.github.com/users/gagbo/events{/privacy}", + "received_events_url": "https://api.github.com/users/gagbo/received_events", + "type": "User", + "site_admin": false + }, + "repo": { + "id": 537482687, + "node_id": "R_kgDOIAlVvw", + "name": "ouro-closures", + "full_name": "gagbo/ouro-closures", + "private": false, + "owner": { + "login": "gagbo", + "id": 10496163, + "node_id": "MDQ6VXNlcjEwNDk2MTYz", + "avatar_url": "https://avatars.githubusercontent.com/u/10496163?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/gagbo", + "html_url": "https://github.com/gagbo", + "followers_url": "https://api.github.com/users/gagbo/followers", + "following_url": "https://api.github.com/users/gagbo/following{/other_user}", + "gists_url": "https://api.github.com/users/gagbo/gists{/gist_id}", + "starred_url": "https://api.github.com/users/gagbo/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/gagbo/subscriptions", + "organizations_url": "https://api.github.com/users/gagbo/orgs", + "repos_url": "https://api.github.com/users/gagbo/repos", + "events_url": "https://api.github.com/users/gagbo/events{/privacy}", + "received_events_url": "https://api.github.com/users/gagbo/received_events", + "type": "User", + "site_admin": false + }, + "html_url": "https://github.com/gagbo/ouro-closures", + "description": "Draft to test self-referencing closure captures for r7", + "fork": false, + "url": "https://api.github.com/repos/gagbo/ouro-closures", + "forks_url": "https://api.github.com/repos/gagbo/ouro-closures/forks", + "keys_url": "https://api.github.com/repos/gagbo/ouro-closures/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/gagbo/ouro-closures/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/gagbo/ouro-closures/teams", + "hooks_url": "https://api.github.com/repos/gagbo/ouro-closures/hooks", + "issue_events_url": "https://api.github.com/repos/gagbo/ouro-closures/issues/events{/number}", + "events_url": "https://api.github.com/repos/gagbo/ouro-closures/events", + "assignees_url": "https://api.github.com/repos/gagbo/ouro-closures/assignees{/user}", + "branches_url": "https://api.github.com/repos/gagbo/ouro-closures/branches{/branch}", + "tags_url": "https://api.github.com/repos/gagbo/ouro-closures/tags", + "blobs_url": "https://api.github.com/repos/gagbo/ouro-closures/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/gagbo/ouro-closures/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/gagbo/ouro-closures/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/gagbo/ouro-closures/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/gagbo/ouro-closures/statuses/{sha}", + "languages_url": "https://api.github.com/repos/gagbo/ouro-closures/languages", + "stargazers_url": "https://api.github.com/repos/gagbo/ouro-closures/stargazers", + "contributors_url": "https://api.github.com/repos/gagbo/ouro-closures/contributors", + "subscribers_url": "https://api.github.com/repos/gagbo/ouro-closures/subscribers", + "subscription_url": "https://api.github.com/repos/gagbo/ouro-closures/subscription", + "commits_url": "https://api.github.com/repos/gagbo/ouro-closures/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/gagbo/ouro-closures/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/gagbo/ouro-closures/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/gagbo/ouro-closures/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/gagbo/ouro-closures/contents/{+path}", + "compare_url": "https://api.github.com/repos/gagbo/ouro-closures/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/gagbo/ouro-closures/merges", + "archive_url": "https://api.github.com/repos/gagbo/ouro-closures/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/gagbo/ouro-closures/downloads", + "issues_url": "https://api.github.com/repos/gagbo/ouro-closures/issues{/number}", + "pulls_url": "https://api.github.com/repos/gagbo/ouro-closures/pulls{/number}", + "milestones_url": "https://api.github.com/repos/gagbo/ouro-closures/milestones{/number}", + "notifications_url": "https://api.github.com/repos/gagbo/ouro-closures/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/gagbo/ouro-closures/labels{/name}", + "releases_url": "https://api.github.com/repos/gagbo/ouro-closures/releases{/id}", + "deployments_url": "https://api.github.com/repos/gagbo/ouro-closures/deployments", + "created_at": "2022-09-16T14:02:04Z", + "updated_at": "2022-09-16T14:05:56Z", + "pushed_at": "2023-07-18T13:15:41Z", + "git_url": "git://github.com/gagbo/ouro-closures.git", + "ssh_url": "git@github.com:gagbo/ouro-closures.git", + "clone_url": "https://github.com/gagbo/ouro-closures.git", + "svn_url": "https://github.com/gagbo/ouro-closures", + "homepage": null, + "size": 2, + "stargazers_count": 0, + "watchers_count": 0, + "language": "Rust", + "has_issues": true, + "has_projects": true, + "has_downloads": true, + "has_wiki": true, + "has_pages": false, + "has_discussions": false, + "forks_count": 0, + "mirror_url": null, + "archived": false, + "disabled": false, + "open_issues_count": 2, + "license": null, + "allow_forking": true, + "is_template": false, + "web_commit_signoff_required": false, + "topics": [ + + ], + "visibility": "public", + "forks": 0, + "open_issues": 2, + "watchers": 0, + "default_branch": "trunk", + "allow_squash_merge": true, + "allow_merge_commit": true, + "allow_rebase_merge": true, + "allow_auto_merge": false, + "delete_branch_on_merge": false, + "allow_update_branch": false, + "use_squash_pr_title_as_default": false, + "squash_merge_commit_message": "COMMIT_MESSAGES", + "squash_merge_commit_title": "COMMIT_OR_PR_TITLE", + "merge_commit_message": "PR_TITLE", + "merge_commit_title": "MERGE_MESSAGE" + } + }, + "base": { + "label": "gagbo:trunk", + "ref": "trunk", + "sha": "ea6cd405a443e34aca1f57485ee151fb15a34729", + "user": { + "login": "gagbo", + "id": 10496163, + "node_id": "MDQ6VXNlcjEwNDk2MTYz", + "avatar_url": "https://avatars.githubusercontent.com/u/10496163?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/gagbo", + "html_url": "https://github.com/gagbo", + "followers_url": "https://api.github.com/users/gagbo/followers", + "following_url": "https://api.github.com/users/gagbo/following{/other_user}", + "gists_url": "https://api.github.com/users/gagbo/gists{/gist_id}", + "starred_url": "https://api.github.com/users/gagbo/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/gagbo/subscriptions", + "organizations_url": "https://api.github.com/users/gagbo/orgs", + "repos_url": "https://api.github.com/users/gagbo/repos", + "events_url": "https://api.github.com/users/gagbo/events{/privacy}", + "received_events_url": "https://api.github.com/users/gagbo/received_events", + "type": "User", + "site_admin": false + }, + "repo": { + "id": 537482687, + "node_id": "R_kgDOIAlVvw", + "name": "ouro-closures", + "full_name": "gagbo/ouro-closures", + "private": false, + "owner": { + "login": "gagbo", + "id": 10496163, + "node_id": "MDQ6VXNlcjEwNDk2MTYz", + "avatar_url": "https://avatars.githubusercontent.com/u/10496163?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/gagbo", + "html_url": "https://github.com/gagbo", + "followers_url": "https://api.github.com/users/gagbo/followers", + "following_url": "https://api.github.com/users/gagbo/following{/other_user}", + "gists_url": "https://api.github.com/users/gagbo/gists{/gist_id}", + "starred_url": "https://api.github.com/users/gagbo/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/gagbo/subscriptions", + "organizations_url": "https://api.github.com/users/gagbo/orgs", + "repos_url": "https://api.github.com/users/gagbo/repos", + "events_url": "https://api.github.com/users/gagbo/events{/privacy}", + "received_events_url": "https://api.github.com/users/gagbo/received_events", + "type": "User", + "site_admin": false + }, + "html_url": "https://github.com/gagbo/ouro-closures", + "description": "Draft to test self-referencing closure captures for r7", + "fork": false, + "url": "https://api.github.com/repos/gagbo/ouro-closures", + "forks_url": "https://api.github.com/repos/gagbo/ouro-closures/forks", + "keys_url": "https://api.github.com/repos/gagbo/ouro-closures/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/gagbo/ouro-closures/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/gagbo/ouro-closures/teams", + "hooks_url": "https://api.github.com/repos/gagbo/ouro-closures/hooks", + "issue_events_url": "https://api.github.com/repos/gagbo/ouro-closures/issues/events{/number}", + "events_url": "https://api.github.com/repos/gagbo/ouro-closures/events", + "assignees_url": "https://api.github.com/repos/gagbo/ouro-closures/assignees{/user}", + "branches_url": "https://api.github.com/repos/gagbo/ouro-closures/branches{/branch}", + "tags_url": "https://api.github.com/repos/gagbo/ouro-closures/tags", + "blobs_url": "https://api.github.com/repos/gagbo/ouro-closures/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/gagbo/ouro-closures/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/gagbo/ouro-closures/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/gagbo/ouro-closures/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/gagbo/ouro-closures/statuses/{sha}", + "languages_url": "https://api.github.com/repos/gagbo/ouro-closures/languages", + "stargazers_url": "https://api.github.com/repos/gagbo/ouro-closures/stargazers", + "contributors_url": "https://api.github.com/repos/gagbo/ouro-closures/contributors", + "subscribers_url": "https://api.github.com/repos/gagbo/ouro-closures/subscribers", + "subscription_url": "https://api.github.com/repos/gagbo/ouro-closures/subscription", + "commits_url": "https://api.github.com/repos/gagbo/ouro-closures/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/gagbo/ouro-closures/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/gagbo/ouro-closures/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/gagbo/ouro-closures/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/gagbo/ouro-closures/contents/{+path}", + "compare_url": "https://api.github.com/repos/gagbo/ouro-closures/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/gagbo/ouro-closures/merges", + "archive_url": "https://api.github.com/repos/gagbo/ouro-closures/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/gagbo/ouro-closures/downloads", + "issues_url": "https://api.github.com/repos/gagbo/ouro-closures/issues{/number}", + "pulls_url": "https://api.github.com/repos/gagbo/ouro-closures/pulls{/number}", + "milestones_url": "https://api.github.com/repos/gagbo/ouro-closures/milestones{/number}", + "notifications_url": "https://api.github.com/repos/gagbo/ouro-closures/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/gagbo/ouro-closures/labels{/name}", + "releases_url": "https://api.github.com/repos/gagbo/ouro-closures/releases{/id}", + "deployments_url": "https://api.github.com/repos/gagbo/ouro-closures/deployments", + "created_at": "2022-09-16T14:02:04Z", + "updated_at": "2022-09-16T14:05:56Z", + "pushed_at": "2023-07-18T13:15:41Z", + "git_url": "git://github.com/gagbo/ouro-closures.git", + "ssh_url": "git@github.com:gagbo/ouro-closures.git", + "clone_url": "https://github.com/gagbo/ouro-closures.git", + "svn_url": "https://github.com/gagbo/ouro-closures", + "homepage": null, + "size": 2, + "stargazers_count": 0, + "watchers_count": 0, + "language": "Rust", + "has_issues": true, + "has_projects": true, + "has_downloads": true, + "has_wiki": true, + "has_pages": false, + "has_discussions": false, + "forks_count": 0, + "mirror_url": null, + "archived": false, + "disabled": false, + "open_issues_count": 2, + "license": null, + "allow_forking": true, + "is_template": false, + "web_commit_signoff_required": false, + "topics": [ + + ], + "visibility": "public", + "forks": 0, + "open_issues": 2, + "watchers": 0, + "default_branch": "trunk", + "allow_squash_merge": true, + "allow_merge_commit": true, + "allow_rebase_merge": true, + "allow_auto_merge": false, + "delete_branch_on_merge": false, + "allow_update_branch": false, + "use_squash_pr_title_as_default": false, + "squash_merge_commit_message": "COMMIT_MESSAGES", + "squash_merge_commit_title": "COMMIT_OR_PR_TITLE", + "merge_commit_message": "PR_TITLE", + "merge_commit_title": "MERGE_MESSAGE" + } + }, + "_links": { + "self": { + "href": "https://api.github.com/repos/gagbo/ouro-closures/pulls/2" + }, + "html": { + "href": "https://github.com/gagbo/ouro-closures/pull/2" + }, + "issue": { + "href": "https://api.github.com/repos/gagbo/ouro-closures/issues/2" + }, + "comments": { + "href": "https://api.github.com/repos/gagbo/ouro-closures/issues/2/comments" + }, + "review_comments": { + "href": "https://api.github.com/repos/gagbo/ouro-closures/pulls/2/comments" + }, + "review_comment": { + "href": "https://api.github.com/repos/gagbo/ouro-closures/pulls/comments{/number}" + }, + "commits": { + "href": "https://api.github.com/repos/gagbo/ouro-closures/pulls/2/commits" + }, + "statuses": { + "href": "https://api.github.com/repos/gagbo/ouro-closures/statuses/36afaef2afdf0ce794d7e4663e7f327664aaa4d7" + } + }, + "author_association": "OWNER", + "auto_merge": null, + "active_lock_reason": null, + "merged": false, + "mergeable": null, + "rebaseable": null, + "mergeable_state": "unknown", + "merged_by": null, + "comments": 0, + "review_comments": 0, + "maintainer_can_modify": false, + "commits": 1, + "additions": 1, + "deletions": 0, + "changed_files": 1 + }, + "repository": { + "id": 537482687, + "node_id": "R_kgDOIAlVvw", + "name": "ouro-closures", + "full_name": "gagbo/ouro-closures", + "private": false, + "owner": { + "login": "gagbo", + "id": 10496163, + "node_id": "MDQ6VXNlcjEwNDk2MTYz", + "avatar_url": "https://avatars.githubusercontent.com/u/10496163?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/gagbo", + "html_url": "https://github.com/gagbo", + "followers_url": "https://api.github.com/users/gagbo/followers", + "following_url": "https://api.github.com/users/gagbo/following{/other_user}", + "gists_url": "https://api.github.com/users/gagbo/gists{/gist_id}", + "starred_url": "https://api.github.com/users/gagbo/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/gagbo/subscriptions", + "organizations_url": "https://api.github.com/users/gagbo/orgs", + "repos_url": "https://api.github.com/users/gagbo/repos", + "events_url": "https://api.github.com/users/gagbo/events{/privacy}", + "received_events_url": "https://api.github.com/users/gagbo/received_events", + "type": "User", + "site_admin": false + }, + "html_url": "https://github.com/gagbo/ouro-closures", + "description": "Draft to test self-referencing closure captures for r7", + "fork": false, + "url": "https://api.github.com/repos/gagbo/ouro-closures", + "forks_url": "https://api.github.com/repos/gagbo/ouro-closures/forks", + "keys_url": "https://api.github.com/repos/gagbo/ouro-closures/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/gagbo/ouro-closures/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/gagbo/ouro-closures/teams", + "hooks_url": "https://api.github.com/repos/gagbo/ouro-closures/hooks", + "issue_events_url": "https://api.github.com/repos/gagbo/ouro-closures/issues/events{/number}", + "events_url": "https://api.github.com/repos/gagbo/ouro-closures/events", + "assignees_url": "https://api.github.com/repos/gagbo/ouro-closures/assignees{/user}", + "branches_url": "https://api.github.com/repos/gagbo/ouro-closures/branches{/branch}", + "tags_url": "https://api.github.com/repos/gagbo/ouro-closures/tags", + "blobs_url": "https://api.github.com/repos/gagbo/ouro-closures/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/gagbo/ouro-closures/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/gagbo/ouro-closures/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/gagbo/ouro-closures/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/gagbo/ouro-closures/statuses/{sha}", + "languages_url": "https://api.github.com/repos/gagbo/ouro-closures/languages", + "stargazers_url": "https://api.github.com/repos/gagbo/ouro-closures/stargazers", + "contributors_url": "https://api.github.com/repos/gagbo/ouro-closures/contributors", + "subscribers_url": "https://api.github.com/repos/gagbo/ouro-closures/subscribers", + "subscription_url": "https://api.github.com/repos/gagbo/ouro-closures/subscription", + "commits_url": "https://api.github.com/repos/gagbo/ouro-closures/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/gagbo/ouro-closures/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/gagbo/ouro-closures/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/gagbo/ouro-closures/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/gagbo/ouro-closures/contents/{+path}", + "compare_url": "https://api.github.com/repos/gagbo/ouro-closures/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/gagbo/ouro-closures/merges", + "archive_url": "https://api.github.com/repos/gagbo/ouro-closures/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/gagbo/ouro-closures/downloads", + "issues_url": "https://api.github.com/repos/gagbo/ouro-closures/issues{/number}", + "pulls_url": "https://api.github.com/repos/gagbo/ouro-closures/pulls{/number}", + "milestones_url": "https://api.github.com/repos/gagbo/ouro-closures/milestones{/number}", + "notifications_url": "https://api.github.com/repos/gagbo/ouro-closures/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/gagbo/ouro-closures/labels{/name}", + "releases_url": "https://api.github.com/repos/gagbo/ouro-closures/releases{/id}", + "deployments_url": "https://api.github.com/repos/gagbo/ouro-closures/deployments", + "created_at": "2022-09-16T14:02:04Z", + "updated_at": "2022-09-16T14:05:56Z", + "pushed_at": "2023-07-18T13:15:41Z", + "git_url": "git://github.com/gagbo/ouro-closures.git", + "ssh_url": "git@github.com:gagbo/ouro-closures.git", + "clone_url": "https://github.com/gagbo/ouro-closures.git", + "svn_url": "https://github.com/gagbo/ouro-closures", + "homepage": null, + "size": 2, + "stargazers_count": 0, + "watchers_count": 0, + "language": "Rust", + "has_issues": true, + "has_projects": true, + "has_downloads": true, + "has_wiki": true, + "has_pages": false, + "has_discussions": false, + "forks_count": 0, + "mirror_url": null, + "archived": false, + "disabled": false, + "open_issues_count": 2, + "license": null, + "allow_forking": true, + "is_template": false, + "web_commit_signoff_required": false, + "topics": [ + + ], + "visibility": "public", + "forks": 0, + "open_issues": 2, + "watchers": 0, + "default_branch": "trunk" + }, + "sender": { + "login": "gagbo", + "id": 10496163, + "node_id": "MDQ6VXNlcjEwNDk2MTYz", + "avatar_url": "https://avatars.githubusercontent.com/u/10496163?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/gagbo", + "html_url": "https://github.com/gagbo", + "followers_url": "https://api.github.com/users/gagbo/followers", + "following_url": "https://api.github.com/users/gagbo/following{/other_user}", + "gists_url": "https://api.github.com/users/gagbo/gists{/gist_id}", + "starred_url": "https://api.github.com/users/gagbo/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/gagbo/subscriptions", + "organizations_url": "https://api.github.com/users/gagbo/orgs", + "repos_url": "https://api.github.com/users/gagbo/repos", + "events_url": "https://api.github.com/users/gagbo/events{/privacy}", + "received_events_url": "https://api.github.com/users/gagbo/received_events", + "type": "User", + "site_admin": false + }, + "installation": { + "id": 7777777, + "node_id": "WHEmPF0sNlxkQU1lPnEiWUdUTDwwYVo9QGlNaEkiQmQhdi1uZCEvc2E1NX1FOA==" + } +} diff --git a/tests/resources/pull_request_synchronize_webhook_event.json b/tests/resources/pull_request_synchronize_webhook_event.json new file mode 100644 index 00000000..b8a5ba71 --- /dev/null +++ b/tests/resources/pull_request_synchronize_webhook_event.json @@ -0,0 +1,508 @@ +{ + "action": "synchronize", + "number": 5, + "pull_request": { + "url": "https://api.github.com/repos/gagbo/ouro-closures/pulls/5", + "id": 1439285615, + "node_id": "PR_kwDOIAlVv85VycFv", + "html_url": "https://github.com/gagbo/ouro-closures/pull/5", + "diff_url": "https://github.com/gagbo/ouro-closures/pull/5.diff", + "patch_url": "https://github.com/gagbo/ouro-closures/pull/5.patch", + "issue_url": "https://api.github.com/repos/gagbo/ouro-closures/issues/5", + "number": 5, + "state": "open", + "locked": false, + "title": "[do not merge] test commit", + "user": { + "login": "gagbo", + "id": 10496163, + "node_id": "MDQ6VXNlcjEwNDk2MTYz", + "avatar_url": "https://avatars.githubusercontent.com/u/10496163?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/gagbo", + "html_url": "https://github.com/gagbo", + "followers_url": "https://api.github.com/users/gagbo/followers", + "following_url": "https://api.github.com/users/gagbo/following{/other_user}", + "gists_url": "https://api.github.com/users/gagbo/gists{/gist_id}", + "starred_url": "https://api.github.com/users/gagbo/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/gagbo/subscriptions", + "organizations_url": "https://api.github.com/users/gagbo/orgs", + "repos_url": "https://api.github.com/users/gagbo/repos", + "events_url": "https://api.github.com/users/gagbo/events{/privacy}", + "received_events_url": "https://api.github.com/users/gagbo/received_events", + "type": "User", + "site_admin": false + }, + "body": null, + "created_at": "2023-07-18T13:43:27Z", + "updated_at": "2023-07-18T13:54:23Z", + "closed_at": null, + "merged_at": null, + "merge_commit_sha": "d392f60e8ace6bd6965807ff3adf8578b90ee9aa", + "assignee": null, + "assignees": [ + + ], + "requested_reviewers": [ + + ], + "requested_teams": [ + + ], + "labels": [ + + ], + "milestone": null, + "draft": false, + "commits_url": "https://api.github.com/repos/gagbo/ouro-closures/pulls/5/commits", + "review_comments_url": "https://api.github.com/repos/gagbo/ouro-closures/pulls/5/comments", + "review_comment_url": "https://api.github.com/repos/gagbo/ouro-closures/pulls/comments{/number}", + "comments_url": "https://api.github.com/repos/gagbo/ouro-closures/issues/5/comments", + "statuses_url": "https://api.github.com/repos/gagbo/ouro-closures/statuses/7e39d83fc6a99f2c6a02cc7637c4de8db50da6ca", + "head": { + "label": "gagbo:test_pr_O", + "ref": "test_pr_O", + "sha": "7e39d83fc6a99f2c6a02cc7637c4de8db50da6ca", + "user": { + "login": "gagbo", + "id": 10496163, + "node_id": "MDQ6VXNlcjEwNDk2MTYz", + "avatar_url": "https://avatars.githubusercontent.com/u/10496163?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/gagbo", + "html_url": "https://github.com/gagbo", + "followers_url": "https://api.github.com/users/gagbo/followers", + "following_url": "https://api.github.com/users/gagbo/following{/other_user}", + "gists_url": "https://api.github.com/users/gagbo/gists{/gist_id}", + "starred_url": "https://api.github.com/users/gagbo/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/gagbo/subscriptions", + "organizations_url": "https://api.github.com/users/gagbo/orgs", + "repos_url": "https://api.github.com/users/gagbo/repos", + "events_url": "https://api.github.com/users/gagbo/events{/privacy}", + "received_events_url": "https://api.github.com/users/gagbo/received_events", + "type": "User", + "site_admin": false + }, + "repo": { + "id": 537482687, + "node_id": "R_kgDOIAlVvw", + "name": "ouro-closures", + "full_name": "gagbo/ouro-closures", + "private": false, + "owner": { + "login": "gagbo", + "id": 10496163, + "node_id": "MDQ6VXNlcjEwNDk2MTYz", + "avatar_url": "https://avatars.githubusercontent.com/u/10496163?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/gagbo", + "html_url": "https://github.com/gagbo", + "followers_url": "https://api.github.com/users/gagbo/followers", + "following_url": "https://api.github.com/users/gagbo/following{/other_user}", + "gists_url": "https://api.github.com/users/gagbo/gists{/gist_id}", + "starred_url": "https://api.github.com/users/gagbo/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/gagbo/subscriptions", + "organizations_url": "https://api.github.com/users/gagbo/orgs", + "repos_url": "https://api.github.com/users/gagbo/repos", + "events_url": "https://api.github.com/users/gagbo/events{/privacy}", + "received_events_url": "https://api.github.com/users/gagbo/received_events", + "type": "User", + "site_admin": false + }, + "html_url": "https://github.com/gagbo/ouro-closures", + "description": "Draft to test self-referencing closure captures for r7", + "fork": false, + "url": "https://api.github.com/repos/gagbo/ouro-closures", + "forks_url": "https://api.github.com/repos/gagbo/ouro-closures/forks", + "keys_url": "https://api.github.com/repos/gagbo/ouro-closures/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/gagbo/ouro-closures/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/gagbo/ouro-closures/teams", + "hooks_url": "https://api.github.com/repos/gagbo/ouro-closures/hooks", + "issue_events_url": "https://api.github.com/repos/gagbo/ouro-closures/issues/events{/number}", + "events_url": "https://api.github.com/repos/gagbo/ouro-closures/events", + "assignees_url": "https://api.github.com/repos/gagbo/ouro-closures/assignees{/user}", + "branches_url": "https://api.github.com/repos/gagbo/ouro-closures/branches{/branch}", + "tags_url": "https://api.github.com/repos/gagbo/ouro-closures/tags", + "blobs_url": "https://api.github.com/repos/gagbo/ouro-closures/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/gagbo/ouro-closures/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/gagbo/ouro-closures/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/gagbo/ouro-closures/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/gagbo/ouro-closures/statuses/{sha}", + "languages_url": "https://api.github.com/repos/gagbo/ouro-closures/languages", + "stargazers_url": "https://api.github.com/repos/gagbo/ouro-closures/stargazers", + "contributors_url": "https://api.github.com/repos/gagbo/ouro-closures/contributors", + "subscribers_url": "https://api.github.com/repos/gagbo/ouro-closures/subscribers", + "subscription_url": "https://api.github.com/repos/gagbo/ouro-closures/subscription", + "commits_url": "https://api.github.com/repos/gagbo/ouro-closures/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/gagbo/ouro-closures/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/gagbo/ouro-closures/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/gagbo/ouro-closures/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/gagbo/ouro-closures/contents/{+path}", + "compare_url": "https://api.github.com/repos/gagbo/ouro-closures/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/gagbo/ouro-closures/merges", + "archive_url": "https://api.github.com/repos/gagbo/ouro-closures/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/gagbo/ouro-closures/downloads", + "issues_url": "https://api.github.com/repos/gagbo/ouro-closures/issues{/number}", + "pulls_url": "https://api.github.com/repos/gagbo/ouro-closures/pulls{/number}", + "milestones_url": "https://api.github.com/repos/gagbo/ouro-closures/milestones{/number}", + "notifications_url": "https://api.github.com/repos/gagbo/ouro-closures/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/gagbo/ouro-closures/labels{/name}", + "releases_url": "https://api.github.com/repos/gagbo/ouro-closures/releases{/id}", + "deployments_url": "https://api.github.com/repos/gagbo/ouro-closures/deployments", + "created_at": "2022-09-16T14:02:04Z", + "updated_at": "2022-09-16T14:05:56Z", + "pushed_at": "2023-07-18T13:54:21Z", + "git_url": "git://github.com/gagbo/ouro-closures.git", + "ssh_url": "git@github.com:gagbo/ouro-closures.git", + "clone_url": "https://github.com/gagbo/ouro-closures.git", + "svn_url": "https://github.com/gagbo/ouro-closures", + "homepage": null, + "size": 2, + "stargazers_count": 0, + "watchers_count": 0, + "language": "Rust", + "has_issues": true, + "has_projects": true, + "has_downloads": true, + "has_wiki": true, + "has_pages": false, + "has_discussions": false, + "forks_count": 0, + "mirror_url": null, + "archived": false, + "disabled": false, + "open_issues_count": 2, + "license": null, + "allow_forking": true, + "is_template": false, + "web_commit_signoff_required": false, + "topics": [ + + ], + "visibility": "public", + "forks": 0, + "open_issues": 2, + "watchers": 0, + "default_branch": "trunk", + "allow_squash_merge": true, + "allow_merge_commit": true, + "allow_rebase_merge": true, + "allow_auto_merge": false, + "delete_branch_on_merge": false, + "allow_update_branch": false, + "use_squash_pr_title_as_default": false, + "squash_merge_commit_message": "COMMIT_MESSAGES", + "squash_merge_commit_title": "COMMIT_OR_PR_TITLE", + "merge_commit_message": "PR_TITLE", + "merge_commit_title": "MERGE_MESSAGE" + } + }, + "base": { + "label": "gagbo:trunk", + "ref": "trunk", + "sha": "ea6cd405a443e34aca1f57485ee151fb15a34729", + "user": { + "login": "gagbo", + "id": 10496163, + "node_id": "MDQ6VXNlcjEwNDk2MTYz", + "avatar_url": "https://avatars.githubusercontent.com/u/10496163?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/gagbo", + "html_url": "https://github.com/gagbo", + "followers_url": "https://api.github.com/users/gagbo/followers", + "following_url": "https://api.github.com/users/gagbo/following{/other_user}", + "gists_url": "https://api.github.com/users/gagbo/gists{/gist_id}", + "starred_url": "https://api.github.com/users/gagbo/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/gagbo/subscriptions", + "organizations_url": "https://api.github.com/users/gagbo/orgs", + "repos_url": "https://api.github.com/users/gagbo/repos", + "events_url": "https://api.github.com/users/gagbo/events{/privacy}", + "received_events_url": "https://api.github.com/users/gagbo/received_events", + "type": "User", + "site_admin": false + }, + "repo": { + "id": 537482687, + "node_id": "R_kgDOIAlVvw", + "name": "ouro-closures", + "full_name": "gagbo/ouro-closures", + "private": false, + "owner": { + "login": "gagbo", + "id": 10496163, + "node_id": "MDQ6VXNlcjEwNDk2MTYz", + "avatar_url": "https://avatars.githubusercontent.com/u/10496163?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/gagbo", + "html_url": "https://github.com/gagbo", + "followers_url": "https://api.github.com/users/gagbo/followers", + "following_url": "https://api.github.com/users/gagbo/following{/other_user}", + "gists_url": "https://api.github.com/users/gagbo/gists{/gist_id}", + "starred_url": "https://api.github.com/users/gagbo/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/gagbo/subscriptions", + "organizations_url": "https://api.github.com/users/gagbo/orgs", + "repos_url": "https://api.github.com/users/gagbo/repos", + "events_url": "https://api.github.com/users/gagbo/events{/privacy}", + "received_events_url": "https://api.github.com/users/gagbo/received_events", + "type": "User", + "site_admin": false + }, + "html_url": "https://github.com/gagbo/ouro-closures", + "description": "Draft to test self-referencing closure captures for r7", + "fork": false, + "url": "https://api.github.com/repos/gagbo/ouro-closures", + "forks_url": "https://api.github.com/repos/gagbo/ouro-closures/forks", + "keys_url": "https://api.github.com/repos/gagbo/ouro-closures/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/gagbo/ouro-closures/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/gagbo/ouro-closures/teams", + "hooks_url": "https://api.github.com/repos/gagbo/ouro-closures/hooks", + "issue_events_url": "https://api.github.com/repos/gagbo/ouro-closures/issues/events{/number}", + "events_url": "https://api.github.com/repos/gagbo/ouro-closures/events", + "assignees_url": "https://api.github.com/repos/gagbo/ouro-closures/assignees{/user}", + "branches_url": "https://api.github.com/repos/gagbo/ouro-closures/branches{/branch}", + "tags_url": "https://api.github.com/repos/gagbo/ouro-closures/tags", + "blobs_url": "https://api.github.com/repos/gagbo/ouro-closures/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/gagbo/ouro-closures/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/gagbo/ouro-closures/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/gagbo/ouro-closures/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/gagbo/ouro-closures/statuses/{sha}", + "languages_url": "https://api.github.com/repos/gagbo/ouro-closures/languages", + "stargazers_url": "https://api.github.com/repos/gagbo/ouro-closures/stargazers", + "contributors_url": "https://api.github.com/repos/gagbo/ouro-closures/contributors", + "subscribers_url": "https://api.github.com/repos/gagbo/ouro-closures/subscribers", + "subscription_url": "https://api.github.com/repos/gagbo/ouro-closures/subscription", + "commits_url": "https://api.github.com/repos/gagbo/ouro-closures/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/gagbo/ouro-closures/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/gagbo/ouro-closures/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/gagbo/ouro-closures/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/gagbo/ouro-closures/contents/{+path}", + "compare_url": "https://api.github.com/repos/gagbo/ouro-closures/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/gagbo/ouro-closures/merges", + "archive_url": "https://api.github.com/repos/gagbo/ouro-closures/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/gagbo/ouro-closures/downloads", + "issues_url": "https://api.github.com/repos/gagbo/ouro-closures/issues{/number}", + "pulls_url": "https://api.github.com/repos/gagbo/ouro-closures/pulls{/number}", + "milestones_url": "https://api.github.com/repos/gagbo/ouro-closures/milestones{/number}", + "notifications_url": "https://api.github.com/repos/gagbo/ouro-closures/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/gagbo/ouro-closures/labels{/name}", + "releases_url": "https://api.github.com/repos/gagbo/ouro-closures/releases{/id}", + "deployments_url": "https://api.github.com/repos/gagbo/ouro-closures/deployments", + "created_at": "2022-09-16T14:02:04Z", + "updated_at": "2022-09-16T14:05:56Z", + "pushed_at": "2023-07-18T13:54:21Z", + "git_url": "git://github.com/gagbo/ouro-closures.git", + "ssh_url": "git@github.com:gagbo/ouro-closures.git", + "clone_url": "https://github.com/gagbo/ouro-closures.git", + "svn_url": "https://github.com/gagbo/ouro-closures", + "homepage": null, + "size": 2, + "stargazers_count": 0, + "watchers_count": 0, + "language": "Rust", + "has_issues": true, + "has_projects": true, + "has_downloads": true, + "has_wiki": true, + "has_pages": false, + "has_discussions": false, + "forks_count": 0, + "mirror_url": null, + "archived": false, + "disabled": false, + "open_issues_count": 2, + "license": null, + "allow_forking": true, + "is_template": false, + "web_commit_signoff_required": false, + "topics": [ + + ], + "visibility": "public", + "forks": 0, + "open_issues": 2, + "watchers": 0, + "default_branch": "trunk", + "allow_squash_merge": true, + "allow_merge_commit": true, + "allow_rebase_merge": true, + "allow_auto_merge": false, + "delete_branch_on_merge": false, + "allow_update_branch": false, + "use_squash_pr_title_as_default": false, + "squash_merge_commit_message": "COMMIT_MESSAGES", + "squash_merge_commit_title": "COMMIT_OR_PR_TITLE", + "merge_commit_message": "PR_TITLE", + "merge_commit_title": "MERGE_MESSAGE" + } + }, + "_links": { + "self": { + "href": "https://api.github.com/repos/gagbo/ouro-closures/pulls/5" + }, + "html": { + "href": "https://github.com/gagbo/ouro-closures/pull/5" + }, + "issue": { + "href": "https://api.github.com/repos/gagbo/ouro-closures/issues/5" + }, + "comments": { + "href": "https://api.github.com/repos/gagbo/ouro-closures/issues/5/comments" + }, + "review_comments": { + "href": "https://api.github.com/repos/gagbo/ouro-closures/pulls/5/comments" + }, + "review_comment": { + "href": "https://api.github.com/repos/gagbo/ouro-closures/pulls/comments{/number}" + }, + "commits": { + "href": "https://api.github.com/repos/gagbo/ouro-closures/pulls/5/commits" + }, + "statuses": { + "href": "https://api.github.com/repos/gagbo/ouro-closures/statuses/7e39d83fc6a99f2c6a02cc7637c4de8db50da6ca" + } + }, + "author_association": "OWNER", + "auto_merge": null, + "active_lock_reason": null, + "merged": false, + "mergeable": null, + "rebaseable": null, + "mergeable_state": "unknown", + "merged_by": null, + "comments": 1, + "review_comments": 0, + "maintainer_can_modify": false, + "commits": 1, + "additions": 1, + "deletions": 0, + "changed_files": 1 + }, + "before": "36afaef2afdf0ce794d7e4663e7f327664aaa4d7", + "after": "7e39d83fc6a99f2c6a02cc7637c4de8db50da6ca", + "repository": { + "id": 537482687, + "node_id": "R_kgDOIAlVvw", + "name": "ouro-closures", + "full_name": "gagbo/ouro-closures", + "private": false, + "owner": { + "login": "gagbo", + "id": 10496163, + "node_id": "MDQ6VXNlcjEwNDk2MTYz", + "avatar_url": "https://avatars.githubusercontent.com/u/10496163?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/gagbo", + "html_url": "https://github.com/gagbo", + "followers_url": "https://api.github.com/users/gagbo/followers", + "following_url": "https://api.github.com/users/gagbo/following{/other_user}", + "gists_url": "https://api.github.com/users/gagbo/gists{/gist_id}", + "starred_url": "https://api.github.com/users/gagbo/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/gagbo/subscriptions", + "organizations_url": "https://api.github.com/users/gagbo/orgs", + "repos_url": "https://api.github.com/users/gagbo/repos", + "events_url": "https://api.github.com/users/gagbo/events{/privacy}", + "received_events_url": "https://api.github.com/users/gagbo/received_events", + "type": "User", + "site_admin": false + }, + "html_url": "https://github.com/gagbo/ouro-closures", + "description": "Draft to test self-referencing closure captures for r7", + "fork": false, + "url": "https://api.github.com/repos/gagbo/ouro-closures", + "forks_url": "https://api.github.com/repos/gagbo/ouro-closures/forks", + "keys_url": "https://api.github.com/repos/gagbo/ouro-closures/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/gagbo/ouro-closures/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/gagbo/ouro-closures/teams", + "hooks_url": "https://api.github.com/repos/gagbo/ouro-closures/hooks", + "issue_events_url": "https://api.github.com/repos/gagbo/ouro-closures/issues/events{/number}", + "events_url": "https://api.github.com/repos/gagbo/ouro-closures/events", + "assignees_url": "https://api.github.com/repos/gagbo/ouro-closures/assignees{/user}", + "branches_url": "https://api.github.com/repos/gagbo/ouro-closures/branches{/branch}", + "tags_url": "https://api.github.com/repos/gagbo/ouro-closures/tags", + "blobs_url": "https://api.github.com/repos/gagbo/ouro-closures/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/gagbo/ouro-closures/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/gagbo/ouro-closures/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/gagbo/ouro-closures/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/gagbo/ouro-closures/statuses/{sha}", + "languages_url": "https://api.github.com/repos/gagbo/ouro-closures/languages", + "stargazers_url": "https://api.github.com/repos/gagbo/ouro-closures/stargazers", + "contributors_url": "https://api.github.com/repos/gagbo/ouro-closures/contributors", + "subscribers_url": "https://api.github.com/repos/gagbo/ouro-closures/subscribers", + "subscription_url": "https://api.github.com/repos/gagbo/ouro-closures/subscription", + "commits_url": "https://api.github.com/repos/gagbo/ouro-closures/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/gagbo/ouro-closures/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/gagbo/ouro-closures/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/gagbo/ouro-closures/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/gagbo/ouro-closures/contents/{+path}", + "compare_url": "https://api.github.com/repos/gagbo/ouro-closures/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/gagbo/ouro-closures/merges", + "archive_url": "https://api.github.com/repos/gagbo/ouro-closures/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/gagbo/ouro-closures/downloads", + "issues_url": "https://api.github.com/repos/gagbo/ouro-closures/issues{/number}", + "pulls_url": "https://api.github.com/repos/gagbo/ouro-closures/pulls{/number}", + "milestones_url": "https://api.github.com/repos/gagbo/ouro-closures/milestones{/number}", + "notifications_url": "https://api.github.com/repos/gagbo/ouro-closures/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/gagbo/ouro-closures/labels{/name}", + "releases_url": "https://api.github.com/repos/gagbo/ouro-closures/releases{/id}", + "deployments_url": "https://api.github.com/repos/gagbo/ouro-closures/deployments", + "created_at": "2022-09-16T14:02:04Z", + "updated_at": "2022-09-16T14:05:56Z", + "pushed_at": "2023-07-18T13:54:21Z", + "git_url": "git://github.com/gagbo/ouro-closures.git", + "ssh_url": "git@github.com:gagbo/ouro-closures.git", + "clone_url": "https://github.com/gagbo/ouro-closures.git", + "svn_url": "https://github.com/gagbo/ouro-closures", + "homepage": null, + "size": 2, + "stargazers_count": 0, + "watchers_count": 0, + "language": "Rust", + "has_issues": true, + "has_projects": true, + "has_downloads": true, + "has_wiki": true, + "has_pages": false, + "has_discussions": false, + "forks_count": 0, + "mirror_url": null, + "archived": false, + "disabled": false, + "open_issues_count": 2, + "license": null, + "allow_forking": true, + "is_template": false, + "web_commit_signoff_required": false, + "topics": [ + + ], + "visibility": "public", + "forks": 0, + "open_issues": 2, + "watchers": 0, + "default_branch": "trunk" + }, + "sender": { + "login": "gagbo", + "id": 10496163, + "node_id": "MDQ6VXNlcjEwNDk2MTYz", + "avatar_url": "https://avatars.githubusercontent.com/u/10496163?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/gagbo", + "html_url": "https://github.com/gagbo", + "followers_url": "https://api.github.com/users/gagbo/followers", + "following_url": "https://api.github.com/users/gagbo/following{/other_user}", + "gists_url": "https://api.github.com/users/gagbo/gists{/gist_id}", + "starred_url": "https://api.github.com/users/gagbo/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/gagbo/subscriptions", + "organizations_url": "https://api.github.com/users/gagbo/orgs", + "repos_url": "https://api.github.com/users/gagbo/repos", + "events_url": "https://api.github.com/users/gagbo/events{/privacy}", + "received_events_url": "https://api.github.com/users/gagbo/received_events", + "type": "User", + "site_admin": false + }, + "installation": { + "id": 7777777, + "node_id": "WHEmPF0sNlxkQU1lPnEiWUdUTDwwYVo9QGlNaEkiQmQhdi1uZCEvc2E1NX1FOA==" + } +} diff --git a/tests/resources/repository_deleted_webhook_event.json b/tests/resources/repository_deleted_webhook_event.json new file mode 100644 index 00000000..2b0ccf9c --- /dev/null +++ b/tests/resources/repository_deleted_webhook_event.json @@ -0,0 +1,135 @@ +{ + "action": "deleted", + "repository": { + "id": 455581571, + "node_id": "R_kgDOGyefgw", + "name": "otp", + "full_name": "gagbo/otp", + "private": false, + "owner": { + "login": "gagbo", + "id": 10496163, + "node_id": "MDQ6VXNlcjEwNDk2MTYz", + "avatar_url": "https://avatars.githubusercontent.com/u/10496163?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/gagbo", + "html_url": "https://github.com/gagbo", + "followers_url": "https://api.github.com/users/gagbo/followers", + "following_url": "https://api.github.com/users/gagbo/following{/other_user}", + "gists_url": "https://api.github.com/users/gagbo/gists{/gist_id}", + "starred_url": "https://api.github.com/users/gagbo/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/gagbo/subscriptions", + "organizations_url": "https://api.github.com/users/gagbo/orgs", + "repos_url": "https://api.github.com/users/gagbo/repos", + "events_url": "https://api.github.com/users/gagbo/events{/privacy}", + "received_events_url": "https://api.github.com/users/gagbo/received_events", + "type": "User", + "site_admin": false + }, + "html_url": "https://github.com/gagbo/otp", + "description": "Erlang/OTP", + "fork": true, + "url": "https://api.github.com/repos/gagbo/otp", + "forks_url": "https://api.github.com/repos/gagbo/otp/forks", + "keys_url": "https://api.github.com/repos/gagbo/otp/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/gagbo/otp/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/gagbo/otp/teams", + "hooks_url": "https://api.github.com/repos/gagbo/otp/hooks", + "issue_events_url": "https://api.github.com/repos/gagbo/otp/issues/events{/number}", + "events_url": "https://api.github.com/repos/gagbo/otp/events", + "assignees_url": "https://api.github.com/repos/gagbo/otp/assignees{/user}", + "branches_url": "https://api.github.com/repos/gagbo/otp/branches{/branch}", + "tags_url": "https://api.github.com/repos/gagbo/otp/tags", + "blobs_url": "https://api.github.com/repos/gagbo/otp/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/gagbo/otp/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/gagbo/otp/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/gagbo/otp/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/gagbo/otp/statuses/{sha}", + "languages_url": "https://api.github.com/repos/gagbo/otp/languages", + "stargazers_url": "https://api.github.com/repos/gagbo/otp/stargazers", + "contributors_url": "https://api.github.com/repos/gagbo/otp/contributors", + "subscribers_url": "https://api.github.com/repos/gagbo/otp/subscribers", + "subscription_url": "https://api.github.com/repos/gagbo/otp/subscription", + "commits_url": "https://api.github.com/repos/gagbo/otp/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/gagbo/otp/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/gagbo/otp/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/gagbo/otp/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/gagbo/otp/contents/{+path}", + "compare_url": "https://api.github.com/repos/gagbo/otp/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/gagbo/otp/merges", + "archive_url": "https://api.github.com/repos/gagbo/otp/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/gagbo/otp/downloads", + "issues_url": "https://api.github.com/repos/gagbo/otp/issues{/number}", + "pulls_url": "https://api.github.com/repos/gagbo/otp/pulls{/number}", + "milestones_url": "https://api.github.com/repos/gagbo/otp/milestones{/number}", + "notifications_url": "https://api.github.com/repos/gagbo/otp/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/gagbo/otp/labels{/name}", + "releases_url": "https://api.github.com/repos/gagbo/otp/releases{/id}", + "deployments_url": "https://api.github.com/repos/gagbo/otp/deployments", + "created_at": "2022-02-04T14:41:07Z", + "updated_at": "2023-07-24T14:07:54Z", + "pushed_at": "2022-02-04T09:10:29Z", + "git_url": "git://github.com/gagbo/otp.git", + "ssh_url": "git@github.com:gagbo/otp.git", + "clone_url": "https://github.com/gagbo/otp.git", + "svn_url": "https://github.com/gagbo/otp", + "homepage": "http://erlang.org", + "size": 415386, + "stargazers_count": 0, + "watchers_count": 0, + "language": null, + "has_issues": false, + "has_projects": true, + "has_downloads": false, + "has_wiki": true, + "has_pages": false, + "has_discussions": false, + "forks_count": 0, + "mirror_url": null, + "archived": false, + "disabled": true, + "open_issues_count": 0, + "license": { + "key": "apache-2.0", + "name": "Apache License 2.0", + "spdx_id": "Apache-2.0", + "url": "https://api.github.com/licenses/apache-2.0", + "node_id": "MDc6TGljZW5zZTI=" + }, + "allow_forking": true, + "is_template": false, + "web_commit_signoff_required": false, + "topics": [ + + ], + "visibility": "public", + "forks": 0, + "open_issues": 0, + "watchers": 0, + "default_branch": "master" + }, + "sender": { + "login": "gagbo", + "id": 10496163, + "node_id": "MDQ6VXNlcjEwNDk2MTYz", + "avatar_url": "https://avatars.githubusercontent.com/u/10496163?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/gagbo", + "html_url": "https://github.com/gagbo", + "followers_url": "https://api.github.com/users/gagbo/followers", + "following_url": "https://api.github.com/users/gagbo/following{/other_user}", + "gists_url": "https://api.github.com/users/gagbo/gists{/gist_id}", + "starred_url": "https://api.github.com/users/gagbo/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/gagbo/subscriptions", + "organizations_url": "https://api.github.com/users/gagbo/orgs", + "repos_url": "https://api.github.com/users/gagbo/repos", + "events_url": "https://api.github.com/users/gagbo/events{/privacy}", + "received_events_url": "https://api.github.com/users/gagbo/received_events", + "type": "User", + "site_admin": false + }, + "installation": { + "id": 7777777, + "node_id": "WHEmPF0sNlxkQU1lPnEiWUdUTDwwYVo9QGlNaEkiQmQhdi1uZCEvc2E1NX1FOA==" + } +}