MCPcopy
hub / github.com/leonhartX/gas-github / commitFiles

Method commitFiles

src/scm/bitbucket.js:50–80  ·  view source on GitHub ↗
(repo, branch, parent, files, deleteFiles, comment)

Source from the content-addressed store, hash-verified

48 }
49
50 commitFiles(repo, branch, parent, files, deleteFiles, comment) {
51 return new Promise((resolve, reject) => {
52 let data = files.reduce((hash, f) => {
53 hash[f.name] = f.content;
54 return hash;
55 }, {});
56 data.message = comment;
57 if (deleteFiles && deleteFiles.length > 0) {
58 data.files = deleteFiles;
59 }
60 if (branch) {
61 data.branch = branch;
62 }
63 if (parent) {
64 data.parents = parent;
65 }
66 $.ajax({
67 url: `${this.baseUrl}/repositories/${repo}/src`,
68 headers: {
69 'Authorization': `Bearer ${this.accessToken}`
70 },
71 contentType: 'application/x-www-form-urlencoded',
72 method: 'POST',
73 crossDomain: true,
74 traditional: true,
75 data: data,
76 })
77 .then(resolve)
78 .fail(reject);
79 });
80 }
81
82 push(code) {
83 const changed = $('.diff-file:checked').toArray().map(elem => elem.value);

Callers 3

pushMethod · 0.95
createRepoMethod · 0.95
createBranchMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected