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

Class GitHub

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

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 1

createMethod · 0.80

Tested by

no test coverage detected