Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
F
Falcon
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Walter Huang
Falcon
Commits
2aa179dd
Commit
2aa179dd
authored
Jun 27, 2025
by
Lin Wang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: upload the nav info to google sheet
parent
d95ef784
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
5 deletions
+14
-5
sendDiffToGoogleSheets.ts
...detect_section_selector_masters/sendDiffToGoogleSheets.ts
+14
-5
No files found.
src/detect_section_selector_masters/sendDiffToGoogleSheets.ts
View file @
2aa179dd
...
...
@@ -15,15 +15,24 @@ async function uploadAllToSheets() {
});
const
sheets
=
google
.
sheets
({
version
:
'v4'
,
auth
});
const
dir
=
join
(
__dirname
,
useAiSelectors
?
'diffAIWithBaseline'
:
'diffWithBaseline'
);
const
files
=
readdirSync
(
dir
).
filter
(
f
=>
f
.
endsWith
(
'.json'
));
// Determine directories to upload: both diff and nav folders for AI or baseline
const
dirNames
=
useAiSelectors
?
[
'diffAINavWithBaseline'
,
'diffAIWithBaseline'
]
:
[
'diffNavWithBaseline'
,
'diffWithBaseline'
];
const
files
=
dirNames
.
flatMap
(
subdir
=>
{
const
d
=
join
(
__dirname
,
subdir
);
return
readdirSync
(
d
)
.
filter
(
f
=>
f
.
endsWith
(
'.json'
))
.
map
(
f
=>
({
subdir
,
file
:
f
,
path
:
join
(
d
,
f
)
}));
});
// Fetch existing sheet names
const
{
data
:
spreadsheet
}
=
await
sheets
.
spreadsheets
.
get
({
spreadsheetId
});
const
existing
=
spreadsheet
.
sheets
?.
map
((
s
:
any
)
=>
s
.
properties
?.
title
||
''
)
||
[];
for
(
const
file
of
files
)
{
const
sheetName
=
file
.
replace
(
/
\.
json$/
,
''
);
for
(
const
{
subdir
,
file
,
path
}
of
files
)
{
// Prefix sheet name with directory to distinguish diff vs nav
const
sheetName
=
`
${
subdir
}
-
${
file
.
replace
(
/
\.
json$/
,
''
)}
`
;
if
(
!
existing
.
includes
(
sheetName
))
{
// Create new sheet
await
sheets
.
spreadsheets
.
batchUpdate
({
...
...
@@ -34,7 +43,7 @@ async function uploadAllToSheets() {
});
}
const
raw
=
readFileSync
(
join
(
dir
,
file
)
,
'utf-8'
);
const
raw
=
readFileSync
(
path
,
'utf-8'
);
const
data
=
JSON
.
parse
(
raw
);
// Always clear existing values, even for empty data, to overwrite the sheet
await
sheets
.
spreadsheets
.
values
.
clear
({
spreadsheetId
,
range
:
`'
${
sheetName
}
'`
});
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment