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
0
Merge Requests
0
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
fb2db896
Commit
fb2db896
authored
Jul 01, 2025
by
Lin Wang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: add the detect error message
parent
fcc954dc
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
3 deletions
+24
-3
package.json
package.json
+1
-1
slack.ts
src/clients/slack.ts
+2
-0
sendNotifySlack.ts
src/detect_section_selector_masters/sendNotifySlack.ts
+21
-2
No files found.
package.json
View file @
fb2db896
...
@@ -17,7 +17,7 @@
...
@@ -17,7 +17,7 @@
"scripts"
:
{
"scripts"
:
{
"extract"
:
"DETECTION_MODE=extract bun run src/detect_section_selector_masters/index.ts"
,
"extract"
:
"DETECTION_MODE=extract bun run src/detect_section_selector_masters/index.ts"
,
"extract:ai"
:
"USE_AI_SELECTORS=true bun run extract"
,
"extract:ai"
:
"USE_AI_SELECTORS=true bun run extract"
,
"detect"
:
"DETECTION_MODE=detect bun run src/detect_section_selector_masters/index.ts"
,
"detect"
:
"
USE_AI_SELECTORS=false
DETECTION_MODE=detect bun run src/detect_section_selector_masters/index.ts"
,
"detect:ai"
:
"USE_AI_SELECTORS=true bun run detect"
,
"detect:ai"
:
"USE_AI_SELECTORS=true bun run detect"
,
"fix"
:
"DETECTION_MODE=fix bun run src/detect_section_selector_masters/index.ts"
,
"fix"
:
"DETECTION_MODE=fix bun run src/detect_section_selector_masters/index.ts"
,
"fix:ai"
:
"USE_AI_SELECTORS=true bun run fix"
,
"fix:ai"
:
"USE_AI_SELECTORS=true bun run fix"
,
...
...
src/clients/slack.ts
View file @
fb2db896
...
@@ -3,10 +3,12 @@ import { createReadStream } from 'fs';
...
@@ -3,10 +3,12 @@ import { createReadStream } from 'fs';
import
{
basename
}
from
'path'
;
import
{
basename
}
from
'path'
;
export
async
function
sendSlackMessage
(
webhookUrl
:
string
,
params
:
{
export
async
function
sendSlackMessage
(
webhookUrl
:
string
,
params
:
{
note
?:
string
,
issue
:
string
,
issue
:
string
,
details
?:
string
,
details
?:
string
,
})
{
})
{
const
parts
:
string
[]
=
[];
const
parts
:
string
[]
=
[];
if
(
params
.
note
)
parts
.
push
(
`
${
params
.
note
}
`
);
parts
.
push
(
`Issue:
${
params
.
issue
}
`
);
parts
.
push
(
`Issue:
${
params
.
issue
}
`
);
if
(
params
.
details
)
parts
.
push
(
`Details:
${
params
.
details
}
`
);
if
(
params
.
details
)
parts
.
push
(
`Details:
${
params
.
details
}
`
);
const
text
=
parts
.
join
(
'
\
n'
);
const
text
=
parts
.
join
(
'
\
n'
);
...
...
src/detect_section_selector_masters/sendNotifySlack.ts
View file @
fb2db896
import
{
sendSlackMessage
}
from
'../clients/slack'
;
import
{
sendSlackMessage
}
from
'../clients/slack'
;
import
{
readdirSync
,
readFileSync
}
from
'fs'
;
import
{
readdirSync
,
readFileSync
}
from
'fs'
;
import
{
join
}
from
'path'
;
import
{
join
}
from
'path'
;
import
{
diffBaselineId
}
from
'../constant/section_selectors'
;
async
function
main
()
{
async
function
main
()
{
// Scan diff directories for JSON files, with error handling
// Scan diff directories for JSON files, with error handling
...
@@ -28,15 +29,33 @@ async function main() {
...
@@ -28,15 +29,33 @@ async function main() {
return
false
;
return
false
;
}
}
});
});
if
(
!
hasChanges
)
{
console
.
log
(
'No changes detected in both diff directories, skipping Slack notification.'
);
// Check detectOutput file for diffBaselineId
const
detectOutputFile
=
join
(
__dirname
,
'detectOutput'
,
`
${
diffBaselineId
}
_detect.json`
);
let
hasDetectChanges
=
false
;
let
detectMessage
=
''
;
try
{
const
detectData
=
JSON
.
parse
(
readFileSync
(
detectOutputFile
,
'utf-8'
));
hasDetectChanges
=
Array
.
isArray
(
detectData
)
&&
detectData
.
length
>
0
;
if
(
hasDetectChanges
)
{
detectMessage
=
'⚠️ Issues are detected in the EN master section template.'
;
}
}
catch
(
e
)
{
console
.
warn
(
`DetectOutput file
${
detectOutputFile
}
not found or invalid, skipping baseline check.`
);
}
if
(
!
hasChanges
&&
!
hasDetectChanges
)
{
console
.
log
(
'No changes detected in diff directories and baseline, skipping Slack notification.'
);
process
.
exit
(
0
);
process
.
exit
(
0
);
}
}
const
webhookUrl
=
process
.
env
.
SLACK_WEBHOOK
!
;
const
webhookUrl
=
process
.
env
.
SLACK_WEBHOOK
!
;
const
nonAiUrl
=
`https://docs.google.com/spreadsheets/d/
${
process
.
env
.
GOOGLE_SHEET_ID
}
/edit`
;
const
nonAiUrl
=
`https://docs.google.com/spreadsheets/d/
${
process
.
env
.
GOOGLE_SHEET_ID
}
/edit`
;
const
aiUrl
=
`https://docs.google.com/spreadsheets/d/
${
process
.
env
.
GOOGLE_SHEET_AI_ID
}
/edit`
;
const
aiUrl
=
`https://docs.google.com/spreadsheets/d/
${
process
.
env
.
GOOGLE_SHEET_AI_ID
}
/edit`
;
await
sendSlackMessage
(
webhookUrl
,
{
await
sendSlackMessage
(
webhookUrl
,
{
note
:
`
${
detectMessage
}
`
,
issue
:
'Inconsistencies are detected in i18n master section template'
,
issue
:
'Inconsistencies are detected in i18n master section template'
,
details
:
`Google Sheet Links:\n- Non-AI selectors:
${
nonAiUrl
}
\n- AI selectors:
${
aiUrl
}
`
details
:
`Google Sheet Links:\n- Non-AI selectors:
${
nonAiUrl
}
\n- AI selectors:
${
aiUrl
}
`
});
});
...
...
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