const { getInput} = require("@actions/core") const { existsSync, readFileSync } = require("fs") const zulipInit = require("zulip-js"); // Pass the path to your zuliprc file here. const config = { username: getInput("email"), apiKey: getInput("key"), realm: getInput("url") }; (async () => { const client = await zulipInit(config); let content = getInput("text"); if(getInput("type")=="file"){ const path = getInput("path") if(!existsSync(path)){ throw new Error("I/O: can't find "+path) } if(content&&content.trim().length){ content += "\r\n\n"; } content += readFileSync(path).toString() } // Send a stream message let params = { to: getInput("stream"), type: "stream", topic: getInput("topic"), content, }; console.log(await client.messages.send(params)); })();