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

Adds methods to GHRepository to get the top ten referral paths and referrers via the API #1770

Merged
merged 29 commits into from
Jul 1, 2024

Conversation

ihrigb
Copy link
Contributor

@ihrigb ihrigb commented Dec 14, 2023

Description

Adds methods to GHRepository to get the top ten referral paths and referrers via the API.

References:

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".

@ihrigb ihrigb changed the title Dev referrer Adds methods to GHRepository to get the top ten referral paths and referrers via the API Dec 14, 2023
@ihrigb
Copy link
Contributor Author

ihrigb commented Dec 14, 2023

Maybe someone could help with tests here. I get No response could be served as there are no stub mappings in this WireMock instance..

Plus running mvn -D enable-ci clean install site does fail for me, even on the current main branch without my changes.

@bitwiseman
Copy link
Member

What failure are you getting on main?

@ihrigb
Copy link
Contributor Author

ihrigb commented Jan 8, 2024

[INFO] Results:
[INFO]
[ERROR] Errors: 
[ERROR]   AppTest.notifications:1706 » GHIO Failed to set the custom verb
[ERROR]   AppTest.testCreateCommitComment:914 » GHIO Failed to set the custom verb
[ERROR]   AppTest.testCreateIssue:274 » GHIO Failed to set the custom verb
[ERROR]   AppTest.testPullRequestSearch:1451 » GHIO Failed to set the custom verb
[ERROR]   AppTest.testRepoCRUD:59 » GHIO Failed to set the custom verb
[ERROR]   AppTest.testRepoLabel:1582 » GHIO Failed to set the custom verb
[ERROR]   GHCheckRunBuilderTest.createCheckRunManyAnnotations:104 » GHIO Failed to set the custom verb
[ERROR]   GHCheckRunBuilderTest.updateCheckRun:192 » GHIO Failed to set the custom verb
[ERROR]   GHDiscussionTest.testGetAndEditDiscussion:119 » GHIO Failed to set the custom verb
[ERROR]   GHGistTest.lifecycleTest:54 » GHIO Failed to set the custom verb
[ERROR]   GHGistUpdaterTest.testGitUpdater:70 » GHIO Failed to set the custom verb
[ERROR]   GHIssueEventTest.testEventsForIssueRename:97 » GHIO Failed to set the custom verb
[ERROR]   GHIssueEventTest.testEventsForSingleIssue:33 » GHIO Failed to set the custom verb
[ERROR]   GHIssueEventTest.testIssueReviewRequestedEvent:80 » GHIO Failed to set the custom verb
[ERROR]   GHIssueTest.closeIssue:160 » GHIO Failed to set the custom verb
[ERROR]   GHIssueTest.removeLabels:260 » GHIO Failed to set the custom verb
[ERROR]   GHIssueTest.setAssignee:298 » GHIO Failed to set the custom verb
[ERROR]   GHIssueTest.setLabels:175 » GHIO Failed to set the custom verb
[ERROR]   GHMilestoneTest.testUnsetMilestone:91 » GHIO Failed to set the custom verb
[ERROR]   GHMilestoneTest.testUnsetMilestoneFromPullRequest:115 » GHIO Failed to set the custom verb
[ERROR]   GHMilestoneTest.testUpdateMilestone:59 » GHIO Failed to set the custom verb
[ERROR]   GHOrganizationTest.testEnableOrganizationProjects:495 » GHIO Failed to set the custom verb
[ERROR]   GHProjectCardTest.testArchiveCard:69 » GHIO Failed to set the custom verb
[ERROR]   GHProjectCardTest.testEditCardNote:55 » GHIO Failed to set the custom verb
[ERROR]   GHProjectColumnTest.testEditColumnName:51 » GHIO Failed to set the custom verb
[ERROR]   GHProjectTest.testEditProjectBody:71 » GHIO Failed to set the custom verb
[ERROR]   GHProjectTest.testEditProjectName:56 » GHIO Failed to set the custom verb
[ERROR]   GHProjectTest.testEditProjectState:86 » GHIO Failed to set the custom verb
[ERROR]   GHReleaseTest.testMakeLatestRelease:191 » GHIO Failed to set the custom verb
[ERROR]   GHReleaseTest.testUpdateRelease:130 » GHIO Failed to set the custom verb
[ERROR]   GHRepositoryTest.archive:124 » GHIO Failed to set the custom verb
[ERROR]   GHRepositoryTest.setDeleteBranchOnMerge:995 » GHIO Failed to set the custom verb
[ERROR]   GHRepositoryTest.setMergeOptions:951 » GHIO Failed to set the custom verb
[ERROR]   GHRepositoryTest.testGetRepositoryWithVisibility:432 » GHIO Failed to set the custom verb
[ERROR]   GHRepositoryTest.testSearchPullRequests:1745 » GHIO Failed to set the custom verb
[ERROR]   GHRepositoryTest.testSetPublic:303 » GHIO Failed to set the custom verb
[ERROR]   GHRepositoryTest.testUpdateRepoActionVariable:1676 » GHIO Failed to set the custom verb
[ERROR]   GHRepositoryTest.testUpdateRepository:390 » GHIO Failed to set the custom verb
[ERROR]   GHTeamTest.testSetDescription:39 » GHIO Failed to set the custom verb
[ERROR]   GHTeamTest.testSetPrivacy:147 » GHIO Failed to set the custom verb
[ERROR]   GHTreeBuilderTest.testAdd:125->updateTree:187 » GHIO Failed to set the custom verb
[ERROR]   GHTreeBuilderTest.testDelete:149->updateTree:187 » GHIO Failed to set the custom verb
[ERROR]   GHTreeBuilderTest.testShaEntry:106->updateTree:187 » GHIO Failed to set the custom verb
[INFO]
[ERROR] Tests run: 458, Failures: 0, Errors: 43, Skipped: 25
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  01:56 min
[INFO] Finished at: 2024-01-08T12:40:18+01:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:3.2.3:test (default-test) on project github-api:
[ERROR]
[ERROR] Please refer to C:\SAPDevelop\opensource\github-api\target\surefire-reports for the individual test results.
[ERROR] Please refer to dump files (if any exist) [date].dump, [date]-jvmRun[N].dump and [date].dumpstream.
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException

