Skip to content

Health Score

Health Score #38

Workflow file for this run

name: Health Score
on:
push:
branches: [main]
pull_request:
branches: [main]
schedule:
# Nightly at 17:07 UTC (02:07 JST) — off-minute to avoid thundering herd.
- cron: "7 17 * * *"
permissions:
contents: read
pull-requests: write
jobs:
score:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install autoforge
run: pip install -e .
- name: Compute health score
id: score
run: |
echo "=== autoforge-score ==="
PYTHONPATH=. python3 -m autoforge.harness.score --dir . | tee /tmp/score.txt
PYTHONPATH=. python3 -m autoforge.harness.score --dir . --json > /tmp/score.json
# Extract total + grade for downstream steps.
TOTAL=$(python3 -c "import json; d=json.load(open('/tmp/score.json')); print(d['total'])")
GRADE=$(python3 -c "import json; d=json.load(open('/tmp/score.json')); print(d['grade'])")
echo "total=$TOTAL" >> "$GITHUB_OUTPUT"
echo "grade=$GRADE" >> "$GITHUB_OUTPUT"
- name: Run suggestions
run: |
echo "=== autoforge-suggest (top 5) ==="
PYTHONPATH=. python3 -m autoforge.harness.suggest --dir . --top 5
- name: Write job summary
run: |
{
echo "## autoforge health: ${{ steps.score.outputs.total }}% ${{ steps.score.outputs.grade }}"
echo ""
echo '```'
cat /tmp/score.txt
echo '```'
echo ""
echo "**Commit:** \`${GITHUB_SHA::8}\`"
} >> "$GITHUB_STEP_SUMMARY"
- name: Gate — fail if score < 80
run: |
TOTAL=${{ steps.score.outputs.total }}
if [ "$TOTAL" -lt 80 ]; then
echo "::error::Health score $TOTAL% is below the 80% threshold."
exit 1
fi
echo "Health score $TOTAL% passes the 80% threshold."