Update repo_health.yml
This commit is contained in:
54
.github/workflows/repo_health.yml
vendored
54
.github/workflows/repo_health.yml
vendored
@@ -33,7 +33,7 @@ on:
|
|||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
inputs:
|
inputs:
|
||||||
profile:
|
profile:
|
||||||
description: "Which configuration profile to validate. release checks SFTP variables used by release_pipeline. scripts checks baseline script prerequisites. all runs both."
|
description: "Which configuration profile to validate. release checks SFTP variables used by release_pipeline. scripts checks baseline script prerequisites. repo runs repository health only. all runs release, scripts, and repo health."
|
||||||
required: true
|
required: true
|
||||||
default: all
|
default: all
|
||||||
type: choice
|
type: choice
|
||||||
@@ -41,6 +41,7 @@ on:
|
|||||||
- all
|
- all
|
||||||
- release
|
- release
|
||||||
- scripts
|
- scripts
|
||||||
|
- repo
|
||||||
pull_request:
|
pull_request:
|
||||||
paths:
|
paths:
|
||||||
- ".github/workflows/**"
|
- ".github/workflows/**"
|
||||||
@@ -125,14 +126,14 @@ jobs:
|
|||||||
|
|
||||||
profile="${PROFILE_RAW:-all}"
|
profile="${PROFILE_RAW:-all}"
|
||||||
case "${profile}" in
|
case "${profile}" in
|
||||||
all|release|scripts) ;;
|
all|release|scripts|repo) ;;
|
||||||
*)
|
*)
|
||||||
echo "ERROR: Unknown profile: ${profile}" >> "${GITHUB_STEP_SUMMARY}"
|
echo "ERROR: Unknown profile: ${profile}" >> "${GITHUB_STEP_SUMMARY}"
|
||||||
exit 1
|
exit 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
if [ "${profile}" = "scripts" ]; then
|
if [ "${profile}" = "scripts" ] || [ "${profile}" = "repo" ]; then
|
||||||
echo "Profile scripts selected. Skipping release configuration checks." >> "${GITHUB_STEP_SUMMARY}"
|
echo "Profile scripts selected. Skipping release configuration checks." >> "${GITHUB_STEP_SUMMARY}"
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
@@ -189,7 +190,7 @@ jobs:
|
|||||||
sftp -oBatchMode=yes -oStrictHostKeyChecking=no -P "${port}" -i "${key_file}" "${FTP_USER}@${FTP_HOST}" <<'EOF'
|
sftp -oBatchMode=yes -oStrictHostKeyChecking=no -P "${port}" -i "${key_file}" "${FTP_USER}@${FTP_HOST}" <<'EOF'
|
||||||
pwd
|
pwd
|
||||||
bye
|
bye
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
echo "SFTP connectivity check passed." >> "${GITHUB_STEP_SUMMARY}"
|
echo "SFTP connectivity check passed." >> "${GITHUB_STEP_SUMMARY}"
|
||||||
|
|
||||||
@@ -215,14 +216,14 @@ jobs:
|
|||||||
|
|
||||||
profile="${PROFILE_RAW:-all}"
|
profile="${PROFILE_RAW:-all}"
|
||||||
case "${profile}" in
|
case "${profile}" in
|
||||||
all|release|scripts) ;;
|
all|release|scripts|repo) ;;
|
||||||
*)
|
*)
|
||||||
echo "ERROR: Unknown profile: ${profile}" >> "${GITHUB_STEP_SUMMARY}"
|
echo "ERROR: Unknown profile: ${profile}" >> "${GITHUB_STEP_SUMMARY}"
|
||||||
exit 1
|
exit 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
if [ "${profile}" = "release" ]; then
|
if [ "${profile}" = "release" ] || [ "${profile}" = "repo" ]; then
|
||||||
echo "Profile release selected. Skipping scripts checks." >> "${GITHUB_STEP_SUMMARY}"
|
echo "Profile release selected. Skipping scripts checks." >> "${GITHUB_STEP_SUMMARY}"
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
@@ -297,24 +298,26 @@ jobs:
|
|||||||
command -v php >/dev/null 2>&1 && tool_status+=("php") || true
|
command -v php >/dev/null 2>&1 && tool_status+=("php") || true
|
||||||
command -v xmllint >/dev/null 2>&1 && tool_status+=("xmllint") || true
|
command -v xmllint >/dev/null 2>&1 && tool_status+=("xmllint") || true
|
||||||
|
|
||||||
|
export MISSING_DIRS="$(printf '%s
|
||||||
|
' "${missing_dirs[@]:-}")"
|
||||||
export MISSING_FILES="$(printf '%s
|
export MISSING_FILES="$(printf '%s
|
||||||
' "${missing_files[@]:-}")"
|
' "${missing_files[@]:-}")"
|
||||||
export LEGACY_PRESENT="$(printf '%s
|
export LEGACY_PRESENT="$(printf '%s
|
||||||
' "${legacy_present[@]:-}")"
|
' "${legacy_present[@]:-}")"
|
||||||
export TOOLS="${tool_status[*]:-}"
|
export TOOLS="${tool_status[*]:-}"
|
||||||
|
|
||||||
export MISSING_REQUIRED="$(printf '%s
|
|
||||||
' "${missing_required[@]:-}")"
|
|
||||||
export MISSING_OPTIONAL="$(printf '%s
|
|
||||||
' "${missing_optional[@]:-}")"
|
|
||||||
export CONTENT_WARNINGS="$(printf '%s
|
|
||||||
' "${content_warnings[@]:-}")"
|
|
||||||
|
|
||||||
report_json="$(python3 - <<'PY'
|
report_json="$(python3 - <<'PY'
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
profile = os.environ.get('PROFILE_RAW') or 'all'
|
profile = os.environ.get('PROFILE_RAW') or 'all'
|
||||||
required = [
|
required_script_dirs = [
|
||||||
|
"scripts/fix",
|
||||||
|
"scripts/lib",
|
||||||
|
"scripts/release",
|
||||||
|
"scripts/run",
|
||||||
|
"scripts/validate",
|
||||||
|
]
|
||||||
|
required_script_files = [
|
||||||
"scripts/validate/manifest.sh",
|
"scripts/validate/manifest.sh",
|
||||||
"scripts/validate/xml_wellformed.sh",
|
"scripts/validate/xml_wellformed.sh",
|
||||||
"scripts/validate/changelog.sh",
|
"scripts/validate/changelog.sh",
|
||||||
@@ -326,7 +329,7 @@ required = [
|
|||||||
"scripts/validate/no_secrets.sh",
|
"scripts/validate/no_secrets.sh",
|
||||||
"scripts/validate/license_headers.sh",
|
"scripts/validate/license_headers.sh",
|
||||||
]
|
]
|
||||||
legacy = [
|
legacy_script_files = [
|
||||||
"scripts/validate_manifest.sh",
|
"scripts/validate_manifest.sh",
|
||||||
"scripts/validate_xml_wellformed.sh",
|
"scripts/validate_xml_wellformed.sh",
|
||||||
"scripts/validate_changelog.sh",
|
"scripts/validate_changelog.sh",
|
||||||
@@ -338,14 +341,23 @@ legacy = [
|
|||||||
"scripts/validate_no_secrets.sh",
|
"scripts/validate_no_secrets.sh",
|
||||||
"scripts/validate_license_headers.sh",
|
"scripts/validate_license_headers.sh",
|
||||||
]
|
]
|
||||||
missing = os.environ.get('MISSING_FILES','').split('\n') if os.environ.get('MISSING_FILES') else []
|
missing_dirs = os.environ.get('MISSING_DIRS','').split('
|
||||||
legacy_present = os.environ.get('LEGACY_PRESENT','').split('\n') if os.environ.get('LEGACY_PRESENT') else []
|
') if os.environ.get('MISSING_DIRS') else []
|
||||||
|
missing_files = os.environ.get('MISSING_FILES','').split('
|
||||||
|
') if os.environ.get('MISSING_FILES') else []
|
||||||
|
legacy_present = os.environ.get('LEGACY_PRESENT','').split('
|
||||||
|
') if os.environ.get('LEGACY_PRESENT') else []
|
||||||
tools = os.environ.get('TOOLS','').split() if os.environ.get('TOOLS') else []
|
tools = os.environ.get('TOOLS','').split() if os.environ.get('TOOLS') else []
|
||||||
out = {
|
out = {
|
||||||
"profile": profile,
|
"profile": profile,
|
||||||
"checked": {"script_files": required, "legacy_script_files": legacy},
|
"checked": {
|
||||||
"missing_script_files": missing,
|
"required_script_dirs": required_script_dirs,
|
||||||
"legacy_present": legacy_present,
|
"required_script_files": required_script_files,
|
||||||
|
"legacy_script_files": legacy_script_files,
|
||||||
|
},
|
||||||
|
"missing_dirs": [x for x in missing_dirs if x],
|
||||||
|
"missing_files": [x for x in missing_files if x],
|
||||||
|
"legacy_present": [x for x in legacy_present if x],
|
||||||
"tools_available": tools,
|
"tools_available": tools,
|
||||||
}
|
}
|
||||||
print(json.dumps(out, indent=2))
|
print(json.dumps(out, indent=2))
|
||||||
@@ -425,7 +437,7 @@ PY
|
|||||||
|
|
||||||
profile="${PROFILE_RAW:-all}"
|
profile="${PROFILE_RAW:-all}"
|
||||||
case "${profile}" in
|
case "${profile}" in
|
||||||
all|release|scripts) ;;
|
all|release|scripts|repo) ;;
|
||||||
*)
|
*)
|
||||||
echo "ERROR: Unknown profile: ${profile}" >> "${GITHUB_STEP_SUMMARY}"
|
echo "ERROR: Unknown profile: ${profile}" >> "${GITHUB_STEP_SUMMARY}"
|
||||||
exit 1
|
exit 1
|
||||||
|
|||||||
Reference in New Issue
Block a user