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

Add support for personal_access_token_request webhook event type #2826

Merged
merged 3 commits into from
Jul 15, 2023

Conversation

joaopenteado
Copy link
Contributor

This PR adds support for the personal_access_token_request webhook event.

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.

@gmlewis gmlewis changed the title Added support for personal_access_token_request webhook event type Add support for personal_access_token_request webhook event type Jul 4, 2023
@codecov
Copy link

codecov bot commented Jul 4, 2023

Codecov Report

Merging #2826 (722192c) into master (9f7124c) will increase coverage by 0.00%.
The diff coverage is 100.00%.

❗ Current head 722192c differs from pull request most recent head fe0949f. Consider uploading reports for the commit fe0949f to get more accurate results

@@           Coverage Diff           @@
##           master    #2826   +/-   ##
=======================================
  Coverage   98.06%   98.06%           
=======================================
  Files         136      136           
  Lines       12279    12281    +2     
=======================================
+ Hits        12041    12043    +2     
  Misses        162      162           
  Partials       76       76           
Impacted Files Coverage Δ
github/event_types.go 100.00% <ø> (ø)
github/messages.go 100.00% <ø> (ø)
github/event.go 100.00% <100.00%> (ø)

Copy link
Collaborator

@gmlewis gmlewis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, @joaopenteado !
Just a few tweaks please, then we will be ready for a second LGTM+Approval from any other contributor to this repo before merging.

github/event_types.go Show resolved Hide resolved
github/event_types.go Show resolved Hide resolved
@gmlewis gmlewis added the NeedsReview PR is awaiting a review before merging. label Jul 4, 2023
@joaopenteado
Copy link
Contributor Author

Thanks for the very quick response, @gmlewis!
I've just committed the documentation changes requested. Let me know if you want any additional changes.

Copy link
Collaborator

@gmlewis gmlewis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, @joaopenteado !
LGTM.

Awaiting second LGTM+Approval from any other contributor to this repo before merging.

@joaopenteado
Copy link
Contributor Author

joaopenteado commented Jul 6, 2023

@gmlewis upon further testing, I've actually found that this webhook delivers an map of permissions in the API. This isn't very well documented IMO but could be inferred I guess. I've updated the event type to fix this. Here's an excerpt from a webhook event I received from GitHub during integration testing:

{
  "action": "created",
  "personal_access_token_request": {
    "id": 11233,
    "owner": { /* ... */ },
    "repository_selection": "all",
    "repository_count": null,
    "repositories": null,
    "permissions_added": {
      "organization": {
        "organization_announcement_banners": "write",
        "organization_events": "read"
      },
      "repository": {
        "codespaces_lifecycle_admin": "read",
        "metadata": "read",
        "security_events": "write"
      }
    },
    "permissions_upgraded": {},
    "permissions_result": {
      "organization": {
        "organization_announcement_banners": "write",
        "organization_events": "read"
      },
      "repository": {
        "codespaces_lifecycle_admin": "read",
        "metadata": "read",
        "security_events": "write"
      }
    },
    "created_at": "2023-07-07T00:37:57+09:00",
    "token_expired": false,
    "token_expires_at": "2023-08-05T15:37:56Z",
    "token_last_used_at": null
  },
  "organization": { /* ... */ },
  "sender": { /* ... */},
  "installation": {
    "id": 1111111,
    "node_id": "xxxxxxxxxxxxxx"
  }

Copy link
Collaborator

@gmlewis gmlewis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, @joaopenteado !
LGTM.

Awaiting second LGTM+Approval from any other contributor to this repo before merging.

Copy link
Contributor

@liaodaniel liaodaniel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@gmlewis gmlewis removed the NeedsReview PR is awaiting a review before merging. label Jul 15, 2023
@gmlewis
Copy link
Collaborator

gmlewis commented Jul 15, 2023

Thank you, @liaodaniel !
Merging.

@gmlewis gmlewis merged commit 43ffb6a into google:master Jul 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants