-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathrepo_contract_test.sh
More file actions
45 lines (39 loc) · 985 Bytes
/
repo_contract_test.sh
File metadata and controls
45 lines (39 loc) · 985 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/usr/bin/env bash
set -euo pipefail
# Repository contract tests: protect baseline repo quality from regressions.
required_files=(
"README.md"
"LICENSE"
"CONTRIBUTING.md"
".github/SECURITY.md"
".github/dependabot.yml"
".github/workflows/codeql.yml"
".github/workflows/repo-contract-ci.yml"
"docs/ENGINEERING_QUALITY.md"
)
failures=0
for f in "${required_files[@]}"; do
if [[ ! -e "$f" ]]; then
echo "[FAIL] missing required file: $f"
failures=$((failures + 1))
else
echo "[PASS] found: $f"
fi
done
if [[ ! -d tests ]]; then
echo "[FAIL] tests/ directory is required"
failures=$((failures + 1))
else
echo "[PASS] tests/ directory exists"
fi
if [[ ! -d docs ]]; then
echo "[FAIL] docs/ directory is required"
failures=$((failures + 1))
else
echo "[PASS] docs/ directory exists"
fi
if [[ "$failures" -gt 0 ]]; then
echo "Repository contract check failed with $failures issue(s)."
exit 1
fi
echo "Repository contract checks passed."