59 lines
1.6 KiB
YAML
59 lines
1.6 KiB
YAML
name: Regenerate Documentation Index
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
paths:
|
|
- '**.md'
|
|
- 'tools/generate_index.py'
|
|
|
|
jobs:
|
|
regenerate-index:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 2
|
|
|
|
- name: Set up Python
|
|
run: |
|
|
apt-get update -qq && apt-get install -y -qq python3 > /dev/null
|
|
ln -sf /usr/bin/python3 /usr/bin/python
|
|
|
|
- name: Check if markdown files changed
|
|
id: check_changes
|
|
run: |
|
|
CHANGED_FILES=$(git diff --name-only HEAD^ HEAD)
|
|
|
|
if echo "$CHANGED_FILES" | grep -q '\.md$'; then
|
|
echo "md_changed=true" >> $GITHUB_OUTPUT
|
|
else
|
|
echo "md_changed=false" >> $GITHUB_OUTPUT
|
|
fi
|
|
|
|
- name: Generate documentation index
|
|
if: steps.check_changes.outputs.md_changed == 'true'
|
|
run: |
|
|
python tools/generate_index.py
|
|
|
|
- name: Check if index changed
|
|
if: steps.check_changes.outputs.md_changed == 'true'
|
|
id: check_index
|
|
run: |
|
|
if git diff --quiet .docs-index.json; then
|
|
echo "index_changed=false" >> $GITHUB_OUTPUT
|
|
else
|
|
echo "index_changed=true" >> $GITHUB_OUTPUT
|
|
fi
|
|
|
|
- name: Commit and push index
|
|
if: steps.check_index.outputs.index_changed == 'true'
|
|
run: |
|
|
git config user.name "digiBandit"
|
|
git config user.email "joey.king@dbits.ca"
|
|
git add .docs-index.json
|
|
git commit -m "Update documentation index (auto-generated)"
|
|
git push
|