From 92ff0261dbe469105f18097ca1f87534b5e9772c Mon Sep 17 00:00:00 2001 From: Tristan Helmich Date: Mon, 5 Oct 2020 17:45:42 +0000 Subject: [PATCH 1/2] automed ESLint fixes --- index.js | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/index.js b/index.js index c235547..5bd0790 100644 --- a/index.js +++ b/index.js @@ -1,7 +1,6 @@ const core = require('@actions/core'); -const github = require('@actions/github'); -var sdk = require("matrix-js-sdk"); +const sdk = require('matrix-js-sdk'); try { const homeserver = core.getInput('homeserver'); @@ -10,7 +9,6 @@ try { const message = core.getInput('message'); const messagetype = core.getInput('messagetype'); - // Debug output console.log(`homeserver: ${homeserver}`); console.log(`channel: ${channel}`); @@ -20,27 +18,26 @@ try { // Create client object const client = sdk.createClient({ - baseUrl: "https://matrix.org", - accessToken: token + baseUrl: 'https://matrix.org', + accessToken: token, }); // Join channel (if we are already in the channel this does nothing) - client.joinRoom(channel).then(function() { - console.log("Joined channel"); + client.joinRoom(channel).then(() => { + console.log('Joined channel'); }); // Send message const content = { - "msgtype": messagetype, - "body": message + msgtype: messagetype, + body: message, }; - client.sendEvent(channel, "m.room.message", content, "").then((res) => { + client.sendEvent(channel, 'm.room.message', content, '').then(() => { // message sent successfully }).catch((err) => { console.log(err); }); - } catch (error) { core.setFailed(error.message); } From 64c0be81fc7f5f46ba1bf8ff1c183d89e982cc8c Mon Sep 17 00:00:00 2001 From: Tristan Helmich Date: Mon, 5 Oct 2020 18:40:02 +0000 Subject: [PATCH 2/2] Fix more ESLint warnings --- index.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/index.js b/index.js index 5bd0790..ea4b22a 100644 --- a/index.js +++ b/index.js @@ -10,11 +10,11 @@ try { const messagetype = core.getInput('messagetype'); // Debug output - console.log(`homeserver: ${homeserver}`); - console.log(`channel: ${channel}`); - console.log(`token: ${token}`); - console.log(`message: ${message}`); - console.log(`messagetype: ${messagetype}`); + core.info(`homeserver: ${homeserver}`); + core.info(`channel: ${channel}`); + core.info(`token: ${token}`); + core.info(`message: ${message}`); + core.info(`messagetype: ${messagetype}`); // Create client object const client = sdk.createClient({