From 1ab9f7810f7cc943bc48e02165784de120355e6d Mon Sep 17 00:00:00 2001 From: Andrew Lisowski Date: Wed, 21 Oct 2020 16:16:01 -0700 Subject: [PATCH] use MICROSOFT_TEAMS_WEBHOOK_URL env var --- plugins/microsoft-teams/src/index.ts | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/plugins/microsoft-teams/src/index.ts b/plugins/microsoft-teams/src/index.ts index 4ce1f9c36..091dcf5b3 100644 --- a/plugins/microsoft-teams/src/index.ts +++ b/plugins/microsoft-teams/src/index.ts @@ -1,7 +1,7 @@ import { HttpsProxyAgent } from "https-proxy-agent"; import { Auto, InteractiveInit } from "@auto-it/core"; -import SlackPlugin from "@auto-it/slack"; +import SlackPlugin, { ISlackPluginOptions } from "@auto-it/slack"; import fetch from "node-fetch"; /** Post your release notes to Slack during `auto release` */ @@ -9,12 +9,24 @@ export default class MicrosoftTeamsPlugin extends SlackPlugin { /** The name of the plugin */ name = "microsoft-teams"; + /** Initialize the plugin with it's options */ + constructor(options: ISlackPluginOptions | string = {}) { + super( + typeof options === "string" + ? options + : { + ...options, + url: process.env.MICROSOFT_TEAMS_WEBHOOK_URL || options.url || "", + } + ); + } + /** Custom initialization for this plugin */ init(initializer: InteractiveInit) { initializer.hooks.createEnv.tapPromise(this.name, async (vars) => [ ...vars, { - variable: "SLACK_WEBHOOK_URL", + variable: "MICROSOFT_TEAMS_WEBHOOK_URL", message: "What is the root url of your slack hook? ()", }, ]);