Skip to content

Commit 7e44799

Browse files
committed
keep the upstream formatting/indentation
1 parent 32f57e3 commit 7e44799

File tree

2 files changed

+112
-131
lines changed

2 files changed

+112
-131
lines changed

dist/index.js

+56-66
Original file line numberDiff line numberDiff line change
@@ -33961,122 +33961,112 @@ var __webpack_exports__ = {};
3396133961
"use strict";
3396233962

3396333963

33964-
const core = __nccwpck_require__(9093)
33965-
const axios = __nccwpck_require__(314)
33966-
const https = __nccwpck_require__(5687)
33967-
const { request, METHOD_POST } = __nccwpck_require__(3537)
33968-
const { GithubActions } = __nccwpck_require__(7851)
33964+
const core = __nccwpck_require__(9093);
33965+
const axios = __nccwpck_require__(314);
33966+
const https = __nccwpck_require__(5687);
33967+
const { request, METHOD_POST } = __nccwpck_require__(3537);
33968+
const { GithubActions } = __nccwpck_require__(7851);
3396933969

33970-
const { createPersistHandler } = __nccwpck_require__(8403)
33971-
const { createOutputHandler } = __nccwpck_require__(8986)
33972-
const { createMaskHandler } = __nccwpck_require__(40)
33970+
const { createPersistHandler } = __nccwpck_require__(8403);
33971+
const { createOutputHandler } = __nccwpck_require__(8986);
33972+
const { createMaskHandler } = __nccwpck_require__(40);
3397333973

3397433974
let customHeaders = {}
3397533975

3397633976
if (!!core.getInput('customHeaders')) {
33977-
try {
33978-
customHeaders = JSON.parse(core.getInput('customHeaders'))
33979-
} catch (error) {
33980-
core.debug(
33981-
`Invalid customHeaders string: ${core.getInput('customHeaders')}`
33982-
)
33983-
core.error(`Could not parse customHeaders string value: ${error}`)
33984-
}
33977+
try {
33978+
customHeaders = JSON.parse(core.getInput('customHeaders'));
33979+
} catch(error) {
33980+
core.debug(`Invalid customHeaders string: ${core.getInput('customHeaders')}`)
33981+
core.error(`Could not parse customHeaders string value: ${error}`)
33982+
}
3398533983
}
3398633984

33987-
const headers = {
33988-
'Content-Type': core.getInput('contentType') || 'application/json',
33989-
}
33985+
const headers = { 'Content-Type': core.getInput('contentType') || 'application/json' }
3399033986

3399133987
if (!!core.getInput('bearerToken')) {
33992-
headers['Authorization'] = `Bearer ${core.getInput('bearerToken')}`
33988+
headers['Authorization'] = `Bearer ${core.getInput('bearerToken')}`;
3399333989
}
3399433990

3399533991
/** @type {axios.AxiosRequestConfig} */
3399633992
const instanceConfig = {
33997-
httpsAgent: new https.Agent({
33998-
rejectUnauthorized: core.getInput('ignoreSsl') !== 'true',
33999-
}),
34000-
baseURL: core.getInput('url', { required: true }),
34001-
timeout: parseInt(core.getInput('timeout') || 5000, 10),
34002-
headers: { ...headers, ...customHeaders },
33993+
httpsAgent: new https.Agent({
33994+
rejectUnauthorized: core.getInput('ignoreSsl') !== 'true',
33995+
}),
33996+
baseURL: core.getInput('url', { required: true }),
33997+
timeout: parseInt(core.getInput('timeout') || 5000, 10),
33998+
headers: { ...headers, ...customHeaders }
3400333999
}
3400434000

