21 lines
639 B
Python
21 lines
639 B
Python
"""全局模板上下文:当前构建平台的配置状态(用于未配置告警条)。"""
|
|
from .build_backends import get_backend
|
|
|
|
|
|
def github_config(request):
|
|
if not getattr(request.user, 'is_authenticated', False):
|
|
return {}
|
|
backend = get_backend()
|
|
ready = backend.configured()
|
|
warnings = backend.warnings()
|
|
return {
|
|
# 新变量名
|
|
'build_platform': backend.name,
|
|
'build_platform_label': backend.label,
|
|
'build_ready': ready,
|
|
'build_warnings': warnings,
|
|
# 兼容旧模板变量名
|
|
'github_ready': ready,
|
|
'github_warnings': warnings,
|
|
}
|