Skip to content

Commit

Permalink
fix: fix error with pullrequest & workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
Mara-Li committed May 27, 2022
1 parent ec8a367 commit af3e25b
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 10 deletions.
1 change: 1 addition & 0 deletions mkdocsPublisher/githubInteraction/branch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,5 +77,6 @@ export class GithubBranch {
// @ts-ignore
await this.mergePullRequest(branchName, true, pullRequest.data.number);
await this.deleteBranch(branchName);
return true
}
}
32 changes: 24 additions & 8 deletions mkdocsPublisher/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,10 @@ export default class MkdocsPublication extends Plugin {
const publishSuccess =
await publish.publish(file, true, branchName);
if (publishSuccess) {
await noticeMessage(publish, file, this.settings)
await githubBranch.updateRepository(branchName);
const update=await githubBranch.updateRepository(branchName);
if (update) {
await noticeMessage(publish, file, this.settings)
}
}

} catch (e) {
Expand Down Expand Up @@ -93,8 +95,13 @@ export default class MkdocsPublication extends Plugin {
const publishSuccess =
await publish.publish(view.file, true, branchName);
if (publishSuccess) {
await noticeMessage(publish, view.file, this.settings);
await githubBranch.updateRepository(branchName);
const update = await githubBranch.updateRepository(branchName);
if (update) {
await noticeMessage(publish, view.file, this.settings);
} else {
new Notice("Error publishing to " + this.settings.githubRepo + ".");

}
}
} catch (e) {
console.error(e);
Expand Down Expand Up @@ -132,8 +139,12 @@ export default class MkdocsPublication extends Plugin {
branchName
);
if (publishSuccess) {
noticeMessage(publish, currentFile, this.settings);
githubBranch.updateRepository(branchName);
const update = githubBranch.updateRepository(branchName);
if (update) {
noticeMessage(publish, currentFile, this.settings);
} else {
new Notice("Error publishing to " + this.settings.githubRepo + ".");
}

}
} catch (e) {
Expand Down Expand Up @@ -215,9 +226,14 @@ export default class MkdocsPublication extends Plugin {
}
statusBar.finish(8000);
const noticeValue = `${publishedFiles.length - errorCount} notes`
await noticeMessage(publish, noticeValue, this.settings)
await deleteFromGithub(true, this.settings, octokit, branchName, shareFiles);
await githubBranch.updateRepository(branchName);
const update=await githubBranch.updateRepository(branchName);
if (update) {
await noticeMessage(publish, noticeValue, this.settings)
} else {
new Notice("Error publishing to " + this.settings.githubRepo + ".");

}
}
} catch (e) {
// statusBarItems.remove();
Expand Down
3 changes: 1 addition & 2 deletions mkdocsPublisher/utils/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ import {
Notice
} from 'obsidian'
import { MkdocsPublicationSettings } from '../settings/interface'
import MkdocsPublish from "../githubInteraction/getFiles";

import MkdocsPublish from "../githubInteraction/upload";

function disablePublish (app: App, settings: MkdocsPublicationSettings, file:TFile) {
const fileCache = app.metadataCache.getFileCache(file)
Expand Down

0 comments on commit af3e25b

Please sign in to comment.