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

Support team, team_add, member and membership payloads #1818

Merged
merged 3 commits into from
Mar 18, 2024

Conversation

gsmet
Copy link
Contributor

@gsmet gsmet commented Mar 17, 2024

Description

I removed/updated some outdated files that were apparently added in the hope of someone implementing the payloads but I preferred to start fresh with new updated payloads.

I did a few adjustments to some existing enums to make sure we don't have an error when a payload arrives with an unknown value. I used the same pattern we decided to implement some time ago.

See https://docs.github.com/en/webhooks/webhook-events-and-payloads .

Before submitting a PR:

  • Changes must not break binary backwards compatibility. If you are unclear on how to make the change you think is needed while maintaining backward compatibility, CONTRIBUTING.md for details.
  • Add JavaDocs and other comments explaining the behavior.
  • When adding or updating methods that fetch entities, add @link JavaDoc entries to the relevant documentation on https://docs.github.com/en/rest .
  • Add tests that cover any added or changed code. This generally requires capturing snapshot test data. See CONTRIBUTING.md for details.
  • Run mvn -D enable-ci clean install site locally. If this command doesn't succeed, your change will not pass CI.
  • Push your changes to a branch other than main. You will create your PR from that branch.

When creating a PR:

  • Fill in the "Description" above with clear summary of the changes. This includes:
    • If this PR fixes one or more issues, include "Fixes #" lines for each issue.
    • Provide links to relevant documentation on https://docs.github.com/en/rest where possible. If not including links, explain why not.
  • All lines of new code should be covered by tests as reported by code coverage. Any lines that are not covered must have PR comments explaining why they cannot be covered. For example, "Reaching this particular exception is hard and is not a particular common scenario."
  • Enable "Allow edits from maintainers".

@gsmet
Copy link
Contributor Author

gsmet commented Mar 17, 2024

@bitwiseman this is the PR I was talking about in another thread. I would appreciate if we could shoe it in the new version that you planned to release soon.

Copy link

codecov bot commented Mar 17, 2024

Codecov Report

Attention: Patch coverage is 75.00000% with 16 lines in your changes are missing coverage. Please review.

Project coverage is 80.69%. Comparing base (1aa7178) to head (ee25c39).
Report is 4 commits behind head on main.

Files Patch % Lines
...c/main/java/org/kohsuke/github/GHEventPayload.java 65.71% 6 Missing and 6 partials ⚠️
...rc/main/java/org/kohsuke/github/GHTeamChanges.java 80.00% 0 Missing and 3 partials ⚠️
src/main/java/org/kohsuke/github/GHTeam.java 75.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main    #1818      +/-   ##
============================================
+ Coverage     80.66%   80.69%   +0.02%     
- Complexity     2342     2350       +8     
============================================
  Files           220      223       +3     
  Lines          7082     7173      +91     
  Branches        379      393      +14     
============================================
+ Hits           5713     5788      +75     
- Misses         1132     1139       +7     
- Partials        237      246       +9     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@gsmet
Copy link
Contributor Author

gsmet commented Mar 17, 2024

I checked the codecov report and I think the test coverage is as good as it can be.

I'm having a look at the Java 17 site issue as I was running things with Java 11 and apparently, it's more strict with Java 17.

I removed/updated some outdated files that were apparently added in the
hope of someone implementing the payloads but I preferred to start fresh
with new updated payloads.

I did a few adjustments to some existing enums to make sure we don't
have an error when a payload arrives with an unknown value. I used the
same pattern we decided to implement some time ago.
@gsmet
Copy link
Contributor Author

gsmet commented Mar 17, 2024

CI is all green now.
Code coverage is impacted by corner cases that should never happen (I used the same pattern as we already did).

@gsmet
Copy link
Contributor Author

gsmet commented Mar 17, 2024

I prepared the integration in Quarkus GitHub App here: quarkiverse/quarkus-github-app#584 .

Comment on lines +12 to +20
private FromToPermission permission;

/**
* Get changes to permission.
*
* @return changes to permission
*/
public FromToPermission getPermission() {
return permission;
Copy link
Member

@bitwiseman bitwiseman Mar 18, 2024

Choose a reason for hiding this comment

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

@gsmet
Ugh. The events api is all over the place. The added action has a role_name and states that permission is obsolete. But the edited action has permission and old_permission, with no note about either of those being obsolete. And they both are returned under the changes parameter.

https://docs.github.com/en/webhooks/webhook-events-and-payloads?actionType=added#member
https://docs.github.com/en/webhooks/webhook-events-and-payloads?actionType=edited#member

I guess this class is okay. It is incomplete, but the other fields can be added later without causing a breaking change.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I did some tests for permission and old_permission wasn’t there.

I need to check for role_name though. I will have a look.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah so that's what I thought, role_name wasn't in the payload I obtained...

They might change it at some point, I don't know. I'll have a look at adding role_name for a future version but it's going to be untested.

@bitwiseman bitwiseman merged commit 183ee8c into hub4j:main Mar 18, 2024
10 of 11 checks passed
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.

2 participants