MCPcopy Index your code
hub / github.com/apache/devlake / GetDynamicGitUrl

Method GetDynamicGitUrl

backend/plugins/github/impl/impl.go:247–276  ·  view source on GitHub ↗
(taskCtx plugin.TaskContext, connectionId uint64, repoUrl string)

Source from the content-addressed store, hash-verified

245}
246
247func (p Github) GetDynamicGitUrl(taskCtx plugin.TaskContext, connectionId uint64, repoUrl string) (string, errors.Error) {
248 connectionHelper := helper.NewConnectionHelper(
249 taskCtx,
250 nil,
251 p.Name(),
252 )
253
254 connection := &models.GithubConnection{}
255 err := connectionHelper.FirstById(connection, connectionId)
256 if err != nil {
257 return "", errors.Default.Wrap(err, "unable to get github connection by the given connection ID")
258 }
259
260 apiClient, err := helper.NewApiClient(taskCtx.GetContext(), connection.GetEndpoint(), nil, 0, connection.GetProxy(), taskCtx)
261 if err != nil {
262 return "", err
263 }
264
265 err = connection.PrepareApiClient(apiClient)
266 if err != nil {
267 return "", err
268 }
269
270 newUrl, err := replaceAcessTokenInUrl(repoUrl, strings.Split(connection.Token, ",")[0])
271 if err != nil {
272 return "", err
273 }
274
275 return newUrl, nil
276}
277
278func EnrichOptions(taskCtx plugin.TaskContext,
279 op *tasks.GithubOptions,

Callers

nothing calls this directly

Calls 8

NameMethod · 0.95
replaceAcessTokenInUrlFunction · 0.85
FirstByIdMethod · 0.80
WrapMethod · 0.80
GetContextMethod · 0.65
GetEndpointMethod · 0.65
GetProxyMethod · 0.65
PrepareApiClientMethod · 0.65

Tested by

no test coverage detected