Skip to content

Update Welcome a first-time contributor example#257

Closed
calkeo wants to merge 1 commit into
actions:mainfrom
calkeo:main
Closed

Update Welcome a first-time contributor example#257
calkeo wants to merge 1 commit into
actions:mainfrom
calkeo:main

Conversation

@calkeo
Copy link
Copy Markdown

@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
Copy Markdown
Contributor

Thanks @calkeo!

Were you able to test these changes in a workflow?

Comment thread README.md
return // Creator is already a contributor.
}
if (issues.length) {
return
Copy link
Copy Markdown
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
Copy Markdown

@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
Copy Markdown
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
Copy Markdown
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