From 36bba202e3e4d9fca788c2df6cf5fd313f0a823f Mon Sep 17 00:00:00 2001 From: Peter Evans <18365890+peter-evans@users.noreply.github.com> Date: Fri, 26 Jul 2024 13:03:14 +0000 Subject: [PATCH] debug payload without contents --- dist/index.js | 18 +++++++++++++++++- src/create-pull-request.ts | 15 +++++++++++++-- 2 files changed, 30 insertions(+), 3 deletions(-) diff --git a/dist/index.js b/dist/index.js index db50522..0c3e948 100644 --- a/dist/index.js +++ b/dist/index.js @@ -313,6 +313,17 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; +var __rest = (this && this.__rest) || function (s, e) { + var t = {}; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) + t[p] = s[p]; + if (s != null && typeof Object.getOwnPropertySymbols === "function") + for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { + if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) + t[p[i]] = s[p[i]]; + } + return t; +}; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.createPullRequest = createPullRequest; const core = __importStar(__nccwpck_require__(2186)); @@ -325,6 +336,7 @@ const git_config_helper_1 = __nccwpck_require__(8384); const utils = __importStar(__nccwpck_require__(918)); function createPullRequest(inputs) { return __awaiter(this, void 0, void 0, function* () { + var _a; let gitConfigHelper, git; try { core.startGroup('Prepare git configuration'); @@ -574,7 +586,11 @@ function createPullRequest(inputs) { commitMessage: inputs.commitMessage, fileChanges: fileChanges }; - core.info(`Push commit with payload: '${JSON.stringify(pushCommitVars)}'`); + const pushCommitVarsWithoutContents = Object.assign(Object.assign({}, pushCommitVars), { fileChanges: Object.assign(Object.assign({}, pushCommitVars.fileChanges), { additions: (_a = pushCommitVars.fileChanges.additions) === null || _a === void 0 ? void 0 : _a.map(addition => { + const { contents } = addition, rest = __rest(addition, ["contents"]); + return rest; + }) }) }); + core.debug(`Push commit with payload: '${JSON.stringify(pushCommitVarsWithoutContents)}'`); const commit = yield graphqlWithAuth(pushCommitMutation, pushCommitVars); core.debug(`Pushed commit - '${JSON.stringify(commit)}'`); core.info(`Pushed commit with hash - '${commit.createCommitOnBranch.commit.oid}' on branch - '${commit.createCommitOnBranch.ref.name}'`); diff --git a/src/create-pull-request.ts b/src/create-pull-request.ts index 041e2ba..67eaff4 100644 --- a/src/create-pull-request.ts +++ b/src/create-pull-request.ts @@ -379,8 +379,19 @@ export async function createPullRequest(inputs: Inputs): Promise { fileChanges: fileChanges } - core.info( - `Push commit with payload: '${JSON.stringify(pushCommitVars)}'` + const pushCommitVarsWithoutContents = { + ...pushCommitVars, + fileChanges: { + ...pushCommitVars.fileChanges, + additions: pushCommitVars.fileChanges.additions?.map(addition => { + const {contents, ...rest} = addition + return rest + }) + } + } + + core.debug( + `Push commit with payload: '${JSON.stringify(pushCommitVarsWithoutContents)}'` ) const commit = await graphqlWithAuth<{