3400534001
if (!!core.getInput('httpsCA') || !!core.getInput('httpsCert')) {
34006-
instanceConfig.httpsAgent = new https.Agent({
34007-
ca: core.getInput('httpsCA') || undefined,
34008-
cert: core.getInput('httpsCert') || undefined,
34009-
key: core.getInput('httpsKey') || undefined,
34010-
})
34002+
instanceConfig.httpsAgent = new https.Agent({
34003+
ca: core.getInput('httpsCA') || undefined,
34004+
cert: core.getInput('httpsCert') || undefined,
34005+
key: core.getInput('httpsKey') || undefined
34006+
})
3401134007
}
3401234008

3401334009
if (!!core.getInput('username') || !!core.getInput('password')) {
34014-
core.debug('Add BasicHTTP Auth config')
34010+
core.debug('Add BasicHTTP Auth config')
3401534011

34016-
instanceConfig.auth = {
34017-
username: core.getInput('username'),
34018-
password: core.getInput('password'),
34019-
}
34012+
instanceConfig.auth = {
34013+
username: core.getInput('username'),
34014+
password: core.getInput('password')
34015+
}
3402034016
}
3402134017

3402234018
let retry = 0
3402334019
if (!!core.getInput('retry')) {
34024-
retry = parseInt(core.getInput('retry'))
34020+
retry = parseInt(core.getInput('retry'))
3402534021
}
3402634022

3402734023
let retryWait = 3000
3402834024
if (!!core.getInput('retryWait')) {
34029-
retryWait = parseInt(core.getInput('retryWait'))
34025+
retryWait = parseInt(core.getInput('retryWait'))
3403034026
}
3403134027

34032-
const data = core.getInput('data') || '{}'
34033-
const files = core.getInput('files') || '{}'
34028+
const data = core.getInput('data') || '{}';
34029+
const files = core.getInput('files') || '{}';
3403434030
const file = core.getInput('file')
3403534031
const responseFile = core.getInput('responseFile')
34036-
const method = core.getInput('method') || METHOD_POST
34037-
const preventFailureOnNoResponse =
34038-
core.getInput('preventFailureOnNoResponse') === 'true'
34039-
const escapeData = core.getInput('escapeData') === 'true'
34032+
const method = core.getInput('method') || METHOD_POST;
34033+
const preventFailureOnNoResponse = core.getInput('preventFailureOnNoResponse') === 'true';
34034+
const escapeData = core.getInput('escapeData') === 'true';
3404034035

34041-
const ignoreStatusCodes = core.getInput('ignoreStatusCodes')
34042-
let ignoredCodes = []
34036+
const ignoreStatusCodes = core.getInput('ignoreStatusCodes');
34037+
let ignoredCodes = [];
3404334038

3404434039
if (typeof ignoreStatusCodes === 'string' && ignoreStatusCodes.length > 0) {
34045-
ignoredCodes = ignoreStatusCodes
34046-
.split(',')
34047-
.map((statusCode) => parseInt(statusCode.trim()))
34040+
ignoredCodes = ignoreStatusCodes.split(',').map(statusCode => parseInt(statusCode.trim()))
3404834041
}
3404934042

34050-
const actions = new GithubActions()
34043+
const actions = new GithubActions();
3405134044

34052-
const handler = []
34045+
const handler = [];
3405334046

3405434047
if (core.getBooleanInput('maskResponse')) {
34055-
handler.push(createMaskHandler(actions))
34048+
handler.push(createMaskHandler(actions))
3405634049
}
3405734050

3405834051
handler.push(createOutputHandler(actions))
3405934052

3406034053
if (!!responseFile) {
34061-
handler.push(createPersistHandler(responseFile, actions))
34054+
handler.push(createPersistHandler(responseFile, actions))
3406234055
}
3406334056

3406434057
const options = {
34065-
ignoredCodes,
34066-
preventFailureOnNoResponse,
34067-
escapeData,
34068-
retry,
34069-
retryWait,
34058+
ignoredCodes,
34059+
preventFailureOnNoResponse,
34060+
escapeData,
34061+
retry,
34062+
retryWait
3407034063
}
3407134064

