Skip to content

Commit f51968f

Browse files
DEF0468024: we are unable to log response for Github servicenow task'sto the console log (#5)
1 parent 7eb9506 commit f51968f

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

dist/index.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5188,9 +5188,10 @@ var __webpack_exports__ = {};
51885188
const core = __nccwpck_require__(6024);
51895189
const axios = __nccwpck_require__(992);
51905190

5191-
function circularSafeStringify(obj) {
5191+
function circularSafeStringify(obj) {
51925192
const seen = new WeakSet();
51935193
return JSON.stringify(obj, (key, value) => {
5194+
if (key === '_sessionCache') return undefined;
51945195
if (typeof value === 'object' && value !== null) {
51955196
if (seen.has(value)) {
51965197
return '[Circular]';
@@ -5264,7 +5265,7 @@ function circularSafeStringify(obj) {
52645265
httpHeaders = { headers: defaultHeadersForToken };
52655266
core.debug("[ServiceNow DevOps], Sending Request for Artifact Registration, Request options :"+JSON.stringify(httpHeaders)+", Payload :"+JSON.stringify(payload)+"\n");
52665267
snowResponse = await axios.post(endpoint, JSON.stringify(payload), httpHeaders);
5267-
core.debug("[ServiceNow DevOps], Receiving response for Artifact Registration, Response :"+snowResponse+"\n");
5268+
core.debug("[ServiceNow DevOps], Receiving response for Artifact Registration, Response :"+circularSafeStringify(snowResponse)+"\n");
52685269
}
52695270
else if(username !== '' && password !== '') {
52705271
endpoint = `${instanceUrl}/api/sn_devops/v1/devops/artifact/registration?orchestrationToolId=${toolId}`;
@@ -5279,7 +5280,7 @@ function circularSafeStringify(obj) {
52795280
httpHeaders = { headers: defaultHeadersForBasicAuth };
52805281
core.debug("[ServiceNow DevOps], Sending Request for Artifact Registration, Request options :"+JSON.stringify(httpHeaders)+", Payload :"+JSON.stringify(payload)+"\n");
52815282
snowResponse = await axios.post(endpoint, JSON.stringify(payload), httpHeaders);
5282-
core.debug("[ServiceNow DevOps], Receiving response for Artifact Registration, Response :"+snowResponse+"\n");
5283+
core.debug("[ServiceNow DevOps], Receiving response for Artifact Registration, Response :"+circularSafeStringify(snowResponse)+"\n");
52835284
}
52845285
else {
52855286
core.setFailed("For Basic Auth, Username and Password is mandatory for integration user authentication");

src/main.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ const axios = require('axios');
44
function circularSafeStringify(obj) {
55
const seen = new WeakSet();
66
return JSON.stringify(obj, (key, value) => {
7+
if (key === '_sessionCache') return undefined;
78
if (typeof value === 'object' && value !== null) {
89
if (seen.has(value)) {
910
return '[Circular]';
@@ -77,7 +78,7 @@ function circularSafeStringify(obj) {
7778
httpHeaders = { headers: defaultHeadersForToken };
7879
core.debug("[ServiceNow DevOps], Sending Request for Artifact Registration, Request options :"+JSON.stringify(httpHeaders)+", Payload :"+JSON.stringify(payload)+"\n");
7980
snowResponse = await axios.post(endpoint, JSON.stringify(payload), httpHeaders);
80-
core.debug("[ServiceNow DevOps], Receiving response for Artifact Registration, Response :"+snowResponse+"\n");
81+
core.debug("[ServiceNow DevOps], Receiving response for Artifact Registration, Response :"+circularSafeStringify(snowResponse)+"\n");
8182
}
8283
else if(username !== '' && password !== '') {
8384
endpoint = `${instanceUrl}/api/sn_devops/v1/devops/artifact/registration?orchestrationToolId=${toolId}`;
@@ -92,7 +93,7 @@ function circularSafeStringify(obj) {
9293
httpHeaders = { headers: defaultHeadersForBasicAuth };
9394
core.debug("[ServiceNow DevOps], Sending Request for Artifact Registration, Request options :"+JSON.stringify(httpHeaders)+", Payload :"+JSON.stringify(payload)+"\n");
9495
snowResponse = await axios.post(endpoint, JSON.stringify(payload), httpHeaders);
95-
core.debug("[ServiceNow DevOps], Receiving response for Artifact Registration, Response :"+snowResponse+"\n");
96+
core.debug("[ServiceNow DevOps], Receiving response for Artifact Registration, Response :"+circularSafeStringify(snowResponse)+"\n");
9697
}
9798
else {
9899
core.setFailed("For Basic Auth, Username and Password is mandatory for integration user authentication");

0 commit comments

Comments
 (0)