mirror of
https://git.datalinker.icu/vllm-project/vllm.git
synced 2025-12-15 19:06:17 +08:00
[CI] improve pr comments bot (#23380)
This commit is contained in:
parent
8b5fe6eb51
commit
c5041f899f
16
.github/workflows/reminder_comment.yml
vendored
16
.github/workflows/reminder_comment.yml
vendored
@ -17,20 +17,18 @@ jobs:
|
|||||||
const prAuthor = context.payload.pull_request.user.login;
|
const prAuthor = context.payload.pull_request.user.login;
|
||||||
|
|
||||||
// Check if this is the author's first PR in this repository
|
// Check if this is the author's first PR in this repository
|
||||||
const { data: allPRs } = await github.rest.pulls.list({
|
// Use GitHub's search API to find all PRs by this author
|
||||||
owner: context.repo.owner,
|
const { data: searchResults } = await github.rest.search.issuesAndPullRequests({
|
||||||
repo: context.repo.repo,
|
q: `repo:${context.repo.owner}/${context.repo.repo} type:pr author:${prAuthor}`,
|
||||||
state: 'all',
|
|
||||||
per_page: 100
|
per_page: 100
|
||||||
});
|
});
|
||||||
|
|
||||||
// Filter to find PRs by this author
|
const authorPRCount = searchResults.total_count;
|
||||||
const authorPRs = allPRs.filter(pr => pr.user.login === prAuthor);
|
|
||||||
|
|
||||||
console.log(`Found ${authorPRs.length} PRs by ${prAuthor}`);
|
console.log(`Found ${authorPRCount} PRs by ${prAuthor}`);
|
||||||
|
|
||||||
// Only post comment if this is the first PR (only one PR by this author)
|
// Only post comment if this is the first PR (only one PR by this author)
|
||||||
if (authorPRs.length === 1) {
|
if (authorPRCount === 1) {
|
||||||
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: context.repo.owner,
|
owner: context.repo.owner,
|
||||||
@ -46,7 +44,7 @@ jobs:
|
|||||||
'🚀'
|
'🚀'
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
console.log(`Skipping comment for ${prAuthor} - not their first PR (${authorPRs.length} PRs found)`);
|
console.log(`Skipping comment for ${prAuthor} - not their first PR (${authorPRCount} PRs found)`);
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Error checking PR history or posting comment:', error);
|
console.error('Error checking PR history or posting comment:', error);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user