Skip to content

Commit b742d14

Browse files
authored
Merge branch 'main' into communit-page-change
2 parents e5fb599 + f9010b7 commit b742d14

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+5376
-1167
lines changed

.github/CODEOWNERS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
# Assign @octocat as the owner for all files
2-
* @sanjay-kv @iitzIrFan
2+
* @sanjay-kv @iitzIrFan @Adez017

.github/workflows/autolabler.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Auto Label Issues and PRs
2+
3+
on:
4+
pull_request_target:
5+
types: [opened]
6+
issues:
7+
types: [opened]
8+
9+
permissions:
10+
issues: write
11+
pull-requests: write
12+
13+
jobs:
14+
add-labels:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: Add labels to PR
18+
if: github.event_name == 'pull_request_target'
19+
uses: actions/github-script@v7
20+
with:
21+
script: |
22+
const prNumber = context.payload.pull_request.number;
23+
24+
await github.rest.issues.addLabels({
25+
...context.repo,
26+
issue_number: prNumber,
27+
labels: ["recode", "level 1"]
28+
});
29+
30+
console.log(`Added labels [recode, level 1] to PR #${prNumber}`);
31+
32+
- name: Add labels to Issue
33+
if: github.event_name == 'issues'
34+
uses: actions/github-script@v7
35+
with:
36+
script: |
37+
const issueNumber = context.payload.issue.number;
38+
39+
await github.rest.issues.addLabels({
40+
...context.repo,
41+
issue_number: issueNumber,
42+
labels: ["recode", "level 1"]
43+
});
44+
45+
console.log(`Added labels [recode, level 1] to Issue #${issueNumber}`);
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
name: Sync PR data from Linked Issues
2+
3+
on:
4+
pull_request_target:
5+
types: [opened, edited, synchronize]
6+
7+
jobs:
8+
sync-metadata:
9+
runs-on: ubuntu-latest
10+
11+
permissions:
12+
issues: write
13+
pull-requests: write
14+
15+
steps:
16+
- name: Extract Linked Issues
17+
id: extract
18+
uses: actions/github-script@v7
19+
with:
20+
github-token: ${{ secrets.GITHUB_TOKEN }}
21+
script: |
22+
const body = context.payload.pull_request.body || "";
23+
const issuePattern = /#(\d+)/g;
24+
let matches = [];
25+
let m;
26+
while ((m = issuePattern.exec(body)) !== null) {
27+
matches.push(parseInt(m[1]));
28+
}
29+
core.setOutput("issues", JSON.stringify(matches));
30+
31+
- name: Post or Update data Comment
32+
if: steps.extract.outputs.issues && steps.extract.outputs.issues != '[]'
33+
uses: actions/github-script@v7
34+
with:
35+
github-token: ${{ secrets.GITHUB_TOKEN }}
36+
script: |
37+
const issues = JSON.parse(`${{ steps.extract.outputs.issues }}`);
38+
const prNumber = context.payload.pull_request.number;
39+
40+
let combinedLabels = [];
41+
let combinedAssignees = [];
42+
let combinedMilestones = [];
43+
44+
for (const number of issues) {
45+
try {
46+
const issue = await github.rest.issues.get({
47+
...context.repo,
48+
issue_number: number
49+
});
50+
51+
combinedLabels.push(...issue.data.labels.map(l => l.name));
52+
combinedAssignees.push(...issue.data.assignees.map(a => a.login));
53+
if (issue.data.milestone) combinedMilestones.push(issue.data.milestone.title);
54+
55+
} catch (err) {
56+
console.log(`Could not fetch issue #${number}: ${err.message}`);
57+
}
58+
}
59+
60+
// Deduplicate
61+
combinedLabels = [...new Set(combinedLabels)];
62+
combinedAssignees = [...new Set(combinedAssignees)];
63+
combinedMilestones = [...new Set(combinedMilestones)];
64+
65+
const commentBody =
66+
`### Synced data from Linked Issues\n\n` +
67+
`**Labels:**\n${combinedLabels.length ? combinedLabels.map(l => `- ${l}`).join("\n") : "- None"}\n\n` +
68+
`**Assignees:**\n${combinedAssignees.length ? combinedAssignees.map(a => `- ${a}`).join("\n") : "- None"}\n\n` +
69+
`**Milestones:**\n${combinedMilestones.length ? combinedMilestones.map(m => `- ${m}`).join("\n") : "- None"}\n`;
70+
71+
// Get existing comments
72+
const comments = await github.rest.issues.listComments({
73+
...context.repo,
74+
issue_number: prNumber
75+
});
76+
77+
// Find existing workflow comment
78+
const existingComment = comments.data.find(c => c.body.includes("### Synced data from Linked Issues"));
79+
80+
if (existingComment) {
81+
await github.rest.issues.updateComment({
82+
...context.repo,
83+
comment_id: existingComment.id,
84+
body: commentBody
85+
});
86+
} else {
87+
// Create new comment
88+
await github.rest.issues.createComment({
89+
...context.repo,
90+
issue_number: prNumber,
91+
body: commentBody
92+
});
93+
}

Dockerfile

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,14 @@
1-
FROM node:18-alpine AS builder
1+
FROM node:20-alpine
22

3-
# Set working directory inside the container
43
WORKDIR /app
54

65
COPY package*.json ./
76

8-
# Install dependencies with legacy peer deps fix
97
RUN npm install --legacy-peer-deps
108

119
COPY . .
12-
RUN npm run build
1310

14-
# Production Image
15-
FROM node:18-alpine
16-
WORKDIR /app
17-
COPY --from=builder /app /app
11+
# No need to run 'npm run build' for development-mode Docker
1812
EXPOSE 3000
1913

20-
CMD ["npm", "run","serve"]
14+
CMD [ "npm", "run", "dev" ]

0 commit comments

Comments
 (0)