GeezerVison is showing github.com — Repo metadata: each repo's type in .github/logix-repo-metadata.jsonc · openlogix/.github@674ff91
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboard +7Lines changed: 7 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| | 1 | +// This repo's Open Logix metadata, read by repos-janitor (the website repo's | | 2 | +// CLAUDE.md, Repo types, owns the policy). Change it only by pull request. | | 3 | +{ | | 4 | + "$schema": "https://www.openlogix.org/schemas/logix-repo-metadata-v1.json", | | 5 | + // Only read: shared actions, schemas and repos-janitor. | | 6 | + "type": "no-releases" | | 7 | +} |
Collapse file Copy file name to clipboardExpand all lines: CLAUDE.md +3-2Lines changed: 3 additions & 2 deletions - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
@@ -4,11 +4,12 @@ Guidance for Claude working in this repo, `openlogix/.github`. It is GitHub's sp | 4 | 4 |
| 5 | 5 | ## What's here | 6 | 6 |
| 7 | | -**Repo type: no releases** (topic `openlogix-no-releases`; the website repo's `CLAUDE.md`, Repo types, owns the policy). Its tests make no releases (the release tests use a fake `gh`), so it has none. | | 7 | +**Repo type: no releases** (`.github/logix-repo-metadata.jsonc`; the website repo's `CLAUDE.md`, Repo types, owns the policy). Its tests make no releases (the release tests use a fake `gh`), so it has none. | 8 | 8 |
| 9 | 9 | - `actions/<name>/action.yaml`: composite GitHub Actions shared by the Open Logix repos' CI and release workflows. [README.md](README.md) lists them. | 10 | 10 | - `.github/workflows/actions-test.yaml`: tests the actions. | 11 | 11 | - `profile/README.md`: the org page at github.com/openlogix. A table of all Open Logix repos for developers: repo, what it is, status. The repo list, descriptions and statuses follow the website repo's `CLAUDE.md` (Repos, Availability); when those change, update this table too. | | 12 | +- `schemas/logix-repo-metadata-v1.json`: the schema of every repo's `.github/logix-repo-metadata.jsonc` (its type; Repo types, in the website repo's `CLAUDE.md`), owned here, with a copy on the website. | 12 | 13 | - `schemas/logix-remote-config-v1.json`: the schema every remote config names in `$schema` (Remote updates, the website repo's `CLAUDE.md`), owned here; the website serves a copy at `www.openlogix.org/schemas/`, so copy it there whenever it changes. Until the first release it changes without a new version. | 13 | 14 | - `tests/<action>/`: fixtures for an action's tests, such as `tests/check-remote-config/` (cases, fixture releases, a fake `gh` and `run.sh`). | 14 | 15 | - Later, possibly: default community files (`CONTRIBUTING.md`, `SECURITY.md`, issue templates) and `workflow-templates/`. Add them only when asked. | @@ -37,7 +38,7 @@ A workflow here that checks what no single repo's CI can see and reports problem | 37 | 38 | | `schema-copy-should-match` | a website `docs/schemas/` file | | 38 | 39 | | `daily-build-should-pass` | a scheduled workflow's last scheduled run on `main` | | 39 | 40 | | `daily-build-should-be-recent` | the same, run in the last 26 hours | | 40 | | - | `repo-should-have-one-type` | a repo's type topics | | | 41 | + | `repo-metadata-should-be-valid` | a repo's `.github/logix-repo-metadata.jsonc`: present, valid against `schemas/logix-repo-metadata-v1.json` (`type`: `installable`, `dependency`, `no-releases`) | | 41 | 42 | | `repo-should-have-no-releases` | a "no releases" repo | | 42 | 43 |
| 43 | 44 | The rules behind them are the website repo's `CLAUDE.md` (Remote updates, Repo types). | |
Collapse file Copy file name to clipboardExpand all lines: README.md +1-1Lines changed: 1 addition & 1 deletion - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
@@ -51,7 +51,7 @@ The pre-release policy (pre-releases are kept about 5 days unless made stable) i | 51 | 51 |
| 52 | 52 | ## repos-janitor | 53 | 53 |
| 54 | | -[repos-janitor.yaml](.github/workflows/repos-janitor.yaml) checks across the Open Logix repos every 6 hours what no single repo's CI can see, as requirements (as Apio's janitor): remote configs valid, the releases they name valid and (for prod) stable, each repo's Latest right for its type, dev configs not behind prod, release tags that are dates, the website's schema copies, every repo's daily builds, and one type topic per repo. Its run summary lists the errors and warnings, each with why it applies, the result and links to fix it, then what passed; the run, and its badge above, go red on any error. It only reads, and only reports for now. | | 54 | +[repos-janitor.yaml](.github/workflows/repos-janitor.yaml) checks across the Open Logix repos every 6 hours what no single repo's CI can see, as requirements (as Apio's janitor): remote configs valid, the releases they name valid and (for prod) stable, each repo's Latest right for its type, dev configs not behind prod, release tags that are dates, the website's schema copies, every repo's daily builds, and each repo's type in its `.github/logix-repo-metadata.jsonc`. Its run summary lists the errors and warnings, each with why it applies, the result and links to fix it, then what passed; the run, and its badge above, go red on any error. It only reads, and only reports for now. | 55 | 55 |
| 56 | 56 | ## Versions | 57 | 57 |
| |
Collapse file Copy file name to clipboardExpand all lines: repos-janitor/janitor.py +40-23Lines changed: 40 additions & 23 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 48 | 48 | CONFIG_FILE = re.compile(r"^remote-config/([^/]+)/([^/]+)/([^/]+)$") | 49 | 49 | CHANNEL_CONFIG = re.compile(r"^remote-config/[^/]+/[0-9]{3}/(?!channels\.jsonc$)[a-z][a-z0-9-]*\.jsonc$") | 50 | 50 | WORKFLOW = re.compile(r"^\.github/workflows/[^/]+\.ya?ml$") | 51 | | -# Repo types (the website repo's CLAUDE.md, Repo types): one GitHub topic | 52 | | -# per repo. | 53 | | -TYPES = {"openlogix-installable": "installable", "openlogix-dependency": "dependency", | 54 | | - "openlogix-no-releases": "no releases"} | | 51 | +# Repo types (the website repo's CLAUDE.md, Repo types), from each repo's | | 52 | +# metadata file. | | 53 | +METADATA = ".github/logix-repo-metadata.jsonc" | | 54 | +METADATA_SCHEMA = "https://www.openlogix.org/schemas/logix-repo-metadata-v1.json" | | 55 | +TYPES = ["installable", "dependency", "no-releases"] | 55 | 56 | # Where the release model's rules are (Remote updates, Repo types). | 56 | 57 | POLICY_URL = "https://github.com/openlogix/openlogix.github.io/blob/main/CLAUDE.md" | 57 | 58 | DATE_TAG = re.compile(r"^[0-9]{4}-[0-9]{2}-[0-9]{2}$") | | 75 | 76 | "schema-copy-should-match": "Schema copy should match its owner", | 76 | 77 | "daily-build-should-pass": "Daily build should pass", | 77 | 78 | "daily-build-should-be-recent": "Daily build should be recent", | 78 | | - "repo-should-have-one-type": "Repo should have one type", | | 79 | + "repo-metadata-should-be-valid": "Repo metadata should be valid", | 79 | 80 | "repo-should-have-no-releases": "Repo should have no releases", | 80 | 81 | } | 81 | 82 |
| @@ -217,13 +218,29 @@ def __init__(self, info: dict) -> None: | 217 | 218 | self.name = info["full_name"] | 218 | 219 | self.short = info["name"] | 219 | 220 | self.branch = info["default_branch"] | 220 | | - self.topics = sorted(t for t in info.get("topics", []) if t in TYPES) | 221 | | - self.type = TYPES[self.topics[0]] if len(self.topics) == 1 else None | 222 | 221 | tree = api(f"repos/{self.name}/git/trees/{self.branch}?recursive=1") or {} | 223 | 222 | self.files = [t["path"] for t in tree.get("tree", []) if t["type"] == "blob"] | 224 | 223 | self._releases = None | 225 | 224 | self._latest = "unread" | 226 | 225 | self._channels = None | | 226 | + # The metadata file: its problem (None when it's valid) and the type. | | 227 | + self.type, self.metadata_problem = self.read_metadata() | | 228 | + | | 229 | + def read_metadata(self) -> tuple[str | None, str | None]: | | 230 | + if METADATA not in self.files: | | 231 | + return None, f"There's no `{METADATA}`." | | 232 | + try: | | 233 | + data = json.loads(strip_comments(raw(self.name, METADATA, self.branch))) | | 234 | + except ValueError as e: | | 235 | + return None, f"It isn't valid JSONC: {e}" | | 236 | + if not isinstance(data, dict) or data.get("$schema") != METADATA_SCHEMA: | | 237 | + return None, f"Its `$schema` must be `{METADATA_SCHEMA}`." | | 238 | + extra = sorted(set(data) - {"$schema", "type"}) | | 239 | + if extra: | | 240 | + return None, f"It has unknown keys: {', '.join(f'`{k}`' for k in extra)}." | | 241 | + if data.get("type") not in TYPES: | | 242 | + return None, f"Its `type` must be {', '.join(f'`{t}`' for t in TYPES)}, not `{data.get('type')}`." | | 243 | + return data["type"], None | 227 | 244 |
| 228 | 245 | def latest(self) -> str | None: | 229 | 246 | """The tag GitHub marks Latest; None without a stable release, or | @@ -592,25 +609,25 @@ def check_tags(repo: Repo, report: Report) -> None: | 592 | 609 |
| 593 | 610 |
| 594 | 611 | def check_type(repo: Repo, report: Report) -> None: | 595 | | - """repo-should-have-one-type and repo-should-have-no-releases.""" | | 612 | + """repo-metadata-should-be-valid and repo-should-have-no-releases.""" | 596 | 613 | page = f"https://github.com/{repo.name}" | 597 | | - inst = report.require(repo.name, "repo-should-have-one-type", repo.name, f"[{repo.name}]({page})", repo.name) | 598 | | - inst.because("Each Open Logix repo declares its type with one GitHub topic, shown under About on its GitHub page: " | 599 | | - "`openlogix-installable` (people install it), `openlogix-dependency` (programs download it) or " | 600 | | - "`openlogix-no-releases` (it's only read). The type decides its release policy " | 601 | | - f"([Repo types]({POLICY_URL})).") | 602 | | - inst.link("the repo's page (topics under About)", page) | 603 | | - if not repo.topics: | 604 | | - inst.verdict(False, "It has no type topic: add `openlogix-installable`, `openlogix-dependency` " | 605 | | - "or `openlogix-no-releases`.") | 606 | | - return | 607 | | - if len(repo.topics) > 1: | 608 | | - inst.verdict(False, f"It has several: {', '.join(f'`{t}`' for t in repo.topics)}. Keep one.") | | 614 | + file_url = blob(repo.name, repo.branch, METADATA) | | 615 | + inst = report.require(repo.name, "repo-metadata-should-be-valid", repo.name, | | 616 | + f"[`{METADATA}`]({file_url})", METADATA, file=METADATA) | | 617 | + inst.because(f"Each Open Logix repo declares its type in `{METADATA}`: `installable` (people install it), " | | 618 | + "`dependency` (programs download it) or `no-releases` (it's only read). The type decides its " | | 619 | + f"release policy ([Repo types]({POLICY_URL})).") | | 620 | + if METADATA in repo.files: | | 621 | + inst.link("the file", file_url) | | 622 | + else: | | 623 | + inst.link("create the file", f"https://github.com/{repo.name}/new/{repo.branch}?filename={METADATA}") | | 624 | + if repo.metadata_problem: | | 625 | + inst.verdict(False, repo.metadata_problem) | 609 | 626 | return | 610 | | - inst.verdict(True, f"Its type is \"{repo.type}\": it has the topic `{repo.topics[0]}`.") | 611 | | - if repo.type == "no releases": | | 627 | + inst.verdict(True, f"Its type is `{repo.type}`.") | | 628 | + if repo.type == "no-releases": | 612 | 629 | nr = report.require(repo.name, "repo-should-have-no-releases", repo.name, f"[{repo.name}]({page})", repo.name) | 613 | | - nr.because(f"Its type is \"no releases\" (topic `openlogix-no-releases`): it's only read, never downloaded " | | 630 | + nr.because(f"Its type is `no-releases` ([`{METADATA}`]({file_url})): it's only read, never downloaded " | 614 | 631 | f"([Repo types]({POLICY_URL})).").link("the releases", releases_page(repo.name)) | 615 | 632 | tags = [r["tag_name"] for r in repo.all_releases()] | 616 | 633 | nr.verdict(not tags, "It has no releases." if not tags | |
Collapse file Copy file name to clipboard +18Lines changed: 18 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| | 1 | +{ | | 2 | + "$schema": "https://json-schema.org/draft/2020-12/schema", | | 3 | + "$id": "https://www.openlogix.org/schemas/logix-repo-metadata-v1.json", | | 4 | + "title": "Open Logix repo metadata", | | 5 | + "description": "What an Open Logix repo is, for the org's tools: .github/logix-repo-metadata.jsonc in each repo, changed only by pull request. repos-janitor reads it. The file is JSONC: comments say why.", | | 6 | + "type": "object", | | 7 | + "required": ["$schema", "type"], | | 8 | + "properties": { | | 9 | + "$schema": { | | 10 | + "const": "https://www.openlogix.org/schemas/logix-repo-metadata-v1.json" | | 11 | + }, | | 12 | + "type": { | | 13 | + "description": "The repo type, which decides its release policy (Repo types, in the website repo's CLAUDE.md): installable (a product people install, from its release marked Latest; also when programs download it too), dependency (data or tools programs download, as remote configs name them) or no-releases (it's only read: no releases at all).", | | 14 | + "enum": ["installable", "dependency", "no-releases"] | | 15 | + } | | 16 | + }, | | 17 | + "additionalProperties": false | | 18 | +} |
Collapse file Copy file name to clipboardExpand all lines: tests/repos-janitor/expected-output.txt +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
| 12 | 12 | ::error title=Latest should be a prod release (openlogix/logix-studio)::2026-11-02: It's on dev: promote it, or mark a prod release Latest. | 13 | 13 | ::error title=Schema copy should match its owner (openlogix/openlogix.github.io)::docs/schemas/logix-other-v1.json: No owner has schemas/logix-other-v1.json (logix-catalog, .github). | 14 | 14 | ::error title=Schema copy should match its owner (openlogix/openlogix.github.io)::docs/schemas/logix-remote-config-v1.json: It differs from its owner's file: copy it again. | 15 | | -::error title=Repo should have one type (openlogix/openlogix.github.io)::openlogix/openlogix.github.io: It has no type topic: add openlogix-installable, openlogix-dependency or openlogix-no-releases. | | 15 | +::error title=Repo metadata should be valid (openlogix/openlogix.github.io)::.github/logix-repo-metadata.jsonc: There's no .github/logix-repo-metadata.jsonc. | 16 | 16 | repos-janitor: 8 repos, 15 errors, 36 passed. |
Collapse file Copy file name to clipboardExpand all lines: tests/repos-janitor/fake-gh/gh +3-4Lines changed: 3 additions & 4 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 1 | 1 | #!/usr/bin/env python3 | 2 | 2 | """A stand-in for the gh CLI in the repos-janitor tests: answers the calls | 3 | 3 | janitor.py and check_remote_config.py make from the fixture org in | 4 | | -$FAKE_GH_ORG: repos/<owner>/<name>/ with topics (its topics), files/ (the default branch's | 5 | | -files), releases.json, sums/<tag> (SHA256SUMS), files-of/<tag>/<name> (other | | 4 | +$FAKE_GH_ORG: repos/<owner>/<name>/ with files/ (the default branch's | | 5 | +files, such as .github/logix-repo-metadata.jsonc), releases.json, sums/<tag> (SHA256SUMS), files-of/<tag>/<name> (other | 6 | 6 | release files, such as BUILD-INFO.json) and runs/<workflow>.json.""" | 7 | 7 | import json, os, sys | 8 | 8 | from pathlib import Path | @@ -46,8 +46,7 @@ if args[:1] == ["api"]: | 46 | 46 | path, _, query = path.partition("?") | 47 | 47 | parts = path.split("/") | 48 | 48 | if path == "orgs/openlogix/repos": | 49 | | - out([{"full_name": f"openlogix/{d.name}", "name": d.name, "default_branch": "main", "archived": False, | 50 | | - "topics": (d / "topics").read_text().split() if (d / "topics").is_file() else []} | | 49 | + out([{"full_name": f"openlogix/{d.name}", "name": d.name, "default_branch": "main", "archived": False} | 51 | 50 | for d in sorted((org / "repos" / "openlogix").iterdir())]) | 52 | 51 | full = "/".join(parts[1:3]) | 53 | 52 | rest = parts[3:] | |
Collapse file Copy file name to clipboard +5Lines changed: 5 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| | 1 | +// This repo's Open Logix type. | | 2 | +{ | | 3 | + "$schema": "https://www.openlogix.org/schemas/logix-repo-metadata-v1.json", | | 4 | + "type": "no-releases" | | 5 | +} |
Collapse file Copy file name to clipboardExpand all lines: tests/repos-janitor/org/repos/openlogix/.github/topics -1Lines changed: 0 additions & 1 deletion Collapse file Copy file name to clipboard +5Lines changed: 5 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| | 1 | +// This repo's Open Logix type. | | 2 | +{ | | 3 | + "$schema": "https://www.openlogix.org/schemas/logix-repo-metadata-v1.json", | | 4 | + "type": "dependency" | | 5 | +} |
|