From fc57481f6ba6e427e67dd416a5eaed88573a35c1 Mon Sep 17 00:00:00 2001 From: daharoni Date: Wed, 8 Apr 2026 10:22:47 -0700 Subject: [PATCH 1/2] Add base_ref input to workflow_dispatch for re-syncing Allows manually triggering the sync job with a custom base ref, so deletions or changes from older commits can be re-applied. Fetches full history when a custom base_ref is provided. Co-Authored-By: Claude Opus 4.6 (1M context) --- .github/workflows/sync-to-wiki.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/sync-to-wiki.yml b/.github/workflows/sync-to-wiki.yml index e858af5..1b8f1ac 100644 --- a/.github/workflows/sync-to-wiki.yml +++ b/.github/workflows/sync-to-wiki.yml @@ -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 @@ -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: @@ -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 From a0ae30919e381cb4c8be2d704a5ec64b81d14704 Mon Sep 17 00:00:00 2001 From: daharoni Date: Wed, 8 Apr 2026 10:24:41 -0700 Subject: [PATCH 2/2] Document citation removal, re-syncing, and bot delete permission Co-Authored-By: Claude Opus 4.6 (1M context) --- README.md | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index c6c7c07..8d3cbb2 100644 --- a/README.md +++ b/README.md @@ -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: @@ -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: @@ -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`