Skip to content

Commit 8135d1a

Browse files
committed
small updates
1 parent 5b8255c commit 8135d1a

8 files changed

Lines changed: 30 additions & 2 deletions

File tree

.github/workflows/ci.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ permissions:
1212
jobs:
1313
test:
1414
runs-on: ubuntu-latest
15+
env:
16+
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: 'true'
1517

1618
services:
1719
postgres:

.github/workflows/daily-budget-check.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ permissions:
99
jobs:
1010
budget-sync:
1111
runs-on: ubuntu-latest
12+
env:
13+
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: 'true'
1214
steps:
1315
- uses: actions/checkout@v4
1416
- uses: actions/setup-node@v4

.github/workflows/daily-forecast.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ permissions:
99
jobs:
1010
forecast:
1111
runs-on: ubuntu-latest
12+
env:
13+
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: 'true'
1214
steps:
1315
- uses: actions/checkout@v4
1416
- uses: actions/setup-node@v4

.github/workflows/nightly-etl.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ permissions:
99
jobs:
1010
etl:
1111
runs-on: ubuntu-latest
12+
env:
13+
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: 'true'
1214
steps:
1315
- uses: actions/checkout@v4
1416
- uses: actions/setup-node@v4

.github/workflows/static.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ jobs:
2121
name: github-pages
2222
url: ${{ steps.deployment.outputs.page_url }}
2323
runs-on: ubuntu-latest
24+
env:
25+
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: 'true'
2426
steps:
2527
- name: Checkout
2628
uses: actions/checkout@v4

.github/workflows/weekly-classify.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ permissions:
99
jobs:
1010
classify:
1111
runs-on: ubuntu-latest
12+
env:
13+
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: 'true'
1214
steps:
1315
- uses: actions/checkout@v4
1416
- uses: actions/setup-node@v4

src/etl/pipeline.ts

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,11 @@ async function storeRawReport(ctx: PipelineCtx, reportType: string, sourceUrl: s
5252
ctx.result.rawStored++;
5353
}
5454

55+
function toTimestamp(db: DbClient, value: string | null | undefined): Date | string | null {
56+
if (!value) return null;
57+
return db.isSqlite ? value : new Date(value);
58+
}
59+
5560
async function upsertUsers(ctx: PipelineCtx, userRows: Array<{
5661
githubLogin: string; enterprise: string; org: string;
5762
displayName?: string | null; email?: string | null; team?: string | null;
@@ -60,7 +65,12 @@ async function upsertUsers(ctx: PipelineCtx, userRows: Array<{
6065
}>) {
6166
if (userRows.length === 0) return;
6267
const t = dialectTable(ctx.db, usersPg, usersSq);
63-
await ctx.r.insert(t).values(userRows)
68+
const values = userRows.map(row => ({
69+
...row,
70+
seatCreatedAt: toTimestamp(ctx.db, row.seatCreatedAt),
71+
lastActivityAt: toTimestamp(ctx.db, row.lastActivityAt),
72+
}));
73+
await ctx.r.insert(t).values(values)
6474
.onConflictDoUpdate({
6575
target: t.githubLogin,
6676
set: {
@@ -83,7 +93,12 @@ async function upsertSeatUsers(ctx: PipelineCtx, seatRows: Array<{
8393
}>) {
8494
if (seatRows.length === 0) return;
8595
const t = dialectTable(ctx.db, usersPg, usersSq);
86-
await ctx.r.insert(t).values(seatRows)
96+
const values = seatRows.map(row => ({
97+
...row,
98+
seatCreatedAt: toTimestamp(ctx.db, row.seatCreatedAt),
99+
lastActivityAt: toTimestamp(ctx.db, row.lastActivityAt),
100+
}));
101+
await ctx.r.insert(t).values(values)
87102
.onConflictDoUpdate({
88103
target: t.githubLogin,
89104
set: {

src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ export async function main(argv: string[]): Promise<void> {
137137

138138
const cfg = getConfig();
139139
const db = initDb(cfg.postgres.url);
140+
await runMigrations(db);
140141
const gh = createGitHubClient(cfg.github.token, cfg.github.enterprise, cfg.github.org);
141142

142143
const slackWebhookUrl = process.env.SLACK_WEBHOOK_URL;

0 commit comments

Comments
 (0)