check-dependency-graph.yml
Run the self-test of a notes repository’s vendored build_dependency_graph.py, then build the graph of its definition and result divs and fail on a cycle.
The script comes from the build-dependency-graph action. Notes repositories vendor it under tools/ so that a local render can run it as a pre-render step. Nothing else runs the vendored copy’s self-test, so a change to the script in one repository can break it without any check going red.
What it does
- Runs
<script-dir>/tests/test_build_dependency_graph.py. - Runs
<script-dir>/build_dependency_graph.pyon the pages, writing the JSON to the runner’s temporary directory. Withfail-on-cycleit exits non-zero when a definition or result div depends on itself through other divs.
Forward references are printed and never fail the job.
Inputs
| Input | Type | Default | Description |
|---|---|---|---|
script-dir |
string | tools |
Directory holding the vendored script, with its self-test under tests/. |
pages-dir |
string | chapters |
Directory under the repository root holding the pages (. when pages sit at the root). |
site |
string | the repository name | This site’s name in cross-site node keys. |
fail-on-cycle |
boolean | true |
Fail the job when the graph has a cycle (else warn only). |
runs-on |
string | empty (CI_RUNNER variable, else ubuntu-latest) |
Runner label for the job. Use a self-hosted label only for a private repository; never for a public one, whose pull requests can run arbitrary code on it (#1167). |
Permissions
Only contents: read (the default), so no permissions: block is needed.
Example
name: Check dependency graph
on:
push: { branches: [main] }
pull_request:
jobs:
check:
uses: Morrison-Lab/gha/.github/workflows/check-dependency-graph.yml@v3
# with:
# pages-dir: .
# runs-on: private-runner # self-hosted runner label (private repositories only)See check-dependency-graph.yml in examples/ for the full caller stub.