🔧 统一 stats workflow 的 token 契约

This commit is contained in:
csh
2026-05-22 09:58:17 +08:00
parent a4d09c9063
commit 2b5eaf27c9
2 changed files with 16 additions and 11 deletions
+11
View File
@@ -26,6 +26,16 @@ test_workflows_do_not_hardcode_company_server() {
! rg -q 'https://git\.mytsl\.cn' "${REPO_ROOT}/.gitea/workflows/update_stats_badge.yaml" || fail "stats workflow should not hardcode company server"
}
test_stats_workflow_uses_workflow_secret_consistently() {
local file
file="${REPO_ROOT}/.gitea/workflows/update_stats_badge.yaml"
grep -q 'ACCESS_TOKEN: ${{ secrets.WORKFLOW }}' "${file}" || fail "stats workflow should read ACCESS_TOKEN from WORKFLOW secret"
! rg -q 'STATS_TOKEN' "${file}" || fail "stats workflow should not mention legacy STATS_TOKEN secret"
! rg -q 'GITHUB_TOKEN' "${file}" || fail "stats workflow should not mention GITHUB_TOKEN in token guidance"
}
test_preset_env_examples_exist() {
local file
@@ -41,6 +51,7 @@ test_preset_env_examples_exist() {
test_preset_compose_uses_env_for_instance
test_workflows_do_not_hardcode_company_server
test_stats_workflow_uses_workflow_secret_consistently
test_preset_env_examples_exist
echo "template_defaults_test.sh: PASS"