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

GitHub Team event is missing #580

Closed
kacamific opened this issue Mar 11, 2024 · 12 comments · Fixed by #584
Closed

GitHub Team event is missing #580

kacamific opened this issue Mar 11, 2024 · 12 comments · Fixed by #584

Comments

@kacamific
Copy link

Hi,

Currently it is possible to listen to GitHub Team events only using @RawEvent.

Would it be possible to add support for it?

Thank you in advance!

@gsmet
Copy link
Member

gsmet commented Mar 17, 2024

Thanks for opening an issue.

It will need to be added to https://github.com/hub4j/github-api/ first. I will have a look.

Which event do you need exactly? Only team or you need some others like membership?

I let you have a look at https://docs.github.com/en/webhooks/webhook-events-and-payloads and let me know.

Thanks!

@kacamific
Copy link
Author

@gsmet thanks for your support.

Actually I need the following:

  • membership
  • team_add
  • team
  • member

@gsmet
Copy link
Member

gsmet commented Mar 17, 2024

Yeah, that's what I thought. I created a PR in the GitHub API project: hub4j/github-api#1818 .

I'll implement the annotations here when it gets merged and released.

@gsmet
Copy link
Member

gsmet commented Mar 17, 2024

Until it's implemented, you can update to 2.3.3 where I exposed GitHubEvent#getParsedPayload(), which returns a JsonObject that allows to manipulate things a bit more easily.

Obviously, things will be a lot better once properly implemented but if you want to make progress, that could be a workable alternative until then.

@gsmet
Copy link
Member

gsmet commented Mar 17, 2024

I prepared the integration of the new payloads here: #584 .

@gsmet
Copy link
Member

gsmet commented Mar 19, 2024

Added in #584 .

@gsmet gsmet closed this as completed Mar 19, 2024
@gsmet
Copy link
Member

gsmet commented Mar 19, 2024

@kacamific 2.4.0 is available with support for team, team_add, member and membership events.

Let me know how it goes for you.

@kacamific
Copy link
Author

@gsmet Thanks a lot for providing the events.
I checked and I confirm that I was able to use all of them.

During some investigation, I see that the membership GHMemberChanges has only permission and not roleName. Also the mapping of the permission is usually returning Unknown as the payload when adding new user is as following

"changes": { "permission": { "to": "write" }, "role_name": { "to": "maintain" } },

I hope you can support by adding the rolename and maybe to do a mapping to the permission as well.

Again, thanks a lot, you were super fast!

@gsmet
Copy link
Member

gsmet commented Mar 19, 2024

Ah I was unable to reproduce the role_name thing myself. I will have a look.

As for permission, I wonder if it uses the same thing when using roles.

I will have a closer look.

@gsmet
Copy link
Member

gsmet commented Mar 20, 2024

I pushed hub4j/github-api#1821 .

Basically, this particular event is a mess and GitHub is using inconsistent values depending on the event.

I'm not sure when we will get a new GitHub API release that fixes it, I'll upgrade when we do.

@kacamific
Copy link
Author

@gsmet thanks a lot!

@gsmet
Copy link
Member

gsmet commented Mar 21, 2024

@bitwiseman was kind enough to release 1.321 so I updated to it and released 2.4.2 that is now available on Maven Central.

I changed the types to String as this thing is currently a big mess: added and edited events are not handling changes the same way and are not using the same permission names. Also the role name is only present for added (and not always... as I didn't get the role name set during my tests).

This has nothing to do with our implementation but with the payload structure sent by GitHub. You might have to actually get the permissions from the repository when you receive an edited event to get all the information you need.

Let us know how it goes for you as it might be something we could document.

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 a pull request may close this issue.

2 participants