Skip to content

Commit db94586

Browse files
authored
fix(ci): update merge comment and workflow configuration (#504)
Signed-off-by: Harshit <harsxit04@gmail.com>
1 parent 8e4066e commit db94586

3 files changed

Lines changed: 42 additions & 31 deletions

File tree

.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/workflows/ci.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ jobs:
2020
webFiles: ${{ steps.detect.outputs.webFiles }}
2121
backendTestFiles: ${{ steps.detect.outputs.backendTestFiles }}
2222
mobileTestFiles: ${{ steps.detect.outputs.mobileTestFiles }}
23+
dbFiles: ${{ steps.detect.outputs.dbFiles }}
2324

2425
steps:
2526
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
@@ -55,12 +56,14 @@ jobs:
5556
with:
5657
node-version: 22
5758

58-
- name: Install shared dependencies
59-
run: npm --prefix packages/shared install
60-
6159
- name: Install backend dependencies
6260
run: npm --prefix apps/backend install
6361

62+
- name: DB migration check
63+
if: needs.detect-changes.outputs.dbFiles != ''
64+
continue-on-error: true
65+
run: npm run db:migrate
66+
6467
- name: Backend lint
6568
id: backend_lint
6669
continue-on-error: true

0 commit comments

Comments
 (0)