mirror of
https://github.com/iflytek/skillhub.git
synced 2026-11-27 23:58:51 +00:00
提供随仓库分发的SkillHub设计核心、通用规范读取与OpenSpec/Trellis协作入口,保留现有React交互契约。 本地50项工具/打包回归、干净导出与12个静态示例视图通过;产品web树对应1792项测试、类型检查、lint和构建已通过。最新head的专项CI、脚本回归、RISC-V镜像、PostgreSQL16/17、Node22/24前端、文档和DCO/CLA已通过。用户明确要求不追加本地核查并先行合并;其余尚在进行的服务端/E2E结果单独跟踪,不计作已通过。独立Review、本地exact-SHA镜像/鉴权Smoke与完整OpenSpec业务试点仍未补齐,不声明完整验收通过。 个人指南、任务/会话记录和未提供的画板桥接不在最终改动中。 Signed-off-by: XiaoSeS <87064762+XiaoSeS@users.noreply.github.com>
98 lines
5.1 KiB
Bash
Executable file
98 lines
5.1 KiB
Bash
Executable file
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
|
|
SECURITY_WORKFLOW="$REPO_ROOT/.github/workflows/security.yml"
|
|
PR_SCRIPTS_WORKFLOW="$REPO_ROOT/.github/workflows/pr-scripts.yml"
|
|
|
|
fail() {
|
|
echo "FAIL: $*" >&2
|
|
exit 1
|
|
}
|
|
|
|
assert_pr_workflow_hardened() {
|
|
local workflow="$1"
|
|
grep -Eq '^permissions:[[:space:]]*$' "$workflow" \
|
|
|| fail "$workflow must declare top-level permissions"
|
|
grep -Eq '^[[:space:]]+contents:[[:space:]]+read[[:space:]]*$' "$workflow" \
|
|
|| fail "$workflow GITHUB_TOKEN permissions must include contents: read"
|
|
grep -Fq 'persist-credentials: false' "$workflow" \
|
|
|| fail "$workflow checkout steps must not persist credentials"
|
|
}
|
|
|
|
[[ -f "$SECURITY_WORKFLOW" ]] || fail ".github/workflows/security.yml is required"
|
|
|
|
assert_pr_workflow_hardened "$REPO_ROOT/.github/workflows/pr-cli.yml"
|
|
assert_pr_workflow_hardened "$REPO_ROOT/.github/workflows/pr-e2e.yml"
|
|
assert_pr_workflow_hardened "$REPO_ROOT/.github/workflows/pr-helm-chart.yml"
|
|
assert_pr_workflow_hardened "$REPO_ROOT/.github/workflows/pr-tests.yml"
|
|
assert_pr_workflow_hardened "$REPO_ROOT/.github/workflows/agent-workflow.yml"
|
|
assert_pr_workflow_hardened "$PR_SCRIPTS_WORKFLOW"
|
|
assert_pr_workflow_hardened "$SECURITY_WORKFLOW"
|
|
|
|
grep -Fq 'actions/dependency-review-action' "$SECURITY_WORKFLOW" \
|
|
|| fail "security workflow must run dependency review"
|
|
grep -Fq 'github/codeql-action/init' "$SECURITY_WORKFLOW" \
|
|
|| fail "security workflow must initialize CodeQL"
|
|
grep -Fq 'cd server && ./mvnw -q -DskipTests package' "$SECURITY_WORKFLOW" \
|
|
|| fail "security workflow must build Java with the server Maven wrapper"
|
|
grep -Fq 'security-events: write' "$SECURITY_WORKFLOW" \
|
|
|| fail "security workflow must grant SARIF upload permission"
|
|
|
|
python_source="$(find "$REPO_ROOT" \
|
|
\( -path "$REPO_ROOT/.git" -o -path '*/node_modules' -o -path '*/.venv' \) -prune -o \
|
|
-type f -name '*.py' -print -quit)"
|
|
if [[ -n "$python_source" ]]; then
|
|
grep -Fq 'language: python' "$SECURITY_WORKFLOW" \
|
|
|| fail "security workflow must run Python CodeQL when Python source exists"
|
|
else
|
|
! grep -Fq 'language: python' "$SECURITY_WORKFLOW" \
|
|
|| fail "security workflow must not run Python CodeQL without Python source"
|
|
fi
|
|
|
|
grep -Fq '.github/workflows/security.yml' "$PR_SCRIPTS_WORKFLOW" \
|
|
|| fail "pr-scripts must run when security workflow changes"
|
|
grep -Fq '.github/workflows/pr-cli.yml' "$PR_SCRIPTS_WORKFLOW" \
|
|
|| fail "pr-scripts must run when PR CLI workflow changes"
|
|
grep -Fq '.github/workflows/pr-e2e.yml' "$PR_SCRIPTS_WORKFLOW" \
|
|
|| fail "pr-scripts must run when PR E2E workflow changes"
|
|
grep -Fq '.github/workflows/pr-helm-chart.yml' "$PR_SCRIPTS_WORKFLOW" \
|
|
|| fail "pr-scripts must run when PR Helm Chart workflow changes"
|
|
grep -Fq '.github/workflows/pr-tests.yml' "$PR_SCRIPTS_WORKFLOW" \
|
|
|| fail "pr-scripts must run when PR Tests workflow changes"
|
|
grep -Fq '.github/workflows/publish-chart.yml' "$PR_SCRIPTS_WORKFLOW" \
|
|
|| fail "pr-scripts must run when Chart publish workflow changes"
|
|
grep -Fq "'**/*.py'" "$PR_SCRIPTS_WORKFLOW" \
|
|
|| fail "pr-scripts must run when Python source changes"
|
|
grep -Fq '.env.release.example' "$PR_SCRIPTS_WORKFLOW" \
|
|
|| fail "pr-scripts must run when release env example changes"
|
|
grep -Fq '.env.release.draft' "$PR_SCRIPTS_WORKFLOW" \
|
|
|| fail "pr-scripts must run when release env draft changes"
|
|
grep -Fq 'compose.release.yml' "$PR_SCRIPTS_WORKFLOW" \
|
|
|| fail "pr-scripts must run when release compose changes"
|
|
grep -Fq 'server/Dockerfile' "$PR_SCRIPTS_WORKFLOW" \
|
|
|| fail "pr-scripts must run when the production server image changes"
|
|
grep -Fq 'web/Dockerfile' "$PR_SCRIPTS_WORKFLOW" \
|
|
|| fail "pr-scripts must run when the web image changes"
|
|
grep -Fq 'web/nginx.conf.template' "$PR_SCRIPTS_WORKFLOW" \
|
|
|| fail "pr-scripts must run when the nginx template changes"
|
|
grep -Fq 'bash scripts/tests/validate-release-config-test.sh' "$PR_SCRIPTS_WORKFLOW" \
|
|
|| fail "pr-scripts must run validate-release-config-test"
|
|
grep -Fq 'bash scripts/tests/nginx-forwarded-proto-test.sh' "$PR_SCRIPTS_WORKFLOW" \
|
|
|| fail "pr-scripts must run nginx-forwarded-proto-test"
|
|
grep -Fq 'bash scripts/tests/smoke-test-admin-mode-test.sh' "$PR_SCRIPTS_WORKFLOW" \
|
|
|| fail "pr-scripts must run smoke-test-admin-mode-test"
|
|
grep -Fq 'bash scripts/tests/web-base-path-routing-test.sh' "$PR_SCRIPTS_WORKFLOW" \
|
|
|| fail "pr-scripts must run web-base-path-routing-test"
|
|
grep -Fq 'bash scripts/tests/web-base-path-nginx-smoke-test.sh' "$PR_SCRIPTS_WORKFLOW" \
|
|
|| fail "pr-scripts must run web-base-path-nginx-smoke-test"
|
|
grep -Fq 'bash scripts/tests/runtime-secret-test.sh' "$PR_SCRIPTS_WORKFLOW" \
|
|
|| fail "pr-scripts must run runtime-secret-test"
|
|
grep -Fq 'bash scripts/tests/dev-web-host-test.sh' "$PR_SCRIPTS_WORKFLOW" \
|
|
|| fail "pr-scripts must run dev-web-host-test"
|
|
grep -Fq 'bash scripts/tests/server-image-compat-test.sh' "$PR_SCRIPTS_WORKFLOW" \
|
|
|| fail "pr-scripts must run server-image-compat-test"
|
|
grep -Fq 'bash scripts/tests/workflow-security-test.sh' "$PR_SCRIPTS_WORKFLOW" \
|
|
|| fail "pr-scripts must run workflow-security-test"
|
|
|
|
echo "workflow-security-test passed"
|