Skip to content

Update Documentation #5

Update Documentation

Update Documentation #5

Workflow file for this run

# Author: Parth Sali
# Description: Weekly automation to update study material documentation
name: Update Documentation
on:
schedule:
# Run every Monday at 00:00 UTC
- cron: "0 0 * * 1"
workflow_dispatch:
# Allow manual trigger
jobs:
generate-docs:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Check if auto-update is enabled
id: check_config
run: |
# Extract ENABLE_AUTO_UPDATE value from config.js
ENABLED=$(node -e "const config = require('./config.js'); console.log(config.ENABLE_AUTO_UPDATE);")
echo "enabled=$ENABLED" >> $GITHUB_OUTPUT
if [ "$ENABLED" != "true" ]; then
echo "⚠️ Auto-update is disabled in config.js"
echo "This is likely a template repository. Skipping workflow."
exit 0
fi
echo "✅ Auto-update is enabled. Proceeding with documentation generation."
- name: Setup pnpm
if: steps.check_config.outputs.enabled == 'true'
uses: pnpm/action-setup@v2
with:
version: 8
- name: Setup Node.js
if: steps.check_config.outputs.enabled == 'true'
uses: actions/setup-node@v4
with:
node-version: "18"
cache: "pnpm"
cache-dependency-path: setup/pnpm-lock.yaml
- name: Install dependencies
if: steps.check_config.outputs.enabled == 'true'
run: cd setup && pnpm install
- name: Generate documentation
if: steps.check_config.outputs.enabled == 'true'
run: cd setup && pnpm generate
- name: Commit and push if changed
if: steps.check_config.outputs.enabled == 'true'
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: "Update"
commit_user_name: "Learnverse Bot"
commit_user_email: "bot@learnverxe.com"
commit_author: "Learnverse Bot <bot@learnverxe.com>"
file_pattern: "README.md years/*.md"
skip_dirty_check: false
skip_fetch: false
skip_checkout: false