@ihrigb
Copy link
Contributor Author

ihrigb commented Feb 6, 2024

@bitwiseman ?

@ihrigb
Copy link
Contributor Author

ihrigb commented Mar 4, 2024

@bitwiseman ping again

@bitwiseman
Copy link
Member

@ihrigb
To make the tests run locally, run this:

mvn -B clean install -D enable-ci "-Dsurefire.argLine=--add-opens java.base/java.net=ALL-UNNAMED"

I understand this differs from what is in CONTRIBUTING.md. I'm working on updating the build and the instructions to remove the need for that extra argument.

@ihrigb
Copy link
Contributor Author

ihrigb commented Mar 8, 2024

In that case, the build is fine.

@bitwiseman bitwiseman added the work-abandoned There hasn't been any activity on the PR in a while. Another contributor might want to pick it up. label Jun 20, 2024
@bitwiseman
Copy link
Member

@ihrigb
It looks like there are still some CI failures. Please update this PR.

@ihrigb
Copy link
Contributor Author

ihrigb commented Jun 21, 2024

@bitwiseman should be good now...

@bitwiseman bitwiseman removed the work-abandoned There hasn't been any activity on the PR in a while. Another contributor might want to pick it up. label Jun 22, 2024
Copy link

codecov bot commented Jun 23, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 80.87%. Comparing base (e8c6beb) to head (a6decf5).

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #1770      +/-   ##
============================================
+ Coverage     80.79%   80.87%   +0.07%     
- Complexity     2417     2430      +13     
============================================
  Files           233      236       +3     
  Lines          7264     7294      +30     
  Branches        398      398              
============================================
+ Hits           5869     5899      +30     
  Misses         1148     1148              
  Partials        247      247              

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

@bitwiseman
Copy link
Member

@ihrigb
Sorry, code coverage reporting was broken for a bit. Now it is working, please address items in the report.

@ihrigb
Copy link
Contributor Author

ihrigb commented Jul 1, 2024

@bitwiseman can you please grant me access to hub4j-test-org?

@ihrigb
Copy link
Contributor Author

ihrigb commented Jul 1, 2024

@bitwiseman finally ready to merge.

@bitwiseman bitwiseman merged commit 3e478c2 into hub4j:main Jul 1, 2024
12 checks passed
@bitwiseman
Copy link
Member

You got reasonable tests without needing test-org access. Thanks for sticking with this!

@ihrigb ihrigb deleted the dev-referrer branch July 1, 2024 18:32
@ihrigb
Copy link
Contributor Author

ihrigb commented Jul 1, 2024

You got reasonable tests without needing test-org access. Thanks for sticking with this!

Is that preferrable over using the test org?

@bitwiseman
Copy link
Member

No, test org is generally better for future test support, but wanted to get your change into this release.

@ihrigb
Copy link
Contributor Author

ihrigb commented Jul 3, 2024

@bitwiseman I did get the invitation mail for the test org, but seems like the invitation itself does no longer exist.

@bitwiseman
Copy link
Member

@ihrigb
Resent invitation, so you have it for what ever your next PR is.

@ihrigb
Copy link
Contributor Author

ihrigb commented Jul 3, 2024

Rulesets (#1181) ;)
Thanks!

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