MCPcopy Create free account
hub / github.com/decaporg/decap-cms / uploadAndCommit

Method uploadAndCommit

packages/decap-cms-backend-azure/src/API.ts:421–448  ·  view source on GitHub ↗
(
    items: AzureCommitItem[],
    comment: string,
    branch: string,
    newBranch: boolean,
  )

Source from the content-addressed store, hash-verified

419 }
420
421 async uploadAndCommit(
422 items: AzureCommitItem[],
423 comment: string,
424 branch: string,
425 newBranch: boolean,
426 ) {
427 const ref = await this.getRef(newBranch ? this.branch : branch);
428
429 const refUpdate = [
430 {
431 name: this.branchToRef(branch),
432 oldObjectId: ref.objectId,
433 },
434 ];
435
436 const changes = items.map(item => getChangeItem(item));
437 const commits = [{ comment, changes }];
438 const push = {
439 refUpdates: refUpdate,
440 commits,
441 };
442
443 return this.requestJSON({
444 url: `${this.endpointUrl}/pushes`,
445 method: 'POST',
446 body: JSON.stringify(push),
447 });
448 }
449
450 async retrieveUnpublishedEntryData(contentKey: string) {
451 const { collection, slug } = parseContentKey(contentKey);

Callers 2

persistFilesMethod · 0.95
editorialWorkflowGitMethod · 0.95

Calls 3

getRefMethod · 0.95
getChangeItemFunction · 0.85
mapMethod · 0.80

Tested by

no test coverage detected