Skip to content

Commit 28ce20c

Browse files
authored
Merge pull request #4 from ReactSphere/copilot/fix-welcom-yml
Fix welcome.yml first-time contributor detection and expand auto-label patterns
2 parents 635b356 + 0402d8d commit 28ce20c

2 files changed

Lines changed: 29 additions & 3 deletions

File tree

.github/workflows/auto-label.yml

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ jobs:
1919
const issue = context.payload.issue || context.payload.pull_request;
2020
if (!issue) return;
2121
const title = typeof issue.title === "string" ? issue.title : "";
22+
const lowerTitle = title.toLowerCase();
2223
2324
const labelsToAdd = [];
2425
@@ -28,15 +29,40 @@ jobs:
2829
}
2930
3031
// Auto-label issues that include "question"
31-
if (title.toLowerCase().includes("question")) {
32+
if (lowerTitle.includes("question")) {
3233
labelsToAdd.push("question");
3334
}
3435
3536
// Auto-label issues that include "bug"
36-
if (title.toLowerCase().includes("bug")) {
37+
if (lowerTitle.includes("bug")) {
3738
labelsToAdd.push("bug");
3839
}
3940
41+
// Auto-label issues that include "enhancement" or "feature"
42+
if (lowerTitle.includes("enhancement") || lowerTitle.includes("feature")) {
43+
labelsToAdd.push("enhancement");
44+
}
45+
46+
// Auto-label issues that include "documentation" or "docs"
47+
if (lowerTitle.includes("documentation") || lowerTitle.includes("docs")) {
48+
labelsToAdd.push("documentation");
49+
}
50+
51+
// Auto-label issues that include "help"
52+
if (lowerTitle.includes("help")) {
53+
labelsToAdd.push("help wanted");
54+
}
55+
56+
// Auto-label issues that include "beginner" or "good first"
57+
if (lowerTitle.includes("beginner") || lowerTitle.includes("good first")) {
58+
labelsToAdd.push("good first issue");
59+
}
60+
61+
// Auto-label issues that include "feedback" or "suggest"
62+
if (lowerTitle.includes("feedback") || lowerTitle.includes("suggest")) {
63+
labelsToAdd.push("feedback");
64+
}
65+
4066
if (labelsToAdd.length > 0) {
4167
await github.rest.issues.addLabels({
4268
owner: context.repo.owner,

.github/workflows/welcome.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
const result = await github.rest.search.issuesAndPullRequests({
2727
q: `repo:${context.repo.owner}/${repo} author:${login}`
2828
});
29-
const isFirstTime = (result.data.total_count === 0);
29+
const isFirstTime = (result.data.total_count <= 1);
3030
3131
if (isFirstTime) {
3232
const welcomeMessage = `

0 commit comments

Comments
 (0)