Skip to content

Commit 4d0842f

Browse files
committed
Merge remote-tracking branch 'origin/main' into worktree-pr-969-pin-thread
# Conflicts: # apps/web/src/components/Sidebar.logic.test.ts # apps/web/src/components/Sidebar.logic.ts # apps/web/src/components/Sidebar.tsx
2 parents e1e2c63 + dcd2e5c commit 4d0842f

51 files changed

Lines changed: 1755 additions & 592 deletions

Some content is hidden

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

.github/VOUCHED.td

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,4 @@ github:realAhmedRoach
2828
github:shiroyasha9
2929
github:Yash-Singh1
3030
github:eggfriedrice24
31+
github:Ymit24

.github/workflows/ci.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,20 +12,20 @@ jobs:
1212
runs-on: blacksmith-4vcpu-ubuntu-2404
1313
steps:
1414
- name: Checkout
15-
uses: actions/checkout@v4
15+
uses: actions/checkout@v6
1616

1717
- name: Setup Bun
1818
uses: oven-sh/setup-bun@v2
1919
with:
2020
bun-version-file: package.json
2121

2222
- name: Setup Node
23-
uses: actions/setup-node@v4
23+
uses: actions/setup-node@v6
2424
with:
2525
node-version-file: package.json
2626

2727
- name: Cache Bun and Turbo
28-
uses: actions/cache@v4
28+
uses: actions/cache@v5
2929
with:
3030
path: |
3131
~/.bun/install/cache
@@ -35,7 +35,7 @@ jobs:
3535
${{ runner.os }}-bun-${{ hashFiles('bun.lock') }}-
3636
3737
- name: Cache Playwright browsers
38-
uses: actions/cache@v4
38+
uses: actions/cache@v5
3939
with:
4040
path: ~/.cache/ms-playwright
4141
key: ${{ runner.os }}-playwright-${{ hashFiles('bun.lock') }}
@@ -78,15 +78,15 @@ jobs:
7878
runs-on: ubuntu-24.04
7979
steps:
8080
- name: Checkout
81-
uses: actions/checkout@v4
81+
uses: actions/checkout@v6
8282

8383
- name: Setup Bun
8484
uses: oven-sh/setup-bun@v2
8585
with:
8686
bun-version-file: package.json
8787

8888
- name: Setup Node
89-
uses: actions/setup-node@v4
89+
uses: actions/setup-node@v6
9090
with:
9191
node-version-file: package.json
9292

.github/workflows/pr-size.yml

Lines changed: 202 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,202 @@
1+
name: PR Size
2+
3+
on:
4+
pull_request_target:
5+
types: [opened, reopened, synchronize, ready_for_review, converted_to_draft]
6+
7+
permissions:
8+
contents: read
9+
10+
jobs:
11+
prepare-config:
12+
name: Prepare PR size config
13+
runs-on: ubuntu-24.04
14+
outputs:
15+
labels_json: ${{ steps.config.outputs.labels_json }}
16+
steps:
17+
- id: config
18+
name: Build PR size label config
19+
uses: actions/github-script@v8
20+
with:
21+
result-encoding: string
22+
script: |
23+
const managedLabels = [
24+
{
25+
name: "size:XS",
26+
color: "0e8a16",
27+
description: "0-9 changed lines (additions + deletions).",
28+
},
29+
{
30+
name: "size:S",
31+
color: "5ebd3e",
32+
description: "10-29 changed lines (additions + deletions).",
33+
},
34+
{
35+
name: "size:M",
36+
color: "fbca04",
37+
description: "30-99 changed lines (additions + deletions).",
38+
},
39+
{
40+
name: "size:L",
41+
color: "fe7d37",
42+
description: "100-499 changed lines (additions + deletions).",
43+
},
44+
{
45+
name: "size:XL",
46+
color: "d93f0b",
47+
description: "500-999 changed lines (additions + deletions).",
48+
},
49+
{
50+
name: "size:XXL",
51+
color: "b60205",
52+
description: "1,000+ changed lines (additions + deletions).",
53+
},
54+
];
55+
56+
core.setOutput("labels_json", JSON.stringify(managedLabels));
57+
sync-label-definitions:
58+
name: Sync PR size label definitions
59+
needs: prepare-config
60+
if: github.event_name != 'pull_request_target'
61+
runs-on: ubuntu-24.04
62+
permissions:
63+
contents: read
64+
issues: write
65+
steps:
66+
- name: Ensure PR size labels exist
67+
uses: actions/github-script@v8
68+
env:
69+
PR_SIZE_LABELS_JSON: ${{ needs.prepare-config.outputs.labels_json }}
70+
with:
71+
script: |
72+
const managedLabels = JSON.parse(process.env.PR_SIZE_LABELS_JSON ?? "[]");
73+
74+
for (const label of managedLabels) {
75+
try {
76+
const { data: existing } = await github.rest.issues.getLabel({
77+
owner: context.repo.owner,
78+
repo: context.repo.repo,
79+
name: label.name,
80+
});
81+
82+
if (
83+
existing.color !== label.color ||
84+
(existing.description ?? "") !== label.description
85+
) {
86+
await github.rest.issues.updateLabel({
87+
owner: context.repo.owner,
88+
repo: context.repo.repo,
89+
name: label.name,
90+
color: label.color,
91+
description: label.description,
92+
});
93+
}
94+
} catch (error) {
95+
if (error.status !== 404) {
96+
throw error;
97+
}
98+
99+
try {
100+
await github.rest.issues.createLabel({
101+
owner: context.repo.owner,
102+
repo: context.repo.repo,
103+
name: label.name,
104+
color: label.color,
105+
description: label.description,
106+
});
107+
} catch (createError) {
108+
if (createError.status !== 422) {
109+
throw createError;
110+
}
111+
}
112+
}
113+
}
114+
label:
115+
name: Label PR size
116+
needs: prepare-config
117+
if: github.event_name == 'pull_request_target'
118+
runs-on: ubuntu-24.04
119+
permissions:
120+
contents: read
121+
issues: read
122+
pull-requests: write
123+
concurrency:
124+
group: pr-size-${{ github.event.pull_request.number }}
125+
cancel-in-progress: true
126+
steps:
127+
- name: Sync PR size label
128+
uses: actions/github-script@v8
129+
env:
130+
PR_SIZE_LABELS_JSON: ${{ needs.prepare-config.outputs.labels_json }}
131+
with:
132+
script: |
133+
const issueNumber = context.payload.pull_request.number;
134+
const additions = context.payload.pull_request.additions ?? 0;
135+
const deletions = context.payload.pull_request.deletions ?? 0;
136+
const changedLines = additions + deletions;
137+
const managedLabels = JSON.parse(process.env.PR_SIZE_LABELS_JSON ?? "[]");
138+
139+
const managedLabelNames = new Set(managedLabels.map((label) => label.name));
140+
141+
const resolveSizeLabel = (totalChangedLines) => {
142+
if (totalChangedLines < 10) {
143+
return "size:XS";
144+
}
145+
146+
if (totalChangedLines < 30) {
147+
return "size:S";
148+
}
149+
150+
if (totalChangedLines < 100) {
151+
return "size:M";
152+
}
153+
154+
if (totalChangedLines < 500) {
155+
return "size:L";
156+
}
157+
158+
if (totalChangedLines < 1000) {
159+
return "size:XL";
160+
}
161+
162+
return "size:XXL";
163+
};
164+
165+
const nextLabelName = resolveSizeLabel(changedLines);
166+
167+
const { data: currentLabels } = await github.rest.issues.listLabelsOnIssue({
168+
owner: context.repo.owner,
169+
repo: context.repo.repo,
170+
issue_number: issueNumber,
171+
per_page: 100,
172+
});
173+
174+
for (const label of currentLabels) {
175+
if (!managedLabelNames.has(label.name) || label.name === nextLabelName) {
176+
continue;
177+
}
178+
179+
try {
180+
await github.rest.issues.removeLabel({
181+
owner: context.repo.owner,
182+
repo: context.repo.repo,
183+
issue_number: issueNumber,
184+
name: label.name,
185+
});
186+
} catch (removeError) {
187+
if (removeError.status !== 404) {
188+
throw removeError;
189+
}
190+
}
191+
}
192+
193+
if (!currentLabels.some((label) => label.name === nextLabelName)) {
194+
await github.rest.issues.addLabels({
195+
owner: context.repo.owner,
196+
repo: context.repo.repo,
197+
issue_number: issueNumber,
198+
labels: [nextLabelName],
199+
});
200+
}
201+
202+
core.info(`PR #${issueNumber}: ${changedLines} changed lines -> ${nextLabelName}`);

.github/workflows/pr-vouch.yml

Lines changed: 43 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
targets: ${{ steps.collect.outputs.targets }}
2626
steps:
2727
- id: collect
28-
uses: actions/github-script@v7
28+
uses: actions/github-script@v8
2929
with:
3030
script: |
3131
if (context.eventName === "pull_request_target") {
@@ -85,7 +85,7 @@ jobs:
8585
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
8686

8787
- name: Sync PR labels
88-
uses: actions/github-script@v7
88+
uses: actions/github-script@v8
8989
env:
9090
PR_NUMBER: ${{ matrix.target.number }}
9191
VOUCH_STATUS: ${{ steps.vouch.outputs.status }}
@@ -111,7 +111,7 @@ jobs:
111111
},
112112
];
113113
114-
const managedLabelNames = managedLabels.map((label) => label.name);
114+
const managedLabelNames = new Set(managedLabels.map((label) => label.name));
115115
116116
for (const label of managedLabels) {
117117
try {
@@ -138,13 +138,19 @@ jobs:
138138
throw error;
139139
}
140140
141-
await github.rest.issues.createLabel({
142-
owner: context.repo.owner,
143-
repo: context.repo.repo,
144-
name: label.name,
145-
color: label.color,
146-
description: label.description,
147-
});
141+
try {
142+
await github.rest.issues.createLabel({
143+
owner: context.repo.owner,
144+
repo: context.repo.repo,
145+
name: label.name,
146+
color: label.color,
147+
description: label.description,
148+
});
149+
} catch (createError) {
150+
if (createError.status !== 422) {
151+
throw createError;
152+
}
153+
}
148154
}
149155
}
150156
@@ -159,17 +165,35 @@ jobs:
159165
owner: context.repo.owner,
160166
repo: context.repo.repo,
161167
issue_number: issueNumber,
168+
per_page: 100,
162169
});
163170
164-
const preservedLabels = currentLabels
165-
.map((label) => label.name)
166-
.filter((name) => !managedLabelNames.includes(name));
171+
for (const label of currentLabels) {
172+
if (!managedLabelNames.has(label.name) || label.name === nextLabelName) {
173+
continue;
174+
}
167175
168-
await github.rest.issues.setLabels({
169-
owner: context.repo.owner,
170-
repo: context.repo.repo,
171-
issue_number: issueNumber,
172-
labels: [...preservedLabels, nextLabelName],
173-
});
176+
try {
177+
await github.rest.issues.removeLabel({
178+
owner: context.repo.owner,
179+
repo: context.repo.repo,
180+
issue_number: issueNumber,
181+
name: label.name,
182+
});
183+
} catch (removeError) {
184+
if (removeError.status !== 404) {
185+
throw removeError;
186+
}
187+
}
188+
}
189+
190+
if (!currentLabels.some((label) => label.name === nextLabelName)) {
191+
await github.rest.issues.addLabels({
192+
owner: context.repo.owner,
193+
repo: context.repo.repo,
194+
issue_number: issueNumber,
195+
labels: [nextLabelName],
196+
});
197+
}
174198
175199
core.info(`PR #${issueNumber}: ${status} -> ${nextLabelName}`);

0 commit comments

Comments
 (0)