(
files: (DataFile | AssetProxy)[],
slug: string,
options: PersistOptions,
)
| 879 | } |
| 880 | |
| 881 | async editorialWorkflowGit( |
| 882 | files: (DataFile | AssetProxy)[], |
| 883 | slug: string, |
| 884 | options: PersistOptions, |
| 885 | ) { |
| 886 | const contentKey = generateContentKey(options.collectionName as string, slug); |
| 887 | const branch = branchFromContentKey(contentKey); |
| 888 | const unpublished = options.unpublished || false; |
| 889 | const hasSubfolders = options.hasSubfolders !== false; // default to true |
| 890 | if (!unpublished) { |
| 891 | const items = await this.getCommitItems(files, this.branch, hasSubfolders); |
| 892 | await this.uploadAndCommit(items, { |
| 893 | commitMessage: options.commitMessage, |
| 894 | branch, |
| 895 | newBranch: true, |
| 896 | }); |
| 897 | await this.createMergeRequest( |
| 898 | branch, |
| 899 | options.commitMessage, |
| 900 | options.status || this.initialWorkflowStatus, |
| 901 | ); |
| 902 | } else { |
| 903 | const mergeRequest = await this.getBranchMergeRequest(branch); |
| 904 | await this.rebaseMergeRequest(mergeRequest); |
| 905 | const [items, diffs] = await Promise.all([ |
| 906 | this.getCommitItems(files, branch, hasSubfolders), |
| 907 | this.getDifferences(branch), |
| 908 | ]); |
| 909 | // mark files for deletion |
| 910 | for (const diff of diffs.filter(d => d.binary)) { |
| 911 | if (!items.some(item => item.path === diff.path)) { |
| 912 | items.push({ action: CommitAction.DELETE, path: diff.newPath }); |
| 913 | } |
| 914 | } |
| 915 | |
| 916 | await this.uploadAndCommit(items, { |
| 917 | commitMessage: options.commitMessage, |
| 918 | branch, |
| 919 | }); |
| 920 | } |
| 921 | } |
| 922 | |
| 923 | async updateMergeRequestLabels(mergeRequest: GitLabMergeRequest, labels: string[]) { |
| 924 | await this.requestJSON({ |
no test coverage detected