Update repo_health.yml
This commit is contained in:
49
.github/workflows/repo_health.yml
vendored
49
.github/workflows/repo_health.yml
vendored
@@ -97,7 +97,7 @@ jobs:
|
|||||||
if: ${{ steps.perm.outputs.allowed != 'true' }}
|
if: ${{ steps.perm.outputs.allowed != 'true' }}
|
||||||
run: |
|
run: |
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
echo "ERROR: Access denied. Actor must have admin or maintain permission to run this workflow." >> "${GITHUB_STEP_SUMMARY}"
|
echo "ERROR: Access denied. Actor must have admin permission to run this workflow." >> "${GITHUB_STEP_SUMMARY}"
|
||||||
exit 1
|
exit 1
|
||||||
|
|
||||||
release_config:
|
release_config:
|
||||||
@@ -227,6 +227,14 @@ EOF
|
|||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
required_script_dirs=(
|
||||||
|
"scripts/fix"
|
||||||
|
"scripts/lib"
|
||||||
|
"scripts/release"
|
||||||
|
"scripts/run"
|
||||||
|
"scripts/validate"
|
||||||
|
)
|
||||||
|
|
||||||
required_script_files=(
|
required_script_files=(
|
||||||
"scripts/validate/manifest.sh"
|
"scripts/validate/manifest.sh"
|
||||||
"scripts/validate/xml_wellformed.sh"
|
"scripts/validate/xml_wellformed.sh"
|
||||||
@@ -254,8 +262,15 @@ EOF
|
|||||||
)
|
)
|
||||||
|
|
||||||
missing_files=()
|
missing_files=()
|
||||||
|
missing_dirs=()
|
||||||
legacy_present=()
|
legacy_present=()
|
||||||
|
|
||||||
|
for d in "${required_script_dirs[@]}"; do
|
||||||
|
if [ ! -d "${d}" ]; then
|
||||||
|
missing_dirs+=("${d}/")
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
for f in "${required_script_files[@]}"; do
|
for f in "${required_script_files[@]}"; do
|
||||||
if [ ! -f "${f}" ]; then
|
if [ ! -f "${f}" ]; then
|
||||||
missing_files+=("${f}")
|
missing_files+=("${f}")
|
||||||
@@ -334,6 +349,15 @@ PY
|
|||||||
echo "```"
|
echo "```"
|
||||||
} >> "${GITHUB_STEP_SUMMARY}"
|
} >> "${GITHUB_STEP_SUMMARY}"
|
||||||
|
|
||||||
|
if [ "${#missing_dirs[@]}" -gt 0 ]; then
|
||||||
|
echo "### Missing required script directories" >> "${GITHUB_STEP_SUMMARY}"
|
||||||
|
for m in "${missing_dirs[@]}"; do
|
||||||
|
echo "- ${m}" >> "${GITHUB_STEP_SUMMARY}"
|
||||||
|
done
|
||||||
|
echo "ERROR: Guardrails failed. Missing required script directories." >> "${GITHUB_STEP_SUMMARY}"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
if [ "${#missing_files[@]}" -gt 0 ]; then
|
if [ "${#missing_files[@]}" -gt 0 ]; then
|
||||||
echo "### Missing script files" >> "${GITHUB_STEP_SUMMARY}"
|
echo "### Missing script files" >> "${GITHUB_STEP_SUMMARY}"
|
||||||
for m in "${missing_files[@]}"; do
|
for m in "${missing_files[@]}"; do
|
||||||
@@ -342,6 +366,29 @@ PY
|
|||||||
echo "ERROR: Guardrails failed. Missing required script files." >> "${GITHUB_STEP_SUMMARY}"
|
echo "ERROR: Guardrails failed. Missing required script files." >> "${GITHUB_STEP_SUMMARY}"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ "${#legacy_present[@]}" -gt 0 ]; then
|
||||||
|
echo "### Legacy scripts detected (disallowed)" >> "${GITHUB_STEP_SUMMARY}"
|
||||||
|
for m in "${legacy_present[@]}"; do
|
||||||
|
echo "- ${m}" >> "${GITHUB_STEP_SUMMARY}"
|
||||||
|
done
|
||||||
|
echo "ERROR: Guardrails failed. Legacy script files must be removed." >> "${GITHUB_STEP_SUMMARY}"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
legacy_glob_found=()
|
||||||
|
while IFS= read -r f; do
|
||||||
|
[ -n "${f}" ] && legacy_glob_found+=("${f}")
|
||||||
|
done < <(find scripts -maxdepth 1 -type f -name 'validate_*.sh' 2>/dev/null || true)
|
||||||
|
|
||||||
|
if [ "${#legacy_glob_found[@]}" -gt 0 ]; then
|
||||||
|
echo "### Legacy validate_* scripts detected at scripts/ root (disallowed)" >> "${GITHUB_STEP_SUMMARY}"
|
||||||
|
for m in "${legacy_glob_found[@]}"; do
|
||||||
|
echo "- ${m}" >> "${GITHUB_STEP_SUMMARY}"
|
||||||
|
done
|
||||||
|
echo "ERROR: Guardrails failed. Move scripts into scripts/validate/ with approved filenames." >> "${GITHUB_STEP_SUMMARY}"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
env:
|
env:
|
||||||
MISSING_FILES: ${{ '' }}
|
MISSING_FILES: ${{ '' }}
|
||||||
LEGACY_PRESENT: ${{ '' }}
|
LEGACY_PRESENT: ${{ '' }}
|
||||||
|
|||||||
Reference in New Issue
Block a user