Skip to content

Commit dd65aac

Browse files
Modernise proxy code
1 parent 069325a commit dd65aac

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

index.js

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
const core = require('@actions/core')
22
const AWS = require('aws-sdk')
3+
const proxy = require('proxy-agent');
34

45
/**
56
* @typedef {{
@@ -128,10 +129,10 @@ const parseIgnoreList = (list) => {
128129
}
129130

130131
function configureGlobalProxy(proxyUrl) {
131-
var proxy = require('proxy-agent');
132-
AWS.config.update({
133-
httpOptions: { agent: proxy(proxyUrl) }
134-
});
132+
core.debug("Using proxy URL: " + proxyUrl);
133+
AWS.config.update({
134+
httpOptions: { agent: proxy(proxyUrl) }
135+
});
135136
}
136137

137138
const main = async () => {
@@ -141,9 +142,8 @@ const main = async () => {
141142
const failThreshold = core.getInput('fail_threshold') || 'high'
142143
const ignoreList = parseIgnoreList(core.getInput('ignore_list'))
143144

144-
if (proxyUrl = process.env.HTTPS_PROXY
145-
|| process.env.https_proxy) {
146-
core.debug("Using proxy URL: " + proxyUrl);
145+
const proxyUrl = process.env.HTTPS_PROXY || process.env.https_proxy
146+
if (proxyUrl !== undefined) {
147147
configureGlobalProxy(proxyUrl)
148148
}
149149

0 commit comments

Comments
 (0)