diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index e5ab47d..a1cbea8 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -8,18 +8,16 @@ on: # rebuild any PRs and main branch changes - 'releases/*' jobs: - build: # make sure build/ci work properly + build_and_test: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - run: | + - name: Build + run: | npm install npm run all - test: # make sure the action works on a clean machine without building - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: ./ + - name: Test + uses: ./ with: github-token: ${{ github.token }} ms-teams-webhook-uri: ${{ secrets.MS_TEAMS_WEBHOOK_URI }} @@ -53,4 +51,4 @@ jobs: ms-teams-webhook-uri: ${{ secrets.MS_TEAMS_WEBHOOK_URI }} notification-summary: "Emojify! 🚢​​ ✅" notification-color: 28a745 - timezone: America/Denver \ No newline at end of file + timezone: America/Denver diff --git a/package-lock.json b/package-lock.json index 58029ca..7df9f65 100644 --- a/package-lock.json +++ b/package-lock.json @@ -21,7 +21,7 @@ "@types/moment-timezone": "^0.5.30", "@types/node": "^16.11.7", "@typescript-eslint/parser": "^5.47.0", - "@zeit/ncc": "^0.20.5", + "@vercel/ncc": "^0.38.0", "eslint": "^8.30.0", "eslint-plugin-github": "^4.6.0", "eslint-plugin-jest": "^27.1.7", diff --git a/package.json b/package.json index 0c26a24..74055ac 100644 --- a/package.json +++ b/package.json @@ -5,10 +5,10 @@ "description": "TypeScript template action", "main": "lib/main.js", "scripts": { - "build": "set NODE_OPTIONS=--openssl-legacy-provider tsc", + "build": "export NODE_OPTIONS=--openssl-legacy-provider && tsc", "format": "prettier --write **/*.ts", "format-check": "prettier --check **/*.ts", - "pack": "set NODE_OPTIONS=--openssl-legacy-provider ncc build", + "pack": "export NODE_OPTIONS=--openssl-legacy-provider && ncc build", "all": "npm run build && npm run format && npm run pack" }, "repository": { @@ -35,7 +35,7 @@ "@types/moment-timezone": "^0.5.30", "@types/node": "^16.11.7", "@typescript-eslint/parser": "^5.47.0", - "@zeit/ncc": "^0.20.5", + "@vercel/ncc": "^0.38.0", "eslint": "^8.30.0", "eslint-plugin-github": "^4.6.0", "eslint-plugin-jest": "^27.1.7", diff --git a/src/main.ts b/src/main.ts index bf5cf7e..9adbe87 100644 --- a/src/main.ts +++ b/src/main.ts @@ -3,6 +3,8 @@ import {Octokit} from '@octokit/rest' import axios from 'axios' import moment from 'moment-timezone' import {createMessageCard} from './message-card' +import { fetch as undiciFetch, ProxyAgent } from 'undici'; +import Options from 'undici/types/dispatcher'; const escapeMarkdownTokens = (text: string) => text @@ -34,7 +36,14 @@ async function run(): Promise { const sha = process.env.GITHUB_SHA || '' const runId = process.env.GITHUB_RUN_ID || '' const runNum = process.env.GITHUB_RUN_NUMBER || '' - const params = {owner, repo, ref: sha} + const proxyURI = process.env.https_proxy || process.env.HTTPS_PROXY || '' + const myFetch = (url: string, options: Options) => { + return undiciFetch(url, { + ...options, + dispatcher: new ProxyAgent({uri: proxyURI}) + }) + } + const params = {owner, repo, ref: sha, request: { fetch: myFetch }} const repoName = params.owner + '/' + params.repo const repoUrl = `https://github.com/${repoName}`