Skip to content

Commit

Permalink
Add upload button (#367)
Browse files Browse the repository at this point in the history
* add upload button

* comments

* add some upload checks

* fix "file insufficient" bug

* clarify comment

* move empty file error to top
  • Loading branch information
vincerubinetti authored Mar 12, 2024
1 parent c55ee93 commit e84f7b3
Show file tree
Hide file tree
Showing 12 changed files with 594 additions and 472 deletions.
7 changes: 4 additions & 3 deletions app/create-pr.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ async function createPr(params, debug = false) {
if (!title) missing.push("title");
if (!body) missing.push("body");
if (!files.length) missing.push("files");
files.forEach(({ path, content }, index) => {
if (!path || !content) missing.push(`file ${index}`);
});
if (missing.length) throw Error(`Insufficient ${missing.join(", ")}`);

/** get main branch */
Expand Down Expand Up @@ -70,9 +73,7 @@ async function createPr(params, debug = false) {
}

/** update files */
for (const [index, { path, content }] of Object.entries(files)) {
if (!path || !content) throw Error(`File ${index} insufficient`);

for (const { path, content } of files) {
/** get existing file */
let existing;
try {
Expand Down
Loading

0 comments on commit e84f7b3

Please sign in to comment.