Skip to content

Generate Hooks Documentation #38

Generate Hooks Documentation

Generate Hooks Documentation #38

name: Generate Hooks Documentation
on:
workflow_dispatch: # Manual trigger
schedule:
- cron: '0 0 * * 0' # Weekly on Sunday at midnight UTC
push:
tags:
- 'v*' # Run on version tags
jobs:
generate-hooks-docs:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.1' # Using 8.1 for consistency with main docs workflow
extensions: mbstring, xml
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.9'
- name: Install hooks generator dependencies
run: |
cd hooks-generator
composer install
- name: Clone source repositories
run: |
git clone https://github.com/mainwp/mainwp.git sources/mainwp-dashboard
git clone https://github.com/mainwp/mainwp-child.git sources/mainwp-child
- name: Generate and categorize hooks documentation
run: |
cd hooks-generator
./generate-categorized-hooks.sh
- name: Commit changes
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git add mainwp-hooks/
git commit -m "Update hooks documentation" || echo "No changes to commit"
- name: Push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ github.ref }}