Skip to content

Commit 5a082eb

Browse files
Fix first time issue creator workflow trigger (#425)
1 parent 6bb38e6 commit 5a082eb

1 file changed

Lines changed: 18 additions & 5 deletions

File tree

.github/scripts/welcomeScript.js

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,21 +11,34 @@ module.exports = async ({ github, context }) => {
1111

1212
if (
1313
eventName === 'issues' &&
14-
issueAssociation === 'FIRST_TIMER'
14+
issueAssociation === 'NONE'
1515
) {
16-
return await github.rest.issues.createComment({
16+
// Verify this is truly their first issue (listForRepo returns PRs too)
17+
const userIssues = await github.rest.issues.listForRepo({
1718
owner,
1819
repo,
19-
issue_number: issueNumber,
20-
body: `👋 Thanks for opening your first issue, @${ghUsername}!
20+
state: 'all',
21+
creator: ghUsername,
22+
per_page: 10
23+
});
24+
25+
const actualIssues = userIssues.data.filter(issue => !issue.pull_request);
26+
27+
if (actualIssues.length === 1) {
28+
return await github.rest.issues.createComment({
29+
owner,
30+
repo,
31+
issue_number: issueNumber,
32+
body: `👋 Thanks for opening your first issue, @${ghUsername}!
2133
2234
We appreciate your contribution and are excited to have you here. Please make sure to follow the contribution guidelines and provide as much detail as possible.
2335
2436
To stay updated, ask questions, and connect with maintainers and contributors, please join our Discord community:
2537
https://discord.gg/QueQN83wn
2638
2739
Looking forward to collaborating with you!`
28-
});
40+
});
41+
}
2942
}
3043

3144
const prAssociation =

0 commit comments

Comments
 (0)