From 7d350c9faa451e02b44a7c1938ec4e816e5713bd Mon Sep 17 00:00:00 2001 From: Callum Keogan <48253321+calkeo@users.noreply.github.com> Date: Thu, 14 Apr 2022 14:00:40 +0100 Subject: [PATCH] Update Welcome a first-time contributor example --- README.md | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 6a1873907..6379a0cee 100644 --- a/README.md +++ b/README.md @@ -166,16 +166,18 @@ jobs: creator, state: 'all' }) - const issues = await github.paginate(opts) - - for (const issue of issues) { - if (issue.number === context.issue.number) { - continue + + const issues = await github.paginate(opts, (response, done) => { + const pr = response.data.find((issue) => issue.number !== context.issue.number && issue.pull_request) + + if (pr) { + done() // Stop paginating + return pr } + }) - if (issue.pull_request) { - return // Creator is already a contributor. - } + if (issues.length) { + return } await github.rest.issues.createComment({