Skip to content

Documentation Auto-Builder #61

Documentation Auto-Builder

Documentation Auto-Builder #61

name: Documentation Auto-Builder
# Controls when the action will run
on:
schedule:
# Run once every 24 hours
- cron: '0 0 * * *' # This will run at midnight UTC every day
workflow_dispatch: # Allows manual triggering
# The list of jobs to be run as part of this workflow
jobs:
run-python:
runs-on: ubuntu-latest # The environment to run the job
steps:
# Step 1: Checkout the repository to get access to your Python script
- name: Checkout repository
uses: actions/checkout@v3
# Step 2: Set up Python
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10' # Specify the Python version you need
# Step 3: Install dependencies (optional) - skipped as not required
# Step 4: Run your Python script
- name: Documentation Auto-Builder process
run: python "documentation autobuilder/script.py"
# Step 5: Check for changes in the generated folder
- name: Check for changes
id: check_changes
run: |
git diff --exit-code docs/library_breakdown/ || echo "Changes detected" > changes.txt
continue-on-error: true
# Step 6: Commit and push changes if there are any
- name: Commit updated documentation
if: steps.check_changes.outcome == 'success'
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
git add docs/library_breakdown/ # Add the generated files
git commit -m 'Updated documentation'
git push
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Step 7: Trigger Read the Docs build
- name: Trigger Read the Docs build
run: |
curl -X POST -H "Authorization: Token ${{ secrets.RTD_TOKEN }}" \
-H "Content-Type: application/json" \
-d '{"branch": "main"}' \
https://readthedocs.org/api/v3/projects/pmma/versions/latest/builds/