1- import os from "node:os" ;
21import webapi from "@slack/web-api" ;
3- import axios from "axios " ;
2+ import webhook from "@slack/webhook " ;
43import packageJson from "../package.json" with { type : "json" } ;
54import Content from "./content.js" ;
65import SlackError from "./errors.js" ;
@@ -60,11 +59,6 @@ export default class Config {
6059 */
6160 inputs ;
6261
63- /**
64- * @type {import("axios").AxiosStatic } - The axios client.
65- */
66- axios ;
67-
6862 /**
6963 * @type {Content } - The parsed payload data to send.
7064 */
@@ -87,6 +81,11 @@ export default class Config {
8781 */
8882 webapi ;
8983
84+ /**
85+ * @type {import("@slack/webhook") } - Slack webhook client.
86+ */
87+ webhook ;
88+
9089 /**
9190 * Gather values from the job inputs and use defaults or error for the missing
9291 * ones.
@@ -98,10 +97,10 @@ export default class Config {
9897 * @param {import("@actions/core") } core - GitHub Actions core utilities.
9998 */
10099 constructor ( core ) {
101- this . axios = axios ;
102100 this . core = core ;
103101 this . logger = new Logger ( core ) . logger ;
104102 this . webapi = webapi ;
103+ this . webhook = webhook ;
105104 this . inputs = {
106105 api : core . getInput ( "api" ) ,
107106 errors : core . getBooleanInput ( "errors" ) ,
@@ -137,11 +136,10 @@ export default class Config {
137136 name : packageJson . name ,
138137 version : packageJson . version ,
139138 } ) ;
140- this . axios . defaults . headers . common [ "User-Agent" ] =
141- `${ packageJson . name . replace ( "/" , ":" ) } /${ packageJson . version } ` +
142- `axios/${ this . axios . VERSION } ` +
143- `node/${ process . version . replace ( "v" , "" ) } ` +
144- `${ os . platform ( ) } /${ os . release ( ) } ` ;
139+ this . webhook . addAppMetadata ( {
140+ name : packageJson . name ,
141+ version : packageJson . version ,
142+ } ) ;
145143 }
146144
147145 /**
0 commit comments