Skip to content

Commit

Permalink
fix(GitHub Node): Fix issue preventing file edits on branches (#7734)
Browse files Browse the repository at this point in the history
Github issue / Community forum post (link here to close automatically):
#7614
  • Loading branch information
Joffcom committed Nov 17, 2023
1 parent db094f2 commit ce002a6
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions packages/nodes-base/nodes/Github/GenericFunctions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,13 @@ export async function getFileSha(
filePath: string,
branch?: string,
): Promise<any> {
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.');
Expand Down

0 comments on commit ce002a6

Please sign in to comment.