Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions .github/workflows/sync-to-wiki.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ on:
- "scripts/**"
- "config.json"
workflow_dispatch:
inputs:
base_ref:
description: "Base ref for diff (e.g. a commit SHA before removals). Defaults to HEAD~1."
required: false

permissions:
contents: write
Expand Down Expand Up @@ -120,7 +124,7 @@ jobs:
- uses: actions/checkout@v4
with:
ref: main
fetch-depth: 2
fetch-depth: ${{ inputs.base_ref && 0 || 2 }}

- uses: actions/setup-python@v5
with:
Expand All @@ -131,7 +135,7 @@ jobs:

- name: Convert changed citations to wikitext
env:
BASE_REF: "HEAD~1"
BASE_REF: ${{ inputs.base_ref || 'HEAD~1' }}
run: python scripts/bib_to_wikitext.py --changed-only

- name: Push to wiki
Expand Down
21 changes: 19 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,12 @@ Both standard BibTeX formats are supported:

The first author listed automatically gets the "first author" flag.

## Removing a citation

Delete the BibTeX entry from `references.bib` and open a pull request. The PR summary will list removed entries and note that their wiki pages will be deleted on merge.

When the PR merges, the sync job automatically deletes the corresponding wiki pages via the MediaWiki API. The bot account must have the **Delete pages** permission (see [Creating a bot account](#creating-a-bot-account)).

## Manual enrichment on the wiki

The converter wraps generated content in markers:
Expand Down Expand Up @@ -150,13 +156,24 @@ python scripts/push_to_wiki.py
The push script:
- Creates new pages for new entries
- Updates existing pages by replacing content between markers only
- Deletes pages for entries removed from the `.bib` files
- Skips pages where content hasn't changed
- Reports a summary of created/updated/unchanged/error counts
- Reports a summary of created/updated/unchanged/deleted/error counts

## GitHub Action

The workflow at `.github/workflows/sync-to-wiki.yml` runs automatically on pushes to main that modify `.bib` files, `scripts/`, or `config.json`. It can also be triggered manually from the Actions tab.

### Re-syncing older changes

The sync job normally compares against the previous commit (`HEAD~1`). If a sync fails (e.g., the bot lacked permissions) and the changes are already merged, you can re-run it against an older commit:

1. Go to **Actions → Sync citations to wiki → Run workflow**
2. Enter a commit SHA in the **base_ref** field (e.g., the commit before the failed change)
3. Click **Run workflow**

This will diff the current state against that older commit and re-apply any creates, updates, or deletions that were missed.

### Required secrets

Set these in the repository settings under Settings > Secrets and variables > Actions:
Expand All @@ -172,7 +189,7 @@ Set these in the repository settings under Settings > Secrets and variables > Ac
1. Log in to the wiki as an admin
2. Go to `Special:BotPasswords`
3. Create a new bot with the name `citations-sync`
4. Grant permissions: **Edit existing pages**, **Create, edit, and move pages**, **High-volume editing**
4. Grant permissions: **Edit existing pages**, **Create, edit, and move pages**, **Delete pages**, **High-volume editing**
5. Save the generated password — this is `WIKI_BOT_PASSWORD`
6. The username is `YourUsername@citations-sync` — this is `WIKI_BOT_USERNAME`

Expand Down