"...git@developer.sourcefind.cn:2222/OpenDAS/vllm_cscc.git" did not exist on "9909726d2a30d834d97efd7bf1c4fc0e52fa48b5"
Unverified Commit 4f436782 authored by Cyrus Leung's avatar Cyrus Leung Committed by GitHub
Browse files

[Misc] Improve new PR bot trigger condition (#40114)


Signed-off-by: default avatarDarkLight1337 <tlleungac@connect.ust.hk>
parent bf45e6d0
...@@ -62,14 +62,14 @@ jobs: ...@@ -62,14 +62,14 @@ jobs:
const prAuthor = context.payload.pull_request.user.login; const prAuthor = context.payload.pull_request.user.login;
const { data: searchResults } = await github.rest.search.issuesAndPullRequests({ const { data: searchResults } = await github.rest.search.issuesAndPullRequests({
q: `repo:${owner}/${repo} type:pr author:${prAuthor}`, q: `repo:${owner}/${repo} type:pr is:merged author:${prAuthor}`,
per_page: 1, per_page: 1,
}); });
const authorPRCount = searchResults.total_count; const mergedPRCount = searchResults.total_count;
console.log(`Found ${authorPRCount} PRs by ${prAuthor}`); console.log(`Found ${mergedPRCount} merged PRs by ${prAuthor}`);
if (authorPRCount === 1) { if (mergedPRCount === 0) {
console.log(`Posting welcome comment for first-time contributor: ${prAuthor}`); console.log(`Posting welcome comment for first-time contributor: ${prAuthor}`);
await github.rest.issues.createComment({ await github.rest.issues.createComment({
owner, owner,
...@@ -98,5 +98,5 @@ jobs: ...@@ -98,5 +98,5 @@ jobs:
].join('\n'), ].join('\n'),
}); });
} else { } else {
console.log(`Skipping comment for ${prAuthor} - not their first PR (${authorPRCount} PRs found)`); console.log(`Skipping comment for ${prAuthor} - not a first-time contributor (${mergedPRCount} merged PRs)`);
} }
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment