Skip to content
Draft
93 changes: 60 additions & 33 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,12 @@
"@actions/github": "^9.1.1",
"@slack/logger": "^4.0.1",
"@slack/web-api": "^7.16.0",
"axios": "^1.16.0",
"axios-retry": "^4.5.0",
"@slack/webhook": "file:../node-slack-sdk/packages/webhook",
"flat": "^6.0.1",
"https-proxy-agent": "^9.0.0",
"js-yaml": "^4.2.0",
"markup-js": "^1.5.21"
"markup-js": "^1.5.21",
"p-retry": "^8.0.0"
},
"devDependencies": {
"@biomejs/biome": "^2.4.16",
Expand Down
16 changes: 3 additions & 13 deletions src/config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import os from "node:os";
import webapi from "@slack/web-api";
import axios from "axios";
import packageJson from "../package.json" with { type: "json" };
import Content from "./content.js";
import SlackError from "./errors.js";
Expand Down Expand Up @@ -60,11 +58,6 @@ export default class Config {
*/
inputs;

/**
* @type {import("axios").AxiosStatic} - The axios client.
*/
axios;

/**
* @type {Content} - The parsed payload data to send.
*/
Expand Down Expand Up @@ -98,7 +91,6 @@ export default class Config {
* @param {import("@actions/core")} core - GitHub Actions core utilities.
*/
constructor(core) {
this.axios = axios;
this.core = core;
this.logger = new Logger(core).logger;
this.webapi = webapi;
Expand Down Expand Up @@ -131,17 +123,15 @@ export default class Config {

/**
* Add user agent metadata for instrumentation.
*
* The @slack/webhook and @slack/web-api SDKs set their own User-Agent
* headers, so the action only registers app metadata with web-api here.
*/
instrument() {
this.webapi.addAppMetadata({
name: packageJson.name,
version: packageJson.version,
});
this.axios.defaults.headers.common["User-Agent"] =
`${packageJson.name.replace("/", ":")}/${packageJson.version} ` +
`axios/${this.axios.VERSION} ` +
`node/${process.version.replace("v", "")} ` +
`${os.platform()}/${os.release()}`;
}

/**
Expand Down
Loading