From 998060befe69aa05ff5bf23b6501efa0f1fe5739 Mon Sep 17 00:00:00 2001 From: Ciaran Moran Date: Wed, 24 Aug 2022 21:19:37 +0100 Subject: [PATCH] refactor: rename variables returned from getContext --- index.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/index.js b/index.js index ae01fcd..9c04b74 100644 --- a/index.js +++ b/index.js @@ -25,9 +25,9 @@ async function run () { return core.setFailed('webhook_url not set. Please set it.') } - const content = await getContext() + const {body, html_url, version} = await getContext() - const description = content.body + const description = body .replace(/### (.*?)\n/g,function (substring) { const newString = substring.slice(4).replace(/(\r\n|\n|\r)/gm, "") return `**__${newString}__**` @@ -39,19 +39,19 @@ async function run () { .replace(/\n\s*\n/g, '\n') const embedMsg = { - title: `Release ${content.version}`, - url: content.html_url, + title: `Release ${version}`, + url: html_url, color: color, description: description, } - const body = { username: username, avatar_url: avatarUrl, embeds: [embedMsg], } + const requestBody = { username: username, avatar_url: avatarUrl, embeds: [embedMsg], } const url = `${webhookUrl}?wait=true` fetch(url, { method: 'post', - body: JSON.stringify(body), + body: JSON.stringify(requestBody), headers: { 'Content-Type': 'application/json' } }) .then(res => res.json())