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

Method commit

packages/decap-cms-backend-git-gateway/src/GitHubAPI.ts:97–120  ·  view source on GitHub ↗
(message: string, changeTree: { parentSha?: string; sha: string })

Source from the content-addressed store, hash-verified

95 }
96
97 commit(message: string, changeTree: { parentSha?: string; sha: string }) {
98 const commitParams: {
99 message: string;
100 tree: string;
101 parents: string[];
102 author?: { name: string; date: string };
103 } = {
104 message,
105 tree: changeTree.sha,
106 parents: changeTree.parentSha ? [changeTree.parentSha] : [],
107 };
108
109 if (this.commitAuthor) {
110 commitParams.author = {
111 ...this.commitAuthor,
112 date: new Date().toISOString(),
113 };
114 }
115
116 return this.request('/git/commits', {
117 method: 'POST',
118 body: JSON.stringify(commitParams),
119 });
120 }
121
122 nextUrlProcessor() {
123 return (url: string) => url.replace(/^(?:[a-z]+:\/\/.+?\/.+?\/.+?\/)/, `${this.apiRoot}/`);

Callers

nothing calls this directly

Calls 1

requestMethod · 0.95

Tested by

no test coverage detected