111 lines
3.1 KiB
YAML
111 lines
3.1 KiB
YAML
name: Codex Template Compliance
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
- master
|
|
- feature/create-addon-port
|
|
pull_request:
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
template-compliance:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Check required Codex files
|
|
shell: bash
|
|
run: |
|
|
missing=0
|
|
|
|
required_files=(
|
|
"AGENTS.md"
|
|
".codex/project.md"
|
|
"README.md"
|
|
)
|
|
|
|
recommended_files=(
|
|
"SECURITY.md"
|
|
"CHANGELOG.md"
|
|
"CONTRIBUTING.md"
|
|
"docs/agent-handoff.md"
|
|
"docs/security-review.md"
|
|
"docs/release-checklist.md"
|
|
)
|
|
|
|
for file in "${required_files[@]}"; do
|
|
if [ ! -f "$file" ]; then
|
|
echo "Missing required Codex file: $file"
|
|
missing=1
|
|
fi
|
|
done
|
|
|
|
for file in "${recommended_files[@]}"; do
|
|
if [ ! -f "$file" ]; then
|
|
echo "Recommended Codex file not found: $file"
|
|
fi
|
|
done
|
|
|
|
if [ "$missing" -eq 1 ]; then
|
|
exit 1
|
|
fi
|
|
|
|
- name: Check unresolved placeholders
|
|
shell: bash
|
|
run: |
|
|
found=0
|
|
paths=(AGENTS.md README.md SECURITY.md CHANGELOG.md CONTRIBUTING.md .codex docs)
|
|
pattern='PROJECT_NAME|PROJECT_DESCRIPTION|REPOSITORY_OWNER|REPOSITORY_NAME|PACKAGE_NAME|ARTIFACT_NAME|ARTIFACT_OUTPUT_DIRECTORY|AUTHOR_NAME|PROJECT_STACK|DOWNLOAD_URL|BUILD_COMMAND|TEST_COMMAND|LINT_COMMAND|AUDIT_COMMAND|README_COMMAND|INSTALL_COMMAND|DEV_COMMAND|PACKAGE_MANAGER|PROJECT_VERSION'
|
|
|
|
for path in "${paths[@]}"; do
|
|
[ -e "$path" ] || continue
|
|
if grep -RInE --exclude-dir=.git "$pattern" "$path"; then
|
|
found=1
|
|
fi
|
|
done
|
|
|
|
if [ "$found" -eq 1 ]; then
|
|
echo "Unresolved template placeholders found. Replace real values or mark genuinely unknown values as PENDING."
|
|
exit 1
|
|
fi
|
|
|
|
- name: Check workflow baseline
|
|
shell: bash
|
|
run: |
|
|
echo "Detected Gitea workflows:"
|
|
find .gitea/workflows -maxdepth 1 -type f -name '*.yml' -print 2>/dev/null || true
|
|
|
|
required_workflows=(
|
|
".gitea/workflows/build.yml"
|
|
".gitea/workflows/security-scan.yml"
|
|
".gitea/workflows/repo-cleanup.yml"
|
|
".gitea/workflows/dependency-check.yml"
|
|
".gitea/workflows/release-dry-run.yml"
|
|
".gitea/workflows/template-compliance.yml"
|
|
)
|
|
|
|
missing=0
|
|
for file in "${required_workflows[@]}"; do
|
|
if [ ! -f "$file" ]; then
|
|
echo "Missing workflow: $file"
|
|
missing=1
|
|
fi
|
|
done
|
|
|
|
if [ "$missing" -eq 1 ]; then
|
|
exit 1
|
|
fi
|
|
|
|
- name: Compliance guidance
|
|
shell: bash
|
|
run: |
|
|
cat <<'EOF'
|
|
Codex template compliance check completed.
|
|
|
|
This workflow verifies agent context and template hygiene. It does
|
|
not change files automatically.
|
|
EOF
|