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

Method editorialWorkflowGit

packages/decap-cms-backend-azure/src/API.ts:687–710  ·  view source on GitHub ↗
(
    files: (DataFile | AssetProxy)[],
    slug: string,
    options: PersistOptions,
  )

Source from the content-addressed store, hash-verified

685 }
686
687 async editorialWorkflowGit(
688 files: (DataFile | AssetProxy)[],
689 slug: string,
690 options: PersistOptions,
691 ) {
692 const contentKey = generateContentKey(options.collectionName as string, slug);
693 const branch = branchFromContentKey(contentKey);
694 const unpublished = options.unpublished || false;
695 const subfolders = options.hasSubfolders !== false; // default to true
696
697 if (!unpublished) {
698 const items = await this.getCommitItems(files, this.branch, subfolders);
699
700 await this.uploadAndCommit(items, options.commitMessage, branch, true);
701 await this.createPullRequest(
702 branch,
703 options.commitMessage,
704 options.status || this.initialWorkflowStatus,
705 );
706 } else {
707 const items = await this.getCommitItems(files, branch, subfolders);
708 await this.uploadAndCommit(items, options.commitMessage, branch, false);
709 }
710 }
711
712 async updateUnpublishedEntryStatus(collection: string, slug: string, newStatus: string) {
713 const contentKey = generateContentKey(collection, slug);

Callers 1

persistFilesMethod · 0.95

Calls 5

getCommitItemsMethod · 0.95
uploadAndCommitMethod · 0.95
createPullRequestMethod · 0.95
generateContentKeyFunction · 0.90
branchFromContentKeyFunction · 0.90

Tested by

no test coverage detected