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

Method uploadAndCommit

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

Source from the content-addressed store, hash-verified

425 }
426
427 async uploadAndCommit(
428 items: AzureCommitItem[],
429 comment: string,
430 branch: string,
431 newBranch: boolean,
432 ) {
433 const ref = await this.getRef(newBranch ? this.branch : branch);
434
435 const refUpdate = [
436 {
437 name: this.branchToRef(branch),
438 oldObjectId: ref.objectId,
439 },
440 ];
441
442 const changes = items.map(item => getChangeItem(item));
443 const commits = [{ comment, changes }];
444 const push = {
445 refUpdates: refUpdate,
446 commits,
447 };
448
449 return this.requestJSON({
450 url: `${this.endpointUrl}/pushes`,
451 method: 'POST',
452 body: JSON.stringify(push),
453 });
454 }
455
456 async retrieveUnpublishedEntryData(contentKey: string) {
457 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