Skip to content

Can't use proxy #103

Open
Open
@misterunknown

Description

@misterunknown

Hi,

unfortunately this package does not recognize proxy settings. I fixed that by using @actions/http-client:

diff --git a/src/MSTeams.js b/src/MSTeams.js
index a4a4bf0..9ef2f1f 100644
--- a/src/MSTeams.js
+++ b/src/MSTeams.js
@@ -1,6 +1,7 @@
 const {IncomingWebhook} = require('ms-teams-webhook');
 const {context: github} = require('@actions/github');
 const core = require('@actions/core');
+const http = require('@actions/http-client');
 
 const placeholder = '';
 const {
@@ -277,8 +278,8 @@ class MSTeams {
    * @returns {Promise} result
    */
   async notify(url, payload) {
-    const client = new IncomingWebhook(url);
-    const response = await client.send(payload);
+    const client = new http.HttpClient();
+    const response = await client.postJson(url, payload);
 
     if (!response.text) {
       throw new Error('Failed to send notification to Microsoft Teams.\n' + 'Response:\n' + JSON.stringify(response, null, 2));

I'd like to make a pull request, but unfortunately I'm an absolute noob in regards to NodeJS/npm and my pre-commit hook keeps failing. Maybe you can implement this yourself, since @actions/http-client works with proxy settings.

Cheers,
Marco

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions