Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

new_permissions_accepted webhook event does not deserialize #444

Closed
gagbo opened this issue Aug 18, 2023 · 0 comments · Fixed by #448
Closed

new_permissions_accepted webhook event does not deserialize #444

gagbo opened this issue Aug 18, 2023 · 0 comments · Fixed by #448
Labels
bug Something isn't working good first issue Good for newcomers help wanted Extra attention is needed

Comments

@gagbo
Copy link
Contributor

gagbo commented Aug 18, 2023

This is something that anyone can work on really, I'm mostly marking it as TODO, and it's too annoying/blocking for me I'll end up fixing it

Payload

Header: X-Github-Event => installation

{
    "action": "new_permissions_accepted",
    "installation": {
        "id": 88888888,
        "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/88888888/access_tokens",
        "repositories_url": "https://api.github.com/installation/repositories",
        "html_url": "https://github.com/settings/installations/88888888",
        "app_id": 7777777,
        "app_slug": "gagbo-test-app",
        "target_id": 10496163,
        "target_type": "User",
        "permissions": {
            "issues": "write",
            "actions": "write",
            "contents": "read",
            "metadata": "read",
            "pull_requests": "write"
        },
        "events": [
            "create",
            "delete",
            "fork",
            "issues",
            "issue_comment",
            "pull_request",
            "pull_request_review",
            "pull_request_review_comment",
            "pull_request_review_thread",
            "push",
            "release",
            "repository"
        ],
        "created_at": "2023-07-13T11:35:31.000+02:00",
        "updated_at": "2023-08-18T15:28:04.000+02:00",
        "single_file_name": null,
        "has_multiple_single_files": false,
        "single_file_paths": [],
        "suspended_by": null,
        "suspended_at": 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
    }
}

Error

serialization/deserialization error: missing field `repositories`
@XAMPPRocky XAMPPRocky added bug Something isn't working help wanted Extra attention is needed good first issue Good for newcomers labels Aug 18, 2023
gagbo added a commit to gagbo/octocrab that referenced this issue Aug 23, 2023
- `new_permissions_accepted` events can now be deserialized even if
  they do not have the `repositories` field like the other actions of
  this webhook event type.
- when the fully hydrated installation object is contained in a webhook
  event, octocrab now gives access to the `created_at` and `updated_at`
  timestamps related to the installation.

This commit also mentions in the doc-string of Installation::events that
at least in the webhook events case, it should be expected to have
values matching the string versions of
`octocrab::models::webhook_events::WebhookEventType` variants

Fixes XAMPPRocky#444
XAMPPRocky pushed a commit that referenced this issue Aug 24, 2023
- `new_permissions_accepted` events can now be deserialized even if
  they do not have the `repositories` field like the other actions of
  this webhook event type.
- when the fully hydrated installation object is contained in a webhook
  event, octocrab now gives access to the `created_at` and `updated_at`
  timestamps related to the installation.

This commit also mentions in the doc-string of Installation::events that
at least in the webhook events case, it should be expected to have
values matching the string versions of
`octocrab::models::webhook_events::WebhookEventType` variants

Fixes #444
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants