MCPcopy
hub / github.com/tensorflow/tfjs / sendChatMsg

Function sendChatMsg

scripts/cloud_funcs/send_email/index.js:48–71  ·  view source on GitHub ↗
(build, msg)

Source from the content-addressed store, hash-verified

46};
47
48async function sendChatMsg(build, msg) {
49 let chatMsg = `${msg} <${build.logUrl}|See logs>.`;
50
51 const success = build.status === 'SUCCESS';
52
53 if (!success) {
54 const joke = (await (await fetch('https://icanhazdadjoke.com/', {
55 headers: {'Accept': 'application/json'}
56 })).json())
57 .joke;
58 const jokeMsg = `Oh no! Failed builds are not fun... So here's a joke ` +
59 `to brighten your day :) -- ${joke}`;
60 chatMsg = `${chatMsg} ${jokeMsg}`;
61 }
62
63 const res = await request(process.env.HANGOUTS_URL, {
64 resolveWithFullResponse: true,
65 method: 'POST',
66 json: true,
67 body: {text: chatMsg},
68 });
69 console.log(`statusCode: ${res.statusCode}`);
70 console.log(res.body);
71}

Callers 1

index.jsFile · 0.70

Calls 2

logMethod · 0.65
fetchFunction · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…