log.Warn("Forbidden: User %d cannot push to protected branch: %s in %-v and pr #%d does not have enough approvals",opts.UserID,branchName,repo,pr.Index)
user,err:=models.GetUserByID(opts.UserID)
iferr!=nil{
log.Error("Unable to get User id %d Error: %v",opts.UserID,err)
"err":fmt.Sprintf("Error calculating if allowed to merge: %v",err),
})
return
}
if!allowedMerge{
log.Warn("Forbidden: User %d is not allowed to push to protected branch: %s in %-v and is not allowed to merge pr #%d",opts.UserID,branchName,repo,pr.Index)
log.Warn("Forbidden: User %d is not allowed push to protected branch %s in %-v and pr #%d is not ready to be merged: %s",opts.UserID,branchName,repo,pr.Index,err.Error())
"err":fmt.Sprintf("protected branch %s can not be pushed to and pr #%d has requested changes",branchName,opts.ProtectedBranchID),
"err":fmt.Sprintf("Not allowed to push to protected branch %s and pr #%d is not ready to be merged: %s",branchName,opts.ProtectedBranchID,err.Error()),
})
return
}
log.Error("Unable to check if mergable: protected branch %s in %-v and pr #%d. Error: %v",opts.UserID,branchName,repo,pr.Index,err)