From ce002a6cc672d1e13cc3d3470add78781d1ef20e Mon Sep 17 00:00:00 2001 From: Jon Date: Fri, 17 Nov 2023 13:07:33 +0000 Subject: [PATCH] fix(GitHub Node): Fix issue preventing file edits on branches (#7734) Github issue / Community forum post (link here to close automatically): https://github.com/n8n-io/n8n/issues/7614 --- packages/nodes-base/nodes/Github/GenericFunctions.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/nodes-base/nodes/Github/GenericFunctions.ts b/packages/nodes-base/nodes/Github/GenericFunctions.ts index 348647b12d..12672ab212 100644 --- a/packages/nodes-base/nodes/Github/GenericFunctions.ts +++ b/packages/nodes-base/nodes/Github/GenericFunctions.ts @@ -76,12 +76,13 @@ export async function getFileSha( filePath: string, branch?: string, ): Promise { - const getBody: IDataObject = {}; + const query: IDataObject = {}; if (branch !== undefined) { - getBody.branch = branch; + query.ref = branch; } + const getEndpoint = `/repos/${owner}/${repository}/contents/${encodeURI(filePath)}`; - const responseData = await githubApiRequest.call(this, 'GET', getEndpoint, getBody, {}); + const responseData = await githubApiRequest.call(this, 'GET', getEndpoint, {}, query); if (responseData.sha === undefined) { throw new NodeOperationError(this.getNode(), 'Could not get the SHA of the file.');