#546 Mirror Forgejo and Gitea, and commits, branches and forks (#538)
–
- github
- github/openchronology/timeline-app
- github/openchronology/timeline-app#546
- pull request
- state:merged
Part of #538. Adds Forgejo and Gitea, and commits, branches and forks, and changes the importer to one repository per timeline with `--only`/`--except`. This is stacked on #544, and needs #545 (128-character tags) to merge first. GitLab follows in its own PR. ## Repositories named on their host A repository is now a reference: `owner/name` on github.com, and ` : / ` elsewhere. | | Repository | Item | Person | | --- | --- | --- | --- | | github.com | `github/acme/app` | `github/acme/app#412` | `github/mona` | | Forgejo / Gitea | `forgejo:codeberg.org/acme/app` | `forgejo:codeberg.org/acme/app#5` | `forgejo:codeberg.org/mona` | | GitHub Enterprise | `github:ghe.example.com/acme/app` | `…#5` | | | GitLab (next PR) | `gitlab/group/sub/app`, or `gitlab: /…` self-hosted | `…#12` for issues, `…!7` for merge requests | | - **IDs** name the host too (`fj:codeberg.org:acme:app:5`). - **Routing rules** match references, with `*` for everything under an owner or group. - **Mention titles** are written as the platform would from the item: `#12`, then `owner/name#12`, then the whole reference across hosts. ## Forgejo and Gitea `server/forgejo-source.mjs` translates Forgejo's timelines and webhook deliveries into GitHub's shapes, so all the mapping is shared. - **Receiver:** it tells platforms apart by their headers, each with its own secret. `FORGEJO_WEBHOOK_SECRET` is checked against the bare hex HMAC. - **Importer:** it uses Forgejo's API, `token` auth (`FORGEJO_TOKEN`) and `limit` paging. - **Labels:** Forgejo's deliveries say only that labels changed, so the duration's tags follow without a moment. The importer still records label moments from timelines. **Checked against git.araliasoftware.com** (Forgejo 16, read-only): a dry run of `athan/openchronology-publicity` read items, merges, renames, mentions and links in 6 requests. ## Commits, branches and forks **Commits** are moments on their repository, at the time they were authored, titled with the message's first line. - **Tags:** the platform, the repository's tag, `commit`, the branch as named (`feat/new_feature`), and the author's account. - **No hashes:** the hash is in the ID and the address, never in a tag. Email addresses are never copied. - **Links:** a commit that names an item is linked to it. **Which branch** a commit is tagged with: - **Importer:** it reads the default branch first, then each other branch only as far as its own commits, and skips branches whose head it has already read. A full import of this repository read 833 commits in 26 requests; before the skip it took 292. - **Receiver:** it tags each push with its branch, and keeps commits that GitHub marks as already pushed elsewhere. **Branches** are moments when created or deleted (live), or when they began, at their first commit of their own (imported). **Forks** are moments too. ## Choosing what to import Items, commits, branches and forks are now kinds like the events. - **Importer:** `--only commits` or `--except forks,branches`, replacing `--events` and `--no-events`. - **Routing rules:** `"only"` and `"except"`, the same way. - **Without items:** their durations and links are left out, and `--only commits` reads no items at all. - **One repository per timeline:** `--repo` and `--timeline` are each given once, and a second `--repo` is refused. ## Tests - **Unit:** 26 GitHub and Forgejo tests pass, against fake APIs. They cover references, tags and IDs, Forgejo's timelines, deliveries, signatures, receiver and importer, commits and their branches, branch and fork moments, and the command's arguments. `npm test` passes apart from `contents.test.mjs`, which fails locally with git `ENOBUFS`. - **Real dry runs:** against this repository, both commits only and everything, and against the Forgejo repository above. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_011fFY8eruEi1xAkkMBni13B https://github.com/openchronology/timeline-app/pull/546
Related
- #538 Work-item sources: aggregate GitHub assignments, then Planner and kanban boards
- #544 Ship the GitHub receiver and och-import-github in every server package (#538)
- #545 Let events carry tags of up to 128 characters
- #547 Mirror GitLab projects: issues, merge requests and commits (#538)
- Merge pull request #546 from openchronology/feature/forges
Open #546 Mirror Forgejo and Gitea, and commits, branches and forks (#538) in the timeline