Skip to content

Commit 8ab3735

Browse files
Merge remote-tracking branch 'upstream/main' into feat/smooth-theme-transition
2 parents 45000da + 4bd72ef commit 8ab3735

20 files changed

Lines changed: 1555 additions & 153 deletions

.github/scripts/ciScript.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ const deriveTestFiles = (files) => {
1313
});
1414
};
1515

16+
1617
module.exports = async ({ github, context, core }) => {
1718
const owner = context.repo.owner;
1819
const repo = context.repo.repo;
@@ -23,6 +24,7 @@ module.exports = async ({ github, context, core }) => {
2324
const backendFiles = [];
2425
const mobileFiles = [];
2526
const webFiles = [];
27+
const dbFiles = [];
2628

2729
try {
2830
if (prState === 'closed') {
@@ -52,16 +54,21 @@ module.exports = async ({ github, context, core }) => {
5254
mobileFiles.push(fileName);
5355
} else if (fileName.startsWith('apps/web/')) {
5456
webFiles.push(fileName);
57+
}else if(fileName.startsWith('apps/backend/prisma')){
58+
dbFiles.push(fileName)
59+
}else if(fileName.includes('schema.prisma') || fileName.includes('/migrations/')){
60+
dbFiles.push(fileName)
5561
}
5662
});
5763

5864
const strippedBackend = backendFiles.map(f => f.replace('apps/backend/', ''));
5965
const strippedMobile = mobileFiles.map(f => f.replace('apps/mobile/', ''));
6066

61-
console.log({ backendFiles, mobileFiles, webFiles });
67+
console.log({ backendFiles, mobileFiles, webFiles, dbFiles });
6268

6369
core.setOutput('backendFiles', strippedBackend.join(' '));
6470
core.setOutput('mobileFiles', strippedMobile.join(' '));
71+
core.setOutput('dbFiles', dbFiles.join(' '));
6572
core.setOutput('webFiles', webFiles.map(f => f.replace('apps/web/', '')).join(' '));
6673
core.setOutput('backendTestFiles', deriveTestFiles(strippedBackend).join(' '));
6774
core.setOutput('mobileTestFiles', deriveTestFiles(strippedMobile).join(' '));

.github/scripts/discordPinReminder.js

Lines changed: 28 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -3,35 +3,36 @@ module.exports = async ({ github, context }) => {
33
const ignoreUsers = [
44
'ShantKhatri',
55
'Harxhit',
6-
'blankirigaya'
7-
]
6+
'blankirigaya',
7+
];
8+
89
try {
9-
// Only continue if merged
10-
if (!pr || !pr.merged) {
11-
console.log('PR not merged.');
12-
return;
13-
}
14-
15-
const prNumber = pr.number;
16-
const contributor = pr.user.login;
10+
if (!pr || !pr.merged) {
11+
console.log('PR not merged.');
12+
return;
13+
}
14+
15+
const prNumber = pr.number;
16+
const contributor = pr.user.login;
17+
18+
if (ignoreUsers.includes(contributor)) {
19+
console.log(`Ignoring PR #${prNumber} by ${contributor}`);
20+
return;
21+
}
22+
23+
await github.rest.issues.createComment({
24+
owner: context.repo.owner,
25+
repo: context.repo.repo,
26+
issue_number: prNumber,
27+
body: `Congratulations @${contributor} on getting PR #${prNumber} merged!
28+
29+
Thank you for your contribution to the project.
1730
18-
if(ignoreUsers.includes(contributor)){
19-
console.log(`Ignoring PR #${prNumber} by ${contributor}`);
20-
return;
21-
}
22-
23-
await github.rest.issues.createComment({
24-
owner: context.repo.owner,
25-
repo: context.repo.repo,
26-
issue_number: prNumber,
27-
body: `Congratulations @${contributor} on getting PR #${prNumber} merged!
31+
To receive the appropriate GSSoC labels and recognition, please mention @Harxhit in the **#get-labels** channel on our Discord server and share your merged PR link.`,
32+
});
2833

29-
Thank you for your contribution. Please mention @Harxhit in our Discord server to receive the appropriate GSSoC labels and recognition.
30-
`
31-
});
32-
33-
console.log(`Comment added to PR #${prNumber}`);
34+
console.log(`Comment added to PR #${prNumber}`);
3435
} catch (error) {
35-
console.error(error)
36+
console.error(error);
3637
}
37-
};
38+
};

.github/scripts/triageIssue.js

Lines changed: 151 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,151 @@
1+
module.exports = async({github, context}) => {
2+
const owner = context.repo.owner;
3+
const repo = context.repo.repo;
4+
const issue = context.payload.issue;
5+
const issueNumber = issue.number;
6+
const issueDescription = issue.body;
7+
const username = issue.user.login
8+
9+
if(context.eventName === 'issues'){
10+
try {
11+
if(!issueDescription || !issueDescription.trim()){
12+
return await github.rest.issues.createComment({
13+
owner,
14+
repo,
15+
issue_number: issueNumber,
16+
body: `Hi @${username},
17+
18+
Thanks for opening this issue.
19+
20+
It looks like the issue description is currently missing.
21+
22+
Please provide:
23+
- A brief summary of the problem
24+
- Expected behavior
25+
- Actual behavior (if applicable)
26+
- Any relevant screenshots, logs, or context
27+
28+
This helps the team understand, prioritize, and route the issue correctly.
29+
30+
Thank you!
31+
32+
`
33+
})
34+
}
35+
36+
return await github.rest.issues.createComment({
37+
owner,
38+
repo,
39+
issue_number: issueNumber,
40+
body: `Hi @${username},
41+
42+
Thanks for opening this issue.
43+
44+
Please reply with one of the following areas so the issue can be routed to the appropriate team member:
45+
46+
- /backend
47+
- /web
48+
- /mobile
49+
- /devops
50+
51+
Once an area is selected, the corresponding label will be added automatically.`
52+
})
53+
54+
} catch (error) {
55+
console.error(error)
56+
}
57+
}else if(context.eventName === 'issue_comment'){
58+
if (context.payload.comment.user.type === 'Bot' || context.payload.comment.user.login === 'github-actions[bot]') {
59+
return;
60+
}
61+
62+
const comment = (context.payload.comment.body || '').trim().toLowerCase();
63+
const existingLabels = (issue.labels || []).map(label => label.name);
64+
65+
if (
66+
existingLabels.includes('backend') ||
67+
existingLabels.includes('web') ||
68+
existingLabels.includes('mobile') ||
69+
existingLabels.includes('devops')
70+
) {
71+
return;
72+
}
73+
74+
if (!['/backend', '/web', '/mobile', '/devops'].includes(comment)) {
75+
return;
76+
}
77+
if(comment === '/backend'){
78+
await github.rest.issues.addLabels({
79+
owner,
80+
repo,
81+
issue_number: issueNumber,
82+
labels: ['backend']
83+
84+
})
85+
return await github.rest.issues.createComment({
86+
owner,
87+
repo,
88+
issue_number: issueNumber,
89+
body: `The issue has been classified as **backend**.
90+
91+
@Harxhit, please review and triage this issue when available.
92+
93+
The **backend** label has been applied and the issue has been routed accordingly.`
94+
})
95+
}else if(comment === '/web'){
96+
await github.rest.issues.addLabels({
97+
owner,
98+
repo,
99+
issue_number: issueNumber,
100+
labels: ['web']
101+
102+
})
103+
return await github.rest.issues.createComment({
104+
owner,
105+
repo,
106+
issue_number: issueNumber,
107+
body: `The issue has been classified as **web**.
108+
109+
@ShantKhatri, please review and triage this issue when available.
110+
111+
The **web** label has been applied and the issue has been routed accordingly.`
112+
})
113+
}else if(comment === '/mobile'){
114+
await github.rest.issues.addLabels({
115+
owner,
116+
repo,
117+
issue_number: issueNumber,
118+
labels: ['mobile']
119+
120+
})
121+
return await github.rest.issues.createComment({
122+
owner,
123+
repo,
124+
issue_number: issueNumber,
125+
body: `The issue has been classified as **mobile**.
126+
127+
@blankirigaya, please review and triage this issue when available.
128+
129+
The **mobile** label has been applied and the issue has been routed accordingly.`
130+
})
131+
}else if(comment === '/devops'){
132+
await github.rest.issues.addLabels({
133+
owner,
134+
repo,
135+
issue_number: issueNumber,
136+
labels: ['devops']
137+
138+
})
139+
return await github.rest.issues.createComment({
140+
owner,
141+
repo,
142+
issue_number: issueNumber,
143+
body: `The issue has been classified as **devops**.
144+
145+
@ShantKhatri, please review and triage this issue when available.
146+
147+
The **devops** label has been applied and the issue has been routed accordingly.`
148+
})
149+
}
150+
}
151+
}

.github/scripts/triagePr.js

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
module.exports = async ({github, context}) => {
2+
const owner = context.repo.owner;
3+
const repo = context.repo.repo;
4+
const pr = context.payload.pull_request;
5+
const prNumber = pr.number;
6+
const username = pr.user.login;
7+
8+
const backendFiles = [];
9+
const webFiles = [];
10+
const mobileFiles = [];
11+
const devopsFiles = [];
12+
13+
const labels = [];
14+
let primaryArea = null;
15+
let reviewer = null;
16+
17+
try {
18+
const changedFiles = await github.paginate(
19+
github.rest.pulls.listFiles,
20+
{
21+
owner,
22+
repo,
23+
pull_number: prNumber
24+
}
25+
);
26+
27+
changedFiles.forEach((file) => {
28+
const fileName = file.filename;
29+
30+
if(fileName.startsWith('apps/backend/')){
31+
backendFiles.push(fileName);
32+
}else if(fileName.startsWith('apps/web/')){
33+
webFiles.push(fileName);
34+
}else if(fileName.startsWith('apps/mobile/')){
35+
mobileFiles.push(fileName)
36+
}else if(fileName.startsWith('.github/') || fileName.startsWith('infra/') || fileName.startsWith('terraform/')){
37+
devopsFiles.push(fileName)
38+
}
39+
})
40+
41+
42+
if(backendFiles.length > 0){
43+
labels.push('backend')
44+
45+
if(!primaryArea){
46+
primaryArea = 'backend';
47+
reviewer = '@Harxhit'
48+
}
49+
}
50+
if(mobileFiles.length > 0){
51+
labels.push('mobile');
52+
if(!primaryArea){
53+
primaryArea = 'mobile';
54+
reviewer = '@blankirigaya'
55+
}
56+
}
57+
if(webFiles.length > 0){
58+
labels.push('web');
59+
if(!primaryArea){
60+
primaryArea = 'web';
61+
reviewer = '@ShantKhatri'
62+
}
63+
}
64+
if(devopsFiles.length > 0){
65+
labels.push('devops')
66+
if(!primaryArea){
67+
primaryArea = 'devops'
68+
reviewer = '@ShantKhatri'
69+
}
70+
}
71+
72+
if(labels.length === 0){
73+
return;
74+
}
75+
76+
await github.rest.issues.addLabels({
77+
owner,
78+
repo,
79+
issue_number: prNumber,
80+
labels
81+
});
82+
const body = `Hi @${username},
83+
84+
Thanks for opening this pull request.
85+
86+
This PR has been automatically classified based on the files modified.
87+
88+
### Applied Labels
89+
90+
${labels.map(label => `- ${label}`).join('\n')}
91+
92+
### Primary Review Area
93+
94+
* ${primaryArea}
95+
96+
### Reviewer
97+
98+
${reviewer} has been identified as the primary reviewer for this pull request.
99+
100+
If you have any questions regarding the affected area or implementation details, feel free to reach out to the assigned reviewer.
101+
102+
Thank you for your contribution! `;
103+
104+
105+
await github.rest.issues.createComment({
106+
owner,
107+
repo,
108+
issue_number: prNumber,
109+
body: body
110+
});
111+
112+
} catch (error) {
113+
console.error(error)
114+
}
115+
116+
}

0 commit comments

Comments
 (0)