-
Notifications
You must be signed in to change notification settings - Fork 329
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
copilot: add missing pagination to fetchOrganizationTeams #3170
Conversation
Changed Packages
|
Signed-off-by: Christian Herweg <[email protected]>
Thanks for the contribution! |
872871d
to
a04492e
Compare
Hi @christianherweg0807, if this is a POC then can you move this to be a Draft? That would have avoided reviewers being added. Is there something specific you need which has caused you to open the PR in this state instead of a reviewable contribution? How can the community help? |
A suggestion would be to use octokit that have built-in support for pagination. I am actually planning of doing that myself going forward with more rewrites to include more detailed statistics. But that might take a month or two. |
@henrikedegrd Would be very interesting to have more detailed statistics. If there is a plugin or project to contribute ... maybe I could add some lines of code. |
I don´t know how to resolve the "Missing Changesets" thing. Any help would be nice. |
https://github.com/backstage/community-plugins/blob/main/CONTRIBUTING.md#creating-changesets Essentially running yarn changeset in the plugin-folder and writing some information. |
From my part, I would suggest replace all console.warn,error with correct calls to the logger. And probably remove all calls to debug. |
Signed-off-by: Christian Herweg <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @christianherweg0807, thanks for taking this on!
In addition to the changes mentioned by @henrikedegrd (adding a changeset and using the LoggerService instead of console.log statements — there are a lot of plugins in this repo using it, let me know if you need examples), you'll also need to resolve the type errors causing the CI to fail.
Signed-off-by: Christian Herweg <[email protected]>
Signed-off-by: Christian Herweg <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Made some suggestions in order to simplify and provide the logger as mandatory.
) {} | ||
logger?: LoggerService, | ||
) { | ||
this.logger = logger || { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would be better to make the logger mandatory to provide.
You can provide it as a dependency here: https://github.com/backstage/community-plugins/blob/main/workspaces/copilot/plugins/copilot-backend/src/service/router.ts#L126
And it is availible here to grab: https://github.com/backstage/community-plugins/blob/main/workspaces/copilot/plugins/copilot-backend/src/service/router.ts#L122
@@ -111,4 +153,26 @@ export class GithubClient implements GithubApi { | |||
|
|||
return response.json() as Promise<T>; | |||
} | |||
|
|||
// Add this new private method to handle raw responses | |||
private async getRaw(path: string): Promise<NodeFetchResponse> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can possibly be simplified in order to reduce duplicated code.
Maybe the get() can use getRaw() since the only thing that differs is the return.
@henrikedegrd Thanks for the initial review! Once you've approved this PR, I'll proceed with my review. FYI @christianherweg0807, this is the process we'll follow for reviewing and merging this PR. |
Sounds good to me! @christianherweg0807, does that work for you? |
Closing in favour of #3241 |
Hey, I just made a Pull Request!
This PR adds pagination to the CoPilot backend plugin.
resolves #2087
✔️ Checklist
Signed-off-by
line in the message. (more info)