diff --git a/.eslintrc.json b/.eslintrc.json index 71ee545..d8c5111 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -12,6 +12,7 @@ "eslint-comments/no-use": "off", "import/no-namespace": "off", "no-unused-vars": "off", + "sort-imports": "off", "@typescript-eslint/no-unused-vars": "error", "@typescript-eslint/explicit-member-accessibility": ["error", {"accessibility": "no-public"}], "@typescript-eslint/no-require-imports": "error", @@ -52,4 +53,4 @@ "es6": true, "jest/globals": true } - } \ No newline at end of file + } diff --git a/dist/index.js b/dist/index.js index 19d2c19..0920c4f 100644 Binary files a/dist/index.js and b/dist/index.js differ diff --git a/dist/index.js.map b/dist/index.js.map index 77ffad3..9460cd9 100644 Binary files a/dist/index.js.map and b/dist/index.js.map differ diff --git a/dist/licenses.txt b/dist/licenses.txt index a5d7d9a..1aad235 100644 Binary files a/dist/licenses.txt and b/dist/licenses.txt differ diff --git a/package-lock.json b/package-lock.json index 4373e3e..962c4ce 100644 --- a/package-lock.json +++ b/package-lock.json @@ -15,6 +15,7 @@ "form-data": "^4.0.0" }, "devDependencies": { + "@types/axios": "^0.14.0", "@types/jest": "^27.5.2", "@types/node": "^18.7.8", "@typescript-eslint/eslint-plugin": "^5.33.1", @@ -2063,6 +2064,16 @@ "node": ">= 6" } }, + "node_modules/@types/axios": { + "version": "0.14.0", + "resolved": "https://registry.npmjs.org/@types/axios/-/axios-0.14.0.tgz", + "integrity": "sha512-KqQnQbdYE54D7oa/UmYVMZKq7CO4l8DEENzOKc4aBRwxCXSlJXGz83flFx5L7AWrOQnmuN3kVsRdt+GZPPjiVQ==", + "deprecated": "This is a stub types definition for axios (https://github.com/mzabriskie/axios). axios provides its own type definitions, so you don't need @types/axios installed!", + "dev": true, + "dependencies": { + "axios": "*" + } + }, "node_modules/@types/babel__core": { "version": "7.1.16", "resolved": "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.1.16.tgz", diff --git a/package.json b/package.json index a23d1a9..c06a6e0 100644 --- a/package.json +++ b/package.json @@ -6,8 +6,8 @@ "main": "lib/webhook.js", "scripts": { "build": "tsc", - "format": "prettier --write '**/*.ts'", - "format-check": "prettier --check '**/*.ts'", + "format": "prettier --write src/**/*.ts", + "format-check": "prettier --check src/**/*.ts", "lint": "eslint src/**/*.ts", "package": "ncc build --source-map --license licenses.txt", "test": "jest", @@ -31,6 +31,7 @@ "form-data": "^4.0.0" }, "devDependencies": { + "@types/axios": "^0.14.0", "@types/jest": "^27.5.2", "@types/node": "^18.7.8", "@typescript-eslint/eslint-plugin": "^5.33.1", diff --git a/src/webhook.ts b/src/webhook.ts index 1f357df..c8a4fbe 100644 --- a/src/webhook.ts +++ b/src/webhook.ts @@ -1,9 +1,9 @@ import * as core from '@actions/core' import {createReadStream, readFileSync} from 'fs' +import axios from 'axios' import {HttpClient} from '@actions/http-client' import {TypedResponse} from '@actions/http-client/lib/interfaces' import {blob} from 'node:stream/consumers' -import axios from 'axios' const WEBHOOK_URL = 'webhook-url' const CONTENT = 'content' @@ -179,29 +179,6 @@ export async function executeWebhook(): Promise { `successfully uploaded file with status code: ${response.status}` ) } - - // request - // .on('response', response => { - // if (response.statusCode !== 200) { - // if (filename !== '') { - // core.error(`failed to upload file: ${response.statusMessage}`) - // } - // if (threadName !== '') { - // core.error(`failed to create thread: ${threadName}`) - // } - // } else if (filename !== '') { - // core.info( - // `successfully uploaded file with status code: ${response.statusCode}` - // ) - // } - // if (fileStream != null) { - // fileStream.destroy() - // } - // response.destroy() - // }) - // .on('error', err => { - // core.error(err.message) - // }) } else { const response = await client.postJson(webhookUrl, payload) await handleResponse(response)