A GitHub Action that automatically synchronizes documentation from your repository to GitHub Wiki whenever changes are made to your docs folder.
[!IMPORTANT] > Required: Add
permissions: contents: writeto your workflow for this action to work!permissions: contents: write
- π Automatic Sync: Syncs documentation files to your GitHub Wiki on every push
- π Flexible Paths: Configurable documentation folder path
- π« File Exclusion: Exclude specific files from sync (like README.md)
- π Home Page Support: Ensures your wiki has a proper Home.md file
- π Dry Run Mode: Test changes without actually modifying the wiki
- π Detailed Outputs: Returns information about files synced and changes made
- π¨ Colored Logging: Beautiful, colored output for better readability
Add this action to your workflow:
name: Sync Docs to Wiki
on:
push:
paths:
- "docs/**"
branches:
- main
# β οΈ REQUIRED: Grant write permissions for wiki access
permissions:
contents: write
jobs:
sync:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Sync docs to wiki
uses: lukeocodes/wikiinator@v1
# github-token is optional - defaults to {{ github.token }}| Input | Description | Required | Default |
|---|---|---|---|
github-token |
GitHub token with wiki access | No | ${{ github.token }} |
docs-path |
Path to documentation folder | No | docs |
exclude-files |
Comma-separated list of files to exclude | No | README.md |
wiki-home-file |
Name of the file that should be Home.md | No | Home.md |
commit-message |
Custom commit message template | No | Sync docs from main repo |
dry-run |
Run in dry-run mode (no actual changes) | No | false |
| Output | Description |
|---|---|
files-synced |
Number of files that were synced |
changes-made |
Whether any changes were made to the wiki |
- name: Sync docs to wiki
uses: lukeocodes/wikiinator@v1
with:
github-token: ${{ github.token }}- name: Sync docs to wiki
uses: lukeocodes/wikiinator@v1
with:
github-token: ${{ github.token }}
docs-path: "documentation"
exclude-files: "README.md,INTERNAL.md"
wiki-home-file: "Welcome.md"
commit-message: "Update wiki documentation"- name: Sync docs to wiki
id: sync
uses: lukeocodes/wikiinator@v1
with:
github-token: ${{ github.token }}
- name: Check sync results
run: |
echo "Files synced: ${{ steps.sync.outputs.files-synced }}"
echo "Changes made: ${{ steps.sync.outputs.changes-made }}"- name: Test sync (dry run)
uses: lukeocodes/wikiinator@v1
with:
github-token: ${{ github.token }}
dry-run: "true"- Go to your repository Settings β Features
- Check the Wikis checkbox to enable it
- Go to your repository's Wiki tab
- Click Create the first page
- Create any page (e.g., title: "Home", content: "Welcome to the Wiki")
- This initializes the wiki git repository
- Ensure you have a
Home.mdfile in your docs directory - This will become your wiki's main page
- Add
permissions: contents: writeto your workflow - This grants the action write access to the wiki repository
Your repository should have a structure like this:
your-repo/
βββ docs/
β βββ Home.md # Required: Wiki home page
β βββ Installation.md # Will be synced
β βββ Usage.md # Will be synced
β βββ README.md # Excluded by default
βββ .github/
βββ workflows/
βββ sync-wiki.yml
This is the most common issue. The wiki must be manually enabled and initialized:
- Enable Wiki Feature:
- Go to
SettingsβFeaturesβ CheckWikis
- Go to
- Initialize Wiki:
- Go to the
Wikitab β ClickCreate the first page - Create any page (this creates the wiki git repository)
- Go to the
- Verify Setup:
- Your wiki URL should be accessible:
https://github.com/YOUR_USERNAME/YOUR_REPO/wiki
- Your wiki URL should be accessible:
The action requires a Home.md file in your docs directory:
- This file becomes your wiki's main page
- Make sure it exists:
docs/Home.md - Check the file name capitalization
If the action runs but no changes are made:
- Check File Differences: Files might be identical to what's already in the wiki
- Verify Docs Path: Ensure
docs-pathparameter points to the correct directory - Check Exclusions: Make sure your files aren't being excluded by
exclude-files - File Extensions: Only
.mdfiles are synchronized
Most common fix: Add permissions: contents: write to your workflow
permissions:
contents: write
jobs:
sync:
# ... rest of your jobOther permission issues:
- If using a custom token, ensure it has
reposcope - Organization repositories might have additional restrictions
Use dry-run mode to test without making changes:
- uses: lukeocodes/wikiinator@v1
with:
github-token: ${{ github.token }}
dry-run: "true"Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License - see the LICENSE file for details.
If you find this action helpful, please consider giving it a β star on GitHub!