MCPcopy Create free account
hub / github.com/Semporia/Scripts / image_update_notify

Function image_update_notify

docker/notify_docker_user.js:4–17  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2const fs = require('fs');
3const notifyPath = '/scripts/logs/notify.txt';
4async function image_update_notify() {
5 if (fs.existsSync(notifyPath)) {
6 const content = await fs.readFileSync(`${notifyPath}`, 'utf8');//读取notify.txt内容
7 if (process.env.NOTIFY_CONTENT && !content.includes(process.env.NOTIFY_CONTENT)) {
8 await notify.sendNotify("⚠️Docker镜像版本更新通知⚠️", process.env.NOTIFY_CONTENT);
9 await fs.writeFileSync(`${notifyPath}`, process.env.NOTIFY_CONTENT);
10 }
11 } else {
12 if (process.env.NOTIFY_CONTENT) {
13 notify.sendNotify("⚠️Docker镜像版本更新通知⚠️", process.env.NOTIFY_CONTENT)
14 await fs.writeFileSync(`${notifyPath}`, process.env.NOTIFY_CONTENT);
15 }
16 }
17}
18!(async() => {
19 await image_update_notify();
20})().catch((e) => console.log(e))

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected