github-script
github-script copied to clipboard
Update Welcome a first-time contributor example
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.
Thanks @calkeo!
Were you able to test these changes in a workflow?
👋 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