Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Update Welcome a first-time contributor example #257

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

Closed
wants to merge 1 commit into from

Conversation

calkeo
Copy link

@calkeo calkeo commented Apr 14, 2022

This PR improves the pagination logic for the "Welcome a first-time contributor" example in the README.

The current example retrieves all issues created by the given user. This means that if there's a PR that passes issue.number !== context.issue.number && issue.pull_request on the first page of results, the logic will still retrieve data for all remaining pages. This can add quite a lot of overhead on repositories where the given user has authored many issues.

This PR stops the pagination early by calling the done() method if a match is found.

I appreciate that the current example may be deliberate for the purpose of keeping the example simple and easily-readable, but I thought I'd open this up just in case.

@calkeo calkeo requested a review from a team April 14, 2022 13:09
@joshmgross
Copy link
Contributor

Thanks @calkeo!

Were you able to test these changes in a workflow?

return // Creator is already a contributor.
}
if (issues.length) {
return
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we keep the comment here?

Suggested change
return
return // Creator is already a contributor.

Copy link

@ArjunSharda ArjunSharda Jul 4, 2022

Choose a reason for hiding this comment

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

Honestly, yes.

Copy link
Contributor

Choose a reason for hiding this comment

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

Perhaps this format is better.

Suggested change
return
// Creator is already a contributor.
return

@joshmgross
Copy link
Contributor

👋 Going to close this out, feel free to reopen if you'd like to pick this back up.

There's still a pending question: #257 (comment)

@joshmgross joshmgross closed this Apr 14, 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.

4 participants