2026-06-09 10:51:47 +09:00
# pipelines/songs
Publishes lyric pages from `mikkeli/ncmr-songs` to `https://wiki.novoyuuparosk.org` .
2026-06-09 11:22:41 +09:00
- Source-file contract (frontmatter and body conventions): [SCHEMA.md ](SCHEMA.md )
- Cross-cutting setup (wiki URL, bot identity, runner, Gitea secrets/variables): [repo root README ](../../README.md )
2026-06-09 10:51:47 +09:00
## v1 scope
Implemented:
- YAML frontmatter parsing per [SCHEMA.md ](SCHEMA.md )
- Pandoc-based markdown → wikitext body rendering
- First-line h1 stripping
2026-06-09 18:39:13 +09:00
- Auto-generated banner (`{{Auto-generated|source=...|commit=<sha>}}` ) + album category injection
- MediaWiki bot API write with idempotency — no-op if wiki content matches generated output
- Files without `wiki.publish: true` silently skipped
- Pages with existing non-auto-generated content skipped (logged to stderr) — delete the page or add the banner to hand ownership to the bot
2026-06-09 10:51:47 +09:00
Deferred (schema reserves the fields; renderer doesn't yet act on them):
- LRC parsing and embedding
- Inter-page sibling placeholder resolution
- Multi-language metadata (the body conveys what languages exist; renderer doesn't introspect)
- Auto-generated album index pages (intentionally NOT done — user writes album category-page descriptions freeform)
2026-06-09 11:22:41 +09:00
## Source repo and branch convention
Source repo: `mikkeli/ncmr-songs` . The pipeline triggers on push to `master` .
**Branch convention in `ncmr-songs` ** : per-song short-lived branches named `autowiki/<song-slug>` (e.g., `autowiki/pulse` ). Create when staging edits, merge to master when ready to publish, delete after one cycle.
**Excluded paths ** (won't trigger the pipeline):
- `wip/**`
- `README.md` , `.gitignore` , `.claude/**`
2026-06-09 10:51:47 +09:00
## Invocation
2026-06-09 18:39:13 +09:00
The pipeline runs as a self-contained Gitea Actions workflow in `mikkeli/ncmr-songs` (`.gitea/workflows/publish.yml` ). It clones this repo at runtime to get the renderer.
2026-06-09 10:51:47 +09:00
2026-06-09 18:39:13 +09:00
Triggers:
- `push` to `master` (path-filtered as above)
- `workflow_dispatch` — manual trigger from the Gitea Actions UI; useful after renderer or template changes without needing a dummy commit
### Environment (secrets and variables)
2026-06-09 10:51:47 +09:00
2026-06-09 11:22:41 +09:00
| Name | Kind | Source | Purpose |
|---|---|---|---|
| `WIKI_API_URL` | variable | Gitea (cross-cutting) | MediaWiki action API endpoint |
2026-06-09 18:39:13 +09:00
| `WIKI_BASE_URL` | variable | Gitea (cross-cutting) | Wiki base URL |
| `WIKI_BOT_USER` | secret | Gitea (cross-cutting) | Bot login (`Dubrowski@giteaAutomaton` ) |
2026-06-09 11:22:41 +09:00
| `WIKI_BOT_PASSWORD` | secret | Gitea (cross-cutting) | BotPasswords value |
2026-06-09 18:39:13 +09:00
| `URL_TO_GITEA` | variable | Gitea (cross-cutting) | Gitea instance base URL for cloning |
| `FAPAT` | secret | Gitea (cross-cutting) | Full-Access PAT for cloning private repos |
| `SOURCE_REF` | env (set in workflow) | `github.sha` | Pushed commit SHA, used in banner and edit summary |
| `GITEA_REPO_URL` | env (set in workflow) | composed from vars | Source-file URL base for the banner link |
2026-06-09 10:51:47 +09:00
## Dependencies
2026-06-09 18:39:13 +09:00
- Python 3.12+ (job container: `python:3.12-slim` )
- Pandoc (apt-installed in the job container)
- `python-frontmatter` , `mwclient` , `PyYAML` — see `requirements.txt`
2026-06-09 10:51:47 +09:00
2026-06-09 18:39:13 +09:00
## Modes
2026-06-09 10:51:47 +09:00
2026-06-09 18:39:13 +09:00
The pipeline always runs `--all` : every file with `wiki.publish: true` (not under `wip/` ) is checked against the current wiki content. Writes only happen when content has changed (commit SHA in the banner drives idempotency). This is appropriate for the current repo size.
2026-06-09 10:51:47 +09:00
2026-06-09 18:39:13 +09:00
## One-off wiki setup
2026-06-09 10:51:47 +09:00
2026-06-09 18:39:13 +09:00
- [x] * * `Template:Auto-generated` ** — exists on the wiki. Wikitext source: `template_auto_generated.wikitext` in this directory.
- [x] **Bot user in `bot` group ** — grants `skipcaptcha` ; verified working.
2026-06-09 10:51:47 +09:00
2026-06-09 11:22:41 +09:00
## Decisions log (songs pipeline)
| Decision | Value | Date |
|---|---|---|
| Metadata source | YAML frontmatter inside each `.md` (see [SCHEMA.md ](SCHEMA.md )) | 2026-06-09 |
| Body rendering | Pandoc-based, with a thin Python pre/post-processor | 2026-06-09 |
| Excluded paths | `wip/**` , plus repo-meta files | 2026-06-09 |
| Page template | Designed from scratch (no existing wiki pages to mirror) | 2026-06-09 |
2026-06-09 18:39:13 +09:00
| Album landing pages | Auto-injected `[[Category:<album>]]` ; the wiki category page is user-written and not overwritten | 2026-06-09 |
2026-06-09 11:22:41 +09:00
| Source-repo branch convention | `autowiki/<song-slug>` short-lived branches in `ncmr-songs` | 2026-06-09 |
2026-06-09 18:39:13 +09:00
| Idempotency | Commit SHA in banner (`commit=<sha>` ), not timestamp — stable across identical re-runs | 2026-06-09 |
| Publish mode | Always `--all` ; no diff detection — small repo, simpler than fragile git-diff gating | 2026-06-09 |
| Manual-page protection | Bot skips pages without the `{{Auto-generated` banner to avoid overwriting hand-written content | 2026-06-09 |
| `workflow_call` abandoned | Cross-repo `workflow_call` fails — run token scoped to triggering repo; cannot clone private callee | 2026-06-09 |
2026-06-09 11:22:41 +09:00
## Status
2026-06-09 18:39:13 +09:00
v1 live. Pipeline active and publishing to https://wiki.novoyuuparosk.org.