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

Class GitHub

packages/decap-cms-backend-github/src/implementation.tsx:65–955  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

63};
64
65export default class GitHub implements Implementation {
66 lock: AsyncLock;
67 api: API | null;
68 options: {
69 proxied: boolean;
70 API: API | null;
71 useWorkflow?: boolean;
72 initialWorkflowStatus: string;
73 };
74 originRepo: string;
75 isBranchConfigured: boolean;
76 repo?: string;
77 openAuthoringEnabled: boolean;
78 useOpenAuthoring?: boolean;
79 alwaysForkEnabled: boolean;
80 branch: string;
81 apiRoot: string;
82 mediaFolder: string;
83 previewContext: string;
84 token: string | null;
85 tokenKeyword: string;
86 squashMerges: boolean;
87 cmsLabelPrefix: string;
88 useGraphql: boolean;
89 baseUrl?: string;
90 bypassWriteAccessCheckForAppTokens = false;
91 _currentUserPromise?: Promise<GitHubUser>;
92 _userIsOriginMaintainerPromises?: {
93 [key: string]: Promise<boolean>;
94 };
95 _mediaDisplayURLSem?: Semaphore;
96 pollingManager?: NotesPollingManager;
97 unwatchFunctions: Map<string, () => void> = new Map();
98
99 constructor(config: Config, options = {}) {
100 this.options = {
101 proxied: false,
102 API: null,
103 initialWorkflowStatus: '',
104 ...options,
105 };
106
107 if (
108 !this.options.proxied &&
109 (config.backend.repo === null || config.backend.repo === undefined)
110 ) {
111 throw new Error('The GitHub backend needs a "repo" in the backend configuration.');
112 }
113
114 this.api = this.options.API || null;
115 this.isBranchConfigured = config.backend.branch ? true : false;
116 this.openAuthoringEnabled = config.backend.open_authoring || false;
117 if (this.openAuthoringEnabled) {
118 if (!this.options.useWorkflow) {
119 throw new Error(
120 'backend.open_authoring is true but publish_mode is not set to editorial_workflow.',
121 );
122 }

Callers

nothing calls this directly

Calls 1

createMethod · 0.80

Tested by

no test coverage detected