Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: CI

on:
pull_request:
push:
branches:
- main
- "moltenhub-*"

jobs:
validate-repo:
name: Validate Repository
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v4

- name: Run repository validator
run: ./scripts/validate-repo.sh
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.codex
.task-logs/
.moltenhub-agents-*.md
AGENTS.md
20 changes: 19 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,19 @@
# .github
# MoltenBot `.github` Repository

This repository contains organization-level metadata and guardrails used by automation for the `Molten-Bot` GitHub org.

## Repository Layout

- `profile/README.md`: public organization profile content.
- `scripts/validate-repo.sh`: local and CI repository policy validator.
- `.github/workflows/ci.yml`: CI entrypoint that runs repository validation.

## Task Routing

Use this repository for:

- organization profile documentation updates.
- GitHub automation and repository policy checks.
- git hygiene updates that prevent generated task artifacts from being committed.

Do not use this repository for product/runtime application features. Those belong in the corresponding service repositories.
69 changes: 69 additions & 0 deletions scripts/validate-repo.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
#!/usr/bin/env bash
set -euo pipefail

repo_root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
cd "$repo_root"

error_count=0

report_error() {
echo "error: $1" >&2
error_count=$((error_count + 1))
}

required_files=(
".gitignore"
"README.md"
"profile/README.md"
"scripts/validate-repo.sh"
".github/workflows/ci.yml"
)

for required_file in "${required_files[@]}"; do
if [[ ! -f "$required_file" ]]; then
report_error "missing required file '$required_file'"
fi
done

required_ignore_patterns=(
".codex"
".task-logs/"
".moltenhub-agents-*.md"
)

if [[ -f ".gitignore" ]]; then
for required_ignore_pattern in "${required_ignore_patterns[@]}"; do
if ! grep -Fxq "$required_ignore_pattern" .gitignore; then
report_error ".gitignore is missing '$required_ignore_pattern'"
fi
done
fi

if git ls-files --error-unmatch .codex >/dev/null 2>&1; then
report_error ".codex is tracked but should be ignored"
fi

if git ls-files | grep -Eq '^\.task-logs/'; then
report_error "files under .task-logs/ are tracked but should be ignored"
fi

if git ls-files | grep -Eq '^\.moltenhub-agents-[0-9]+\.md$'; then
report_error ".moltenhub-agents-*.md files are tracked but should be ignored"
fi

if [[ -f "README.md" ]] && ! grep -Eq '^[[:space:]]*##[[:space:]]+Task Routing[[:space:]]*$' README.md; then
report_error "README.md must include the 'Task Routing' section"
fi

while IFS= read -r markdown_file; do
if grep -Eq '[[:blank:]]+$' "$markdown_file"; then
report_error "trailing whitespace found in $markdown_file"
fi
done < <(git ls-files '*.md')

if (( error_count > 0 )); then
echo "validation failed with $error_count error(s)" >&2
exit 1
fi

echo "validation passed"
Loading