Tighten the repo-state automation so canonical bot commits remain predictable while leaving main clean after each sync. Make the public catalog UI more honest by hiding dev-only sync, turning stars into explicit browser-local saves, aligning risk types, and removing hardcoded catalog counts. Add shared public asset URL helpers, risk suggestion plumbing, safer unpack/sync guards, and CI coverage gates so release and maintainer workflows catch drift earlier.
82 lines
2.2 KiB
YAML
82 lines
2.2 KiB
YAML
name: Repo Hygiene
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
schedule:
|
|
- cron: "0 7 * * 1"
|
|
|
|
permissions:
|
|
contents: write
|
|
|
|
jobs:
|
|
sync-repo-state:
|
|
runs-on: ubuntu-latest
|
|
concurrency:
|
|
group: canonical-main-sync
|
|
cancel-in-progress: false
|
|
env:
|
|
GH_TOKEN: ${{ github.token }}
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Set up Python
|
|
uses: actions/setup-python@v5
|
|
with:
|
|
python-version: "3.10"
|
|
|
|
- name: Install Python dependencies
|
|
run: pip install -r tools/requirements.txt
|
|
|
|
- name: Set up Node
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: "lts/*"
|
|
cache: "npm"
|
|
|
|
- name: Install npm dependencies
|
|
run: npm ci
|
|
|
|
- name: Audit npm dependencies
|
|
run: npm audit --audit-level=high
|
|
|
|
- name: Run repo-state sync
|
|
run: npm run sync:repo-state
|
|
|
|
- name: Commit and push if changed
|
|
run: |
|
|
set -euo pipefail
|
|
|
|
mapfile -t managed_files < <(node tools/scripts/generated_files.js --include-mixed)
|
|
if [ "${#managed_files[@]}" -eq 0 ]; then
|
|
echo "No managed files resolved from generated_files contract."
|
|
exit 1
|
|
fi
|
|
|
|
if git diff --quiet && [ -z "$(git ls-files --others --exclude-standard)" ]; then
|
|
echo "No repo-state drift detected."
|
|
exit 0
|
|
fi
|
|
|
|
git config user.name "github-actions[bot]"
|
|
git config user.email "github-actions[bot]@users.noreply.github.com"
|
|
git fetch origin main
|
|
git add -- "${managed_files[@]}" || true
|
|
|
|
if git diff --cached --quiet; then
|
|
echo "Repo hygiene produced unmanaged drift only."
|
|
git status --short
|
|
exit 1
|
|
fi
|
|
|
|
if [ -n "$(git diff --name-only)" ] || [ -n "$(git ls-files --others --exclude-standard)" ]; then
|
|
echo "Repo hygiene produced unmanaged drift alongside canonical changes."
|
|
git status --short
|
|
exit 1
|
|
fi
|
|
|
|
git commit -m "chore: scheduled repo hygiene sync [ci skip]"
|
|
git pull origin main --rebase
|
|
git push origin HEAD
|