34072-
request({ data, method, instanceConfig, files, file, actions, options }).then(
34073-
(response) => {
34074-
if (response && typeof response == 'object') {
34075-
handler.forEach((h) => h(response))
34076-
}
34077-
}
34078-
)
34079-
34065+
request({ data, method, instanceConfig, files, file, actions, options }).then(response => {
34066+
if (response && typeof response == 'object') {
34067+
handler.forEach(h => h(response))
34068+
}
34069+
})
3408034070
})();
3408134071

3408234072
module.exports = __webpack_exports__;

src/index.js

+56-65
Original file line numberDiff line numberDiff line change
@@ -1,117 +1,108 @@
11
'use strict'
22

3-
const core = require('@actions/core')
4-
const axios = require('axios')
5-
const https = require('https')
6-
const { request, METHOD_POST } = require('./httpClient')
7-
const { GithubActions } = require('./githubActions')
3+
const core = require('@actions/core');
4+
const axios = require('axios');
5+
const https = require('https');
6+
const { request, METHOD_POST } = require('./httpClient');
7+
const { GithubActions } = require('./githubActions');
88

9-
const { createPersistHandler } = require('./handler/persist')
10-
const { createOutputHandler } = require('./handler/output')
11-
const { createMaskHandler } = require('./handler/mask')
9+
const { createPersistHandler } = require('./handler/persist');
10+
const { createOutputHandler } = require('./handler/output');
11+
const { createMaskHandler } = require('./handler/mask');
1212

1313
let customHeaders = {}
1414

1515
if (!!core.getInput('customHeaders')) {
16-
try {
17-
customHeaders = JSON.parse(core.getInput('customHeaders'))
18-
} catch (error) {
19-
core.debug(
20-
`Invalid customHeaders string: ${core.getInput('customHeaders')}`
21-
)
22-
core.error(`Could not parse customHeaders string value: ${error}`)
23-
}
16+
try {
17+
customHeaders = JSON.parse(core.getInput('customHeaders'));
18+
} catch(error) {
19+
core.debug(`Invalid customHeaders string: ${core.getInput('customHeaders')}`)
20+
core.error(`Could not parse customHeaders string value: ${error}`)
21+
}
2422
}
2523

26-
const headers = {
27-
'Content-Type': core.getInput('contentType') || 'application/json',
28-
}
24+
const headers = { 'Content-Type': core.getInput('contentType') || 'application/json' }
2925

3026
if (!!core.getInput('bearerToken')) {
31-
headers['Authorization'] = `Bearer ${core.getInput('bearerToken')}`
27+
headers['Authorization'] = `Bearer ${core.getInput('bearerToken')}`;
3228
}
3329

3430
/** @type {axios.AxiosRequestConfig} */
3531
const instanceConfig = {
36-
httpsAgent: new https.Agent({
37-
rejectUnauthorized: core.getInput('ignoreSsl') !== 'true',
38-
}),
39-
baseURL: core.getInput('url', { required: true }),
40-
timeout: parseInt(core.getInput('timeout') || 5000, 10),
41-
headers: { ...headers, ...customHeaders },
32+
httpsAgent: new https.Agent({
33+
rejectUnauthorized: core.getInput('ignoreSsl') !== 'true',
34+
}),
35+
baseURL: core.getInput('url', { required: true }),
36+
timeout: parseInt(core.getInput('timeout') || 5000, 10),
37+
headers: { ...headers, ...customHeaders }
4238
}
4339

4440
if (!!core.getInput('httpsCA') || !!core.getInput('httpsCert')) {
45-
instanceConfig.httpsAgent = new https.Agent({
46-
ca: core.getInput('httpsCA') || undefined,
47-
cert: core.getInput('httpsCert') || undefined,
48-
key: core.getInput('httpsKey') || undefined,
49-
})
41+
instanceConfig.httpsAgent = new https.Agent({
42+
ca: core.getInput('httpsCA') || undefined,
43+
cert: core.getInput('httpsCert') || undefined,
44+
key: core.getInput('httpsKey') || undefined
45+
})
5046
}
5147

5248
if (!!core.getInput('username') || !!core.getInput('password')) {
53-
core.debug('Add BasicHTTP Auth config')
49+
core.debug('Add BasicHTTP Auth config')
5450

55-
instanceConfig.auth = {
56-
username: core.getInput('username'),
57-
password: core.getInput('password'),
58-
}
51+
instanceConfig.auth = {
52+
username: core.getInput('username'),
53+
password: core.getInput('password')
54+
}
5955
}
6056

6157
let retry = 0
6258
if (!!core.getInput('retry')) {
63-
retry = parseInt(core.getInput('retry'))
59+
retry = parseInt(core.getInput('retry'))
6460
}
6561

6662
let retryWait = 3000
6763
if (!!core.getInput('retryWait')) {
68-
retryWait = parseInt(core.getInput('retryWait'))
64+
retryWait = parseInt(core.getInput('retryWait'))
6965
}
7066

71-
const data = core.getInput('data') || '{}'
72-
const files = core.getInput('files') || '{}'
67+
const data = core.getInput('data') || '{}';
68+
const files = core.getInput('files') || '{}';
7369
const file = core.getInput('file')
7470
const responseFile = core.getInput('responseFile')
75-
const method = core.getInput('method') || METHOD_POST
76-
const preventFailureOnNoResponse =
77-
core.getInput('preventFailureOnNoResponse') === 'true'
78-
const escapeData = core.getInput('escapeData') === 'true'
71+
const method = core.getInput('method') || METHOD_POST;
72+
const preventFailureOnNoResponse = core.getInput('preventFailureOnNoResponse') === 'true';
73+
const escapeData = core.getInput('escapeData') === 'true';
7974

80-
const ignoreStatusCodes = core.getInput('ignoreStatusCodes')
81-
let ignoredCodes = []
75+
const ignoreStatusCodes = core.getInput('ignoreStatusCodes');
76+
let ignoredCodes = [];
8277

8378
if (typeof ignoreStatusCodes === 'string' && ignoreStatusCodes.length > 0) {
84-
ignoredCodes = ignoreStatusCodes
85-
.split(',')
86-
.map((statusCode) => parseInt(statusCode.trim()))
79+
ignoredCodes = ignoreStatusCodes.split(',').map(statusCode => parseInt(statusCode.trim()))
8780
}
8881

89-
const actions = new GithubActions()
82+
const actions = new GithubActions();
9083

91-
const handler = []
84+
const handler = [];
9285

9386
if (core.getBooleanInput('maskResponse')) {
94-
handler.push(createMaskHandler(actions))
87+
handler.push(createMaskHandler(actions))
9588
}
9689

9790
handler.push(createOutputHandler(actions))
9891

9992
if (!!responseFile) {
100-
handler.push(createPersistHandler(responseFile, actions))
93+
handler.push(createPersistHandler(responseFile, actions))
10194
}
10295

10396
const options = {
104-
ignoredCodes,
105-
preventFailureOnNoResponse,
106-
escapeData,
107-
retry,
108-
retryWait,
97+
ignoredCodes,
98+
preventFailureOnNoResponse,
99+
escapeData,
100+
retry,
101+
retryWait
109102
}
110103

111-
request({ data, method, instanceConfig, files, file, actions, options }).then(
112-
(response) => {
113-
if (response && typeof response == 'object') {
114-
handler.forEach((h) => h(response))
115-
}
116-
}
117-
)
104+
request({ data, method, instanceConfig, files, file, actions, options }).then(response => {
105+
if (response && typeof response == 'object') {
106+
handler.forEach(h => h(response))
107+
}
108+
})

0 commit comments

Comments
 (0)