Moves only; no behaviour changes. Every file now lives under the part of the project it belongs to, each section has a README, and docs/PRIVACY.md collects the rules all parts follow. core/ engine.js, graph.js, solver.js, python/clean.py collection/ sources/ (form, register, PDF check, daily update), bot/ (importer) analysis/ stats/ (Python statistics), network/ (build-graph.js), reports/ (POLICY.md) planner/ build-policy.js, policy-report.js site/ atlas/ (the page), build.js, qa/ tests/ core/ (unit), parity/ (JS vs Python), fixtures/ Checked against the previous layout: tests pass; coded runs, test outputs, graph.json and policy.json are byte-identical; the built site differs only in comments that name file paths. The published file names Ken's bot downloads (solver.js, graph.js, data/policy.json) are unchanged. Also removes the undefined/ folder of QA screenshots committed by mistake (the QA scripts now default to a temp folder) and test.txt, and drops the unused npm workspaces. Claude-Session: https://claude.ai/code/session_01UCzTd31GphpMXDhQqWrCMQ Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
62 lines
2.4 KiB
YAML
62 lines
2.4 KiB
YAML
name: Check sources for new data
|
|
on:
|
|
schedule:
|
|
- cron: "23 10 * * *" # daily
|
|
workflow_dispatch:
|
|
permissions:
|
|
contents: write
|
|
pull-requests: write
|
|
issues: write
|
|
jobs:
|
|
check:
|
|
runs-on: ubuntu-latest
|
|
env:
|
|
# secrets cannot be tested in `if:` directly
|
|
HAS_BOT_TOKEN: ${{ secrets.ATLAS_BOT_TOKEN != '' }}
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: actions/setup-node@v4
|
|
with:
|
|
node-version: 20
|
|
- uses: actions/setup-python@v5
|
|
with:
|
|
python-version: "3.12"
|
|
- run: pip install -r requirements.txt
|
|
- id: check
|
|
run: python collection/sources/update_sources.py --report "$RUNNER_TEMP/report.md"
|
|
- name: Rebuild graph and run tests
|
|
if: steps.check.outputs.changed == 'true'
|
|
run: |
|
|
node analysis/network/build-graph.js
|
|
npm run policy
|
|
npm test
|
|
# The PR is opened with ATLAS_BOT_TOKEN (a fine-grained token, see docs/REPO_SETTINGS.md) when it is set:
|
|
# changes made with the built-in GITHUB_TOKEN do not start other workflows, so its merge would not
|
|
# redeploy the site. Without the secret it falls back to GITHUB_TOKEN and the PR waits for a manual merge.
|
|
- name: Open a pull request with the new data
|
|
id: pr
|
|
if: steps.check.outputs.changed == 'true'
|
|
uses: peter-evans/create-pull-request@v6
|
|
with:
|
|
token: ${{ secrets.ATLAS_BOT_TOKEN || github.token }}
|
|
branch: data/source-update
|
|
delete-branch: true
|
|
commit-message: "data: update from community sources"
|
|
title: "New data from the community sources"
|
|
body-path: ${{ runner.temp }}/report.md
|
|
labels: data
|
|
- name: Merge it automatically once CI passes
|
|
if: steps.pr.outputs.pull-request-number != '' && env.HAS_BOT_TOKEN == 'true'
|
|
env:
|
|
GH_TOKEN: ${{ secrets.ATLAS_BOT_TOKEN }}
|
|
run: gh pr merge "${{ steps.pr.outputs.pull-request-number }}" --auto --squash
|
|
- name: Report a broken source link
|
|
if: steps.check.outputs.failed != ''
|
|
env:
|
|
GH_TOKEN: ${{ github.token }}
|
|
run: |
|
|
title="Source check failed: ${{ steps.check.outputs.failed }}"
|
|
if ! gh issue list --state open --search "$title in:title" --json number --jq '.[0].number' | grep -q .; then
|
|
gh issue create --title "$title" --body-file "$RUNNER_TEMP/report.md"
|
|
fi
|