@teleporthq/teleport-github-gateway 0.19.10 → 0.19.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,5 @@
1
- // @ts-ignore
2
- import Github from 'github-api'
3
1
  import fetch from 'cross-fetch'
2
+ import { Octokit } from 'octokit'
4
3
 
5
4
  import { ServiceAuth } from '@teleporthq/teleport-types'
6
5
 
@@ -12,23 +11,22 @@ import {
12
11
  } from './constants'
13
12
 
14
13
  import {
15
- RepositoryContentResponse,
16
14
  GithubFileMeta,
17
15
  GithubRepositoryData,
18
16
  NewRepository,
19
- GithubRepository,
20
17
  GithubCommitMeta,
21
18
  RepositoryIdentity,
22
19
  GithubFile,
23
20
  RepositoryCommitsListMeta,
24
21
  RepositoryCommitMeta,
25
22
  CreateBranchMeta,
23
+ RepositoryMergeMeta,
24
+ RemoveBranchMeta,
26
25
  } from './types'
27
26
  import { createBase64GithubFileBlob } from './utils'
28
27
 
29
28
  export default class GithubInstance {
30
- // @ts-ignore
31
- private githubApi = null
29
+ private octokit: Octokit | null = null
32
30
  private auth: ServiceAuth = null
33
31
 
34
32
  constructor(auth: ServiceAuth = {}) {
@@ -39,59 +37,77 @@ export default class GithubInstance {
39
37
  this.auth = auth
40
38
 
41
39
  if (auth.basic) {
42
- this.githubApi = new Github({ ...auth.basic })
40
+ this.octokit = new Octokit({ auth: auth.basic })
41
+
43
42
  return
44
43
  }
45
44
 
46
45
  if (auth.token) {
47
- this.githubApi = new Github({ token: auth.token })
46
+ this.octokit = new Octokit({ auth: auth.token })
48
47
  return
49
48
  }
50
49
 
51
- this.githubApi = new Github()
50
+ this.octokit = new Octokit()
52
51
  }
53
52
 
54
53
  public async getRepoContent(
55
54
  repoIdentity: RepositoryIdentity
56
- ): Promise<RepositoryContentResponse> {
57
- const { username, repo, ref = DEFAULT_REF, path = DEFAULT_PATH } = repoIdentity
55
+ ): Promise<GithubFile | GithubFile[]> {
56
+ const { owner: username, repo, ref = DEFAULT_REF, path = DEFAULT_PATH } = repoIdentity
58
57
 
59
- const repository = await this.githubApi.getRepo(username, repo)
60
- return repository.getContents(ref, path)
58
+ const content = await this.octokit.rest.repos.getContent({ owner: username, repo, ref, path })
59
+ return content.data as GithubFile | GithubFile[]
61
60
  }
62
61
 
63
- public async getUserRepositories(username: string): Promise<GithubRepositoryData[]> {
64
- const user = await this.githubApi.getUser(username)
65
- const { data } = await user.listRepos()
66
- return data
62
+ public async getUserRepositories(): Promise<GithubRepositoryData[]> {
63
+ let page = 1
64
+ const allRepos = []
65
+ let currentPageRepos = await this.octokit.rest.repos.listForAuthenticatedUser({
66
+ page,
67
+ per_page: 50,
68
+ })
69
+
70
+ while (currentPageRepos.data.length) {
71
+ page++
72
+ allRepos.push(...currentPageRepos.data)
73
+ currentPageRepos = await this.octokit.rest.repos.listForAuthenticatedUser({
74
+ page,
75
+ per_page: 50,
76
+ })
77
+ }
78
+
79
+ return allRepos as GithubRepositoryData[]
67
80
  }
68
81
 
69
82
  public async createBranch(meta: CreateBranchMeta) {
70
83
  const { repo, owner, sourceBranch, newBranch } = meta
71
- const repository = await this.githubApi.getRepo(owner, repo)
72
- if (!repository) {
73
- throw new Error('Repository does not exist')
74
- }
84
+ const ref = await this.octokit.rest.git.getRef({ owner, repo, ref: `heads/${sourceBranch}` })
75
85
 
76
- return repository.createBranch(sourceBranch, newBranch)
86
+ const { data } = await this.octokit.rest.git.createRef({
87
+ owner,
88
+ repo,
89
+ ref: `refs/heads/${newBranch}`,
90
+ sha: ref.data.object.sha,
91
+ })
92
+
93
+ return data
77
94
  }
78
95
 
79
96
  public async createRepository(repository: NewRepository): Promise<GithubRepositoryData> {
80
- const { username, meta } = repository
81
- const user = await this.githubApi.getUser(username)
97
+ const { meta } = repository
82
98
 
83
99
  // Auto initialize repository by creating an initial commit with empty README
84
100
  if (typeof meta.auto_init === 'undefined' || meta.auto_init === null) {
85
101
  meta.auto_init = true
86
102
  }
87
103
 
88
- const { data } = await user.createRepo(meta)
89
- return data
104
+ const result = await this.octokit.rest.repos.createForAuthenticatedUser(meta)
105
+ return result.data as GithubRepositoryData
90
106
  }
91
107
 
92
108
  public async getRepositoryCommits(meta: RepositoryCommitsListMeta) {
93
109
  const { owner, repo } = meta
94
- const repository = await this.githubApi.getRepo(owner, repo)
110
+ const repository = await this.octokit.rest.repos.get({ owner, repo })
95
111
  if (!repository) {
96
112
  throw new Error('Repository does not exist')
97
113
  }
@@ -101,42 +117,89 @@ export default class GithubInstance {
101
117
  per_page: meta.perPage ?? undefined,
102
118
  }
103
119
 
104
- return repository.listCommits(params)
120
+ const commits = await this.octokit.rest.repos.listCommits(params)
121
+ return commits.data
122
+ }
123
+
124
+ public async mergeRepositoryBranches(meta: RepositoryMergeMeta) {
125
+ const { owner, repo } = meta
126
+ const repository = await this.octokit.rest.repos.get({ owner, repo })
127
+
128
+ if (!repository) {
129
+ throw new Error('Repository does not exist')
130
+ }
131
+
132
+ const { base, head } = meta
133
+ const mergeResult = await this.octokit.rest.repos.merge({ owner, repo, base, head })
134
+ return mergeResult.data
135
+ }
136
+
137
+ public async deleteBranch(meta: RemoveBranchMeta) {
138
+ const { owner, repo } = meta
139
+ const repository = await this.octokit.rest.repos.get({ owner, repo })
140
+
141
+ if (!repository) {
142
+ throw new Error('Repository does not exist')
143
+ }
144
+
145
+ const removeResult = await this.octokit.rest.git.deleteRef({
146
+ owner,
147
+ repo,
148
+ ref: `heads/${meta.branch}`,
149
+ })
150
+ return removeResult.status
105
151
  }
106
152
 
107
153
  public async getCommitData(meta: RepositoryCommitMeta) {
108
154
  const { owner, repo, ref } = meta
109
- const repository = await this.githubApi.getRepo(owner, repo)
155
+ const repository = await this.octokit.rest.repos.get({ owner, repo })
110
156
  if (!repository) {
111
157
  throw new Error('Repository does not exist')
112
158
  }
113
159
 
114
- const commitDetails = await repository.getSingleCommit(ref)
115
-
116
- const fileContentPromises = commitDetails.data.files.map(async (file: { raw_url: string }) => {
160
+ const commitDetails = await this.octokit.rest.repos.getCommit({ ref, repo, owner })
161
+ const fileContentPromises = commitDetails.data.files?.map(async (file: { raw_url: string }) => {
117
162
  const response = await fetch(file.raw_url)
118
163
  return response.text()
119
164
  })
120
- const fileContents = await Promise.all(fileContentPromises)
121
165
 
122
- commitDetails.data.files.forEach((file: { content?: string }, index: number) => {
123
- file.content = fileContents[index] as string
166
+ const fileContents = await Promise.all(fileContentPromises)
167
+ commitDetails.data.files.forEach((file, index: number) => {
168
+ Object.assign(file, { content: fileContents[index] })
124
169
  })
125
170
 
126
- return commitDetails
171
+ return commitDetails.data
127
172
  }
128
173
 
129
174
  public async getRepositoryBranches(owner: string, repo: string) {
130
- const repository = await this.githubApi.getRepo(owner, repo)
131
- if (!repository) {
132
- throw new Error('Repository does not exist')
175
+ let page = 1
176
+
177
+ const allBranches = []
178
+ let currentPageBranches = await this.octokit.rest.repos.listBranches({
179
+ owner,
180
+ repo,
181
+ page,
182
+ per_page: 50,
183
+ })
184
+
185
+ while (currentPageBranches.data.length) {
186
+ page++
187
+ allBranches.push(...currentPageBranches.data)
188
+ currentPageBranches = await this.octokit.rest.repos.listBranches({
189
+ owner,
190
+ repo,
191
+ page,
192
+ per_page: 50,
193
+ })
133
194
  }
134
- return repository.listBranches()
195
+
196
+ return allBranches
135
197
  }
136
198
 
137
199
  public async commitFilesToRepo(commitMeta: GithubCommitMeta): Promise<string> {
138
200
  const {
139
201
  branchName,
202
+ isPrivate,
140
203
  files,
141
204
  repositoryIdentity,
142
205
  commitMessage = DEFAULT_COMMIT_MESSAGE,
@@ -144,90 +207,117 @@ export default class GithubInstance {
144
207
  const { repo, ref = DEFAULT_REF } = repositoryIdentity
145
208
 
146
209
  // Step -1: Make a separate request for the username if it is not provided
147
- let username = repositoryIdentity.username
148
- if (!username) {
149
- const user = await this.githubApi.getUser()
150
- const profile = await user.getProfile()
151
- username = profile.data.login
210
+ let owner = repositoryIdentity.owner
211
+ if (!owner) {
212
+ const user = await this.octokit.rest.users.getAuthenticated()
213
+ owner = user.data.login
152
214
  }
153
215
 
154
216
  // Step 0: Create repository if it does not exist
155
- await this.ensureRepoExists(username, repo)
156
- const repository: GithubRepository = await this.githubApi.getRepo(username, repo)
217
+ const repository = await this.ensureRepoExists(owner, repo, isPrivate)
157
218
 
158
219
  // Step 1: Create branch if it does not exist
159
- await this.ensureBranchExists(repository, ref, branchName)
220
+ await this.ensureBranchExists(owner, repo, ref, branchName)
160
221
 
161
222
  // Step 2: Get branch commit SHA
162
- const commitSHA = await this.getBranchHeadCommitSHA(repository, branchName)
223
+ const commitSHA = await this.getBranchHeadCommitSHA(owner, repo, branchName)
163
224
 
164
225
  // Step 3: Get current tree SHA
165
- const treeSHA = await this.getCommitTreeSHA(repository, commitSHA)
226
+ const treeSHA = await this.getCommitTreeSHA(owner, repo, commitSHA)
166
227
 
167
228
  // Step 4: Prepare files for github
168
- const filesForGithub = await this.createFiles(repository, files)
229
+ const filesForGithub = await this.createFiles(owner, repo, files)
169
230
 
170
231
  // Step 5: Create new github tree
171
- const newTreeSHA = await this.createTree(repository, filesForGithub, treeSHA)
232
+ const newTreeSHA = await this.createTree(owner, repo, filesForGithub, treeSHA)
172
233
 
173
234
  // Step 6: Create commit
174
- const newCommit = await repository.commit(commitSHA, newTreeSHA, commitMessage)
235
+ const newCommit = await this.octokit.rest.git.createCommit({
236
+ owner,
237
+ repo,
238
+ message: commitMessage,
239
+ parents: [commitSHA],
240
+ tree: newTreeSHA,
241
+ })
175
242
  const newCommitSHA = newCommit.data.sha
176
243
 
177
244
  // Step 7: Update head
178
- await repository.updateHead(`heads/${branchName}`, newCommitSHA)
245
+ await this.octokit.rest.git.updateRef({
246
+ owner,
247
+ repo,
248
+ ref: `heads/${branchName}`,
249
+ sha: newCommitSHA,
250
+ })
179
251
 
180
- return `${GITHUB_REPOSITORY_BASE_URL}/${repository.__fullname}`
252
+ return `${GITHUB_REPOSITORY_BASE_URL}/${repository.full_name}`
181
253
  }
182
254
 
183
- private async ensureRepoExists(username: string, repo: string): Promise<void> {
184
- const repositories = await this.getUserRepositories(username)
185
- const repoExists = repositories.some((repoMeta: GithubRepositoryData) => repoMeta.name === repo)
186
-
187
- if (!repoExists) {
188
- await this.createRepository({ username, meta: { name: repo } })
255
+ private async ensureRepoExists(
256
+ username: string,
257
+ repo: string,
258
+ isPrivate: boolean
259
+ ): Promise<GithubRepositoryData> {
260
+ const repositories = await this.getUserRepositories()
261
+ const existingRepo = repositories.find(
262
+ (repoMeta: GithubRepositoryData) => repoMeta.name === repo
263
+ )
264
+ if (existingRepo) {
265
+ return existingRepo
189
266
  }
267
+
268
+ return this.createRepository({ username, meta: { name: repo, private: isPrivate } })
190
269
  }
191
270
 
192
- private async ensureBranchExists(
193
- repo: GithubRepository,
194
- ref: string,
195
- branch: string
196
- ): Promise<void> {
197
- const { data } = await repo.listBranches()
198
- const branchExists = data.some((branchMeta) => branchMeta.name === branch)
271
+ private async ensureBranchExists(owner: string, repo: string, ref: string, branch: string) {
272
+ const existingBranches = await this.getRepositoryBranches(owner, repo)
273
+ const branchExists = existingBranches.some((branchMeta) => branchMeta.name === branch)
199
274
 
200
275
  if (!branchExists) {
201
- await repo.createBranch(ref, branch)
276
+ this.octokit.rest.git.createRef({
277
+ owner,
278
+ repo,
279
+ ref: `refs/heads/${branch}`,
280
+ sha: ref,
281
+ })
202
282
  }
203
283
  }
204
284
 
205
- private async getBranchHeadCommitSHA(repo: GithubRepository, branch: string): Promise<string> {
206
- const { data } = await repo.getRef(`heads/${branch}`)
285
+ private async getBranchHeadCommitSHA(
286
+ owner: string,
287
+ repo: string,
288
+ branch: string
289
+ ): Promise<string> {
290
+ const { data } = await this.octokit.rest.git.getRef({ owner, repo, ref: `heads/${branch}` })
207
291
  return data.object.sha
208
292
  }
209
293
 
210
- private async getCommitTreeSHA(repo: GithubRepository, commitSHA: string): Promise<string> {
211
- const { data } = await repo.getCommit(commitSHA)
294
+ private async getCommitTreeSHA(owner: string, repo: string, commitSHA: string): Promise<string> {
295
+ const { data } = await this.octokit.rest.git.getCommit({
296
+ owner,
297
+ repo,
298
+ commit_sha: commitSHA,
299
+ })
300
+
212
301
  return data.tree.sha
213
302
  }
214
303
 
215
304
  private async createFiles(
216
- repo: GithubRepository,
305
+ owner: string,
306
+ repo: string,
217
307
  files: GithubFile[]
218
308
  ): Promise<GithubFileMeta[]> {
219
309
  const promises = files.map((file) => {
220
- return this.createFile(repo, file)
310
+ return this.createFile(owner, repo, file)
221
311
  })
222
312
 
223
313
  return Promise.all(promises)
224
314
  }
225
315
 
226
- private async createFile(repo: GithubRepository, file: GithubFile): Promise<GithubFileMeta> {
316
+ private async createFile(owner: string, repo: string, file: GithubFile): Promise<GithubFileMeta> {
227
317
  const { data } =
228
318
  file.encoding === 'base64'
229
- ? await createBase64GithubFileBlob(file, repo.__fullname, this.auth)
230
- : await repo.createBlob(file.content)
319
+ ? await createBase64GithubFileBlob(file, repo, this.auth)
320
+ : await this.octokit.rest.git.createBlob({ owner, repo, content: file.content })
231
321
 
232
322
  return {
233
323
  sha: file.status === 'deleted' ? null : data.sha,
@@ -238,11 +328,18 @@ export default class GithubInstance {
238
328
  }
239
329
 
240
330
  private async createTree(
241
- repo: GithubRepository,
331
+ owner: string,
332
+ repo: string,
242
333
  files: GithubFileMeta[],
243
334
  treeSHA?: string
244
335
  ): Promise<string> {
245
- const tree = await repo.createTree(files, treeSHA)
336
+ const tree = await this.octokit.rest.git.createTree({
337
+ owner,
338
+ repo,
339
+ base_tree: treeSHA,
340
+ // @ts-ignore
341
+ tree: files,
342
+ })
246
343
  return tree.data.sha
247
344
  }
248
345
  }
package/src/index.ts CHANGED
@@ -12,6 +12,8 @@ import {
12
12
  RepositoryCommitsListMeta,
13
13
  RepositoryCommitMeta,
14
14
  CreateBranchMeta,
15
+ RepositoryMergeMeta,
16
+ RemoveBranchMeta,
15
17
  } from './types'
16
18
 
17
19
  export const createGithubGateway: GithubGatewayFactory = (auth: ServiceAuth = {}) => {
@@ -20,7 +22,7 @@ export const createGithubGateway: GithubGatewayFactory = (auth: ServiceAuth = {}
20
22
  const getRepository = async (repoIdentity: RepositoryIdentity, authData?: ServiceAuth) => {
21
23
  authorizeGithubInstance(authData)
22
24
 
23
- const { data } = await githubInstance.getRepoContent(repoIdentity)
25
+ const data = await githubInstance.getRepoContent(repoIdentity)
24
26
 
25
27
  const { repo } = repoIdentity
26
28
  const emptyFolder = createEmptyFolder(repo)
@@ -29,9 +31,9 @@ export const createGithubGateway: GithubGatewayFactory = (auth: ServiceAuth = {}
29
31
  return fetchFilesContent(data as GithubFile[], emptyFolder, filesFetcherMeta)
30
32
  }
31
33
 
32
- const getUserRepositories = async (username: string, authData?: ServiceAuth) => {
34
+ const getUserRepositories = async (authData?: ServiceAuth) => {
33
35
  authorizeGithubInstance(authData)
34
- return githubInstance.getUserRepositories(username)
36
+ return githubInstance.getUserRepositories()
35
37
  }
36
38
 
37
39
  const createRepository = async (repository: NewRepository, authData?: ServiceAuth) => {
@@ -54,11 +56,21 @@ export const createGithubGateway: GithubGatewayFactory = (auth: ServiceAuth = {}
54
56
  return githubInstance.createBranch(meta)
55
57
  }
56
58
 
59
+ const mergeRepositoryBranches = async (meta: RepositoryMergeMeta, authData: ServiceAuth) => {
60
+ authorizeGithubInstance(authData)
61
+ return githubInstance.mergeRepositoryBranches(meta)
62
+ }
63
+
57
64
  const getRepositoryBranches = async (owner: string, repo: string, authData: ServiceAuth) => {
58
65
  authorizeGithubInstance(authData)
59
66
  return githubInstance.getRepositoryBranches(owner, repo)
60
67
  }
61
68
 
69
+ const deleteRepositoryBranch = async (meta: RemoveBranchMeta, authData: ServiceAuth) => {
70
+ authorizeGithubInstance(authData)
71
+ return githubInstance.deleteBranch(meta)
72
+ }
73
+
62
74
  const getCommitData = async (meta: RepositoryCommitMeta, authData: ServiceAuth) => {
63
75
  authorizeGithubInstance(authData)
64
76
  return githubInstance.getCommitData(meta)
@@ -78,6 +90,8 @@ export const createGithubGateway: GithubGatewayFactory = (auth: ServiceAuth = {}
78
90
  getRepositoryCommits,
79
91
  createBranch,
80
92
  getRepositoryBranches,
93
+ mergeRepositoryBranches,
94
+ deleteRepositoryBranch,
81
95
  commitFilesToRepo,
82
96
  getCommitData,
83
97
  authorizeGithubInstance,
package/src/types.ts CHANGED
@@ -6,18 +6,20 @@ export type GithubGatewayFactory = (auth?: ServiceAuth) => GithubGateway
6
6
 
7
7
  export interface GithubGateway {
8
8
  getRepository: (repo: RepositoryIdentity, auth?: ServiceAuth) => Promise<GeneratedFolder>
9
- getUserRepositories: (username: string, auth?: ServiceAuth) => Promise<GithubRepositoryData[]>
9
+ getUserRepositories: (auth?: ServiceAuth) => Promise<GithubRepositoryData[]>
10
10
  commitFilesToRepo: (commitMeta: GithubCommitMeta, auth?: ServiceAuth) => Promise<string>
11
11
  createRepository: (repository: NewRepository, auth?: ServiceAuth) => Promise<GithubRepositoryData>
12
12
  getRepositoryCommits: (meta: RepositoryCommitsListMeta, authData: ServiceAuth) => Promise<any>
13
13
  createBranch: (meta: CreateBranchMeta, authData: ServiceAuth) => Promise<any>
14
+ mergeRepositoryBranches: (meta: RepositoryMergeMeta, authData: ServiceAuth) => Promise<any>
15
+ deleteRepositoryBranch: (meta: RemoveBranchMeta, authData: ServiceAuth) => Promise<any>
14
16
  getRepositoryBranches: (owner: string, repo: string, authData: ServiceAuth) => Promise<any>
15
17
  getCommitData: (meta: RepositoryCommitMeta, authData: ServiceAuth) => Promise<any>
16
18
  authorizeGithubInstance: (authData?: ServiceAuth) => void
17
19
  }
18
20
 
19
21
  export interface RepositoryIdentity {
20
- username: string
22
+ owner: string
21
23
  repo: string
22
24
  ref?: string
23
25
  path?: string
@@ -28,6 +30,7 @@ export interface GithubCommitMeta {
28
30
  repositoryIdentity: RepositoryIdentity
29
31
  branchName: string
30
32
  commitMessage?: string
33
+ isPrivate?: boolean
31
34
  }
32
35
 
33
36
  export interface CreateBranchMeta {
@@ -52,9 +55,17 @@ export interface RepositoryCommitsListMeta {
52
55
  path?: string
53
56
  }
54
57
 
55
- export interface RepositoryContentResponse {
56
- data: GithubFile | GithubFile[]
57
- status: number
58
+ export interface RepositoryMergeMeta {
59
+ repo: string
60
+ owner: string
61
+ base: string
62
+ head: string
63
+ }
64
+
65
+ export interface RemoveBranchMeta {
66
+ repo: string
67
+ owner: string
68
+ branch: string
58
69
  }
59
70
 
60
71
  export interface GithubFile {
@@ -75,7 +86,6 @@ export interface GithubFileMeta {
75
86
  path: string
76
87
  mode: string
77
88
  type: string
78
- encoding?: FileEncoding
79
89
  }
80
90
 
81
91
  export interface NewRepository {
@@ -105,41 +115,8 @@ export interface FilesFetcherMeta {
105
115
  githubInstance: GithubInstance
106
116
  }
107
117
 
108
- export interface GithubRepository {
109
- __fullname: string
110
- getContents: (ref: string, path: string) => Promise<RepositoryContentResponse>
111
- listBranches: () => Promise<GithubBranchesResponse>
112
- createBranch: (ref: string, branchName: string) => Promise<GithubCreateResponse>
113
- getRef: (url: string) => Promise<GithubGetRefResponse>
114
- getCommit: (sha: string) => Promise<GithubGetCommitResponse>
115
- createTree: (files: GithubFileMeta[], sha?: string) => Promise<GithubCreateResponse>
116
- commit: (parentSHA: string, treeSHA: string, message: string) => Promise<GithubCreateResponse>
117
- updateHead: (ref: string, commitSHA: string) => Promise<void>
118
- createBlob: (fileContent: string) => Promise<GithubCreateResponse>
119
- }
120
-
121
118
  export interface GithubCreateResponse {
122
119
  data: {
123
120
  sha: string
124
121
  }
125
122
  }
126
-
127
- interface GithubBranchesResponse {
128
- data: Array<Record<string, string>>
129
- }
130
-
131
- interface GithubGetRefResponse {
132
- data: {
133
- object: {
134
- sha: string
135
- }
136
- }
137
- }
138
-
139
- interface GithubGetCommitResponse {
140
- data: {
141
- tree: {
142
- sha: string
143
- }
144
- }
145
- }
package/src/utils.ts CHANGED
@@ -32,7 +32,7 @@ export const fetchFilesContent = async (
32
32
  const { name, path } = directory
33
33
 
34
34
  const directoryFilesParams = { ...userRepositoryIdentity, path }
35
- const { data } = await githubInstance.getRepoContent(directoryFilesParams)
35
+ const data = await githubInstance.getRepoContent(directoryFilesParams)
36
36
 
37
37
  const newFolder = createEmptyFolder(name)
38
38
  const folderWithFiles = await fetchFilesContent(data as GithubFile[], newFolder, meta)
@@ -79,7 +79,7 @@ const getFileContent = async (
79
79
  const { ref = DEFAULT_REF } = userRepositoryIdentity
80
80
 
81
81
  const githubFileMetadata = { ...userRepositoryIdentity, ref, path }
82
- const { data } = await githubInstance.getRepoContent(githubFileMetadata)
82
+ const data = await githubInstance.getRepoContent(githubFileMetadata)
83
83
 
84
84
  let { content, encoding } = data as GithubFile
85
85