|
|
@ -26,7 +26,7 @@ func GenerateActionsRunnerToken(ctx *context.PrivateContext) { |
|
|
|
defer rd.Close() |
|
|
|
defer rd.Close() |
|
|
|
|
|
|
|
|
|
|
|
if err := json.NewDecoder(rd).Decode(&genRequest); err != nil { |
|
|
|
if err := json.NewDecoder(rd).Decode(&genRequest); err != nil { |
|
|
|
log.Error("%v", err) |
|
|
|
log.Error("JSON Decode failed: %v", err) |
|
|
|
ctx.JSON(http.StatusInternalServerError, private.Response{ |
|
|
|
ctx.JSON(http.StatusInternalServerError, private.Response{ |
|
|
|
Err: err.Error(), |
|
|
|
Err: err.Error(), |
|
|
|
}) |
|
|
|
}) |
|
|
@ -35,7 +35,7 @@ func GenerateActionsRunnerToken(ctx *context.PrivateContext) { |
|
|
|
|
|
|
|
|
|
|
|
owner, repo, err := parseScope(ctx, genRequest.Scope) |
|
|
|
owner, repo, err := parseScope(ctx, genRequest.Scope) |
|
|
|
if err != nil { |
|
|
|
if err != nil { |
|
|
|
log.Error("%v", err) |
|
|
|
log.Error("parseScope failed: %v", err) |
|
|
|
ctx.JSON(http.StatusInternalServerError, private.Response{ |
|
|
|
ctx.JSON(http.StatusInternalServerError, private.Response{ |
|
|
|
Err: err.Error(), |
|
|
|
Err: err.Error(), |
|
|
|
}) |
|
|
|
}) |
|
|
@ -45,18 +45,18 @@ func GenerateActionsRunnerToken(ctx *context.PrivateContext) { |
|
|
|
if errors.Is(err, util.ErrNotExist) || (token != nil && !token.IsActive) { |
|
|
|
if errors.Is(err, util.ErrNotExist) || (token != nil && !token.IsActive) { |
|
|
|
token, err = actions_model.NewRunnerToken(ctx, owner, repo) |
|
|
|
token, err = actions_model.NewRunnerToken(ctx, owner, repo) |
|
|
|
if err != nil { |
|
|
|
if err != nil { |
|
|
|
err := fmt.Sprintf("error while creating runner token: %v", err) |
|
|
|
errMsg := fmt.Sprintf("error while creating runner token: %v", err) |
|
|
|
log.Error("%v", err) |
|
|
|
log.Error("NewRunnerToken failed: %v", errMsg) |
|
|
|
ctx.JSON(http.StatusInternalServerError, private.Response{ |
|
|
|
ctx.JSON(http.StatusInternalServerError, private.Response{ |
|
|
|
Err: err, |
|
|
|
Err: errMsg, |
|
|
|
}) |
|
|
|
}) |
|
|
|
return |
|
|
|
return |
|
|
|
} |
|
|
|
} |
|
|
|
} else if err != nil { |
|
|
|
} else if err != nil { |
|
|
|
err := fmt.Sprintf("could not get unactivated runner token: %v", err) |
|
|
|
errMsg := fmt.Sprintf("could not get unactivated runner token: %v", err) |
|
|
|
log.Error("%v", err) |
|
|
|
log.Error("GetLatestRunnerToken failed: %v", errMsg) |
|
|
|
ctx.JSON(http.StatusInternalServerError, private.Response{ |
|
|
|
ctx.JSON(http.StatusInternalServerError, private.Response{ |
|
|
|
Err: err, |
|
|
|
Err: errMsg, |
|
|
|
}) |
|
|
|
}) |
|
|
|
return |
|
|
|
return |
|
|
|
} |
|
|
|
} |
|
|
|