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
This commit is contained in:
Jon 2023-11-17 13:07:33 +00:00 committed by GitHub
parent db094f2d7e
commit ce002a6cc6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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.');