(taskCtx plugin.TaskContext, connectionId uint64, repoUrl string)
| 245 | } |
| 246 | |
| 247 | func (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 | |
| 278 | func EnrichOptions(taskCtx plugin.TaskContext, |
| 279 | op *tasks.GithubOptions, |
nothing calls this directly
no test coverage detected