github-script icon indicating copy to clipboard operation
github-script copied to clipboard

Update Welcome a first-time contributor example

Open calkeo opened this issue 3 years ago • 1 comments
trafficstars

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 avatar Apr 14 '22 13:04 calkeo

Thanks @calkeo!

Were you able to test these changes in a workflow?

joshmgross avatar Apr 15 '22 18:04 joshmgross

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

There's still a pending question: https://github.com/actions/github-script/pull/257#issuecomment-1100273964

joshmgross avatar Apr 14 '23 21:04 joshmgross