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
43875f1c
Commit
43875f1c
authored
Jun 26, 2025
by
Lin Wang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: send message to the slack channel
parent
14dc04f9
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
23 deletions
+29
-23
slack.ts
src/clients/slack.ts
+7
-19
sendDiffToGoogleSheets.ts
...detect_section_selector_masters/sendDiffToGoogleSheets.ts
+22
-4
No files found.
src/clients/slack.ts
View file @
43875f1c
...
...
@@ -4,16 +4,12 @@ import { basename } from 'path';
export
async
function
sendSlackMessage
(
webhookUrl
:
string
,
params
:
{
issue
:
string
,
displayName
:
string
,
language
:
string
,
siteEditor
:
string
details
?:
string
,
})
{
const
text
=
[
`Issue:
${
params
.
issue
}
`
,
`Display Name:
${
params
.
displayName
}
`
,
`Language:
${
params
.
language
}
`
,
`Site editor:
${
params
.
siteEditor
}
`
].
join
(
'
\
n'
);
const
parts
:
string
[]
=
[];
parts
.
push
(
`Issue:
${
params
.
issue
}
`
);
if
(
params
.
details
)
parts
.
push
(
`Details:
${
params
.
details
}
`
);
const
text
=
parts
.
join
(
'
\
n'
);
const
res
=
await
fetch
(
webhookUrl
,
{
method
:
"POST"
,
...
...
@@ -50,12 +46,4 @@ export async function sendSlackFile(
if
(
!
response
.
ok
)
{
throw
new
Error
(
`Slack 文件上传失败:
${
response
.
error
}
`
);
}
}
// 示例用法
// sendSlackMessage('https://hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX', {
// issue: 'Theme color missing',
// displayName: 'Lavender',
// language: 'en',
// siteEditor: 'https://www.strikingly.com/s/sites/12572142/edit'
// });
\ No newline at end of file
}
\ No newline at end of file
src/detect_section_selector_masters/sendDiffToGoogleSheets.ts
View file @
43875f1c
...
...
@@ -2,6 +2,7 @@
import
{
google
}
from
'googleapis'
;
import
{
readdirSync
,
readFileSync
}
from
'fs'
;
import
{
join
}
from
'path'
;
import
{
sendSlackMessage
}
from
'../clients/slack'
;
async
function
uploadAllToSheets
()
{
const
useAiSelectors
=
process
.
env
.
USE_AI_SELECTORS
===
'true'
;
...
...
@@ -61,7 +62,24 @@ async function uploadAllToSheets() {
}
}
uploadAllToSheets
().
catch
(
err
=>
{
console
.
error
(
'Error uploading to Google Sheets:'
,
err
);
process
.
exit
(
1
);
});
async
function
notifySlack
()
{
const
webhookUrl
=
process
.
env
.
SLACK_WEBHOOK
!
;
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`
;
await
sendSlackMessage
(
webhookUrl
,
{
issue
:
'Inconsistencies are detected in i18n master section template'
,
details
:
`Google Sheet Links:\n- Non-AI selectors:
${
nonAiUrl
}
\n- AI selectors:
${
aiUrl
}
`
});
}
async
function
main
()
{
try
{
await
uploadAllToSheets
();
await
notifySlack
();
}
catch
(
err
)
{
console
.
error
(
'Error in task:gsheet workflow:'
,
err
);
process
.
exit
(
1
);
}
}
main
();
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