Generate API Docs #3
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Generate API Docs | |
| on: | |
| workflow_dispatch: | |
| jobs: | |
| build-docs: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Checkout repo | |
| uses: actions/checkout@v4 | |
| with: | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Setup PHP | |
| uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: 8.3 | |
| tools: composer:v2 | |
| coverage: none | |
| - name: Install dependencies | |
| run: composer install --no-interaction --no-progress --prefer-dist | |
| - name: Generate Scribe docs | |
| run: php artisan scribe:generate | |
| - name: Commit and push docs if changed | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| # Check for changes under docs/ (adjust path if needed) | |
| if [ -n "$(git status --porcelain docs)" ]; then | |
| echo "Docs changed, committing..." | |
| git add docs | |
| git commit -m "Update API docs [skip ci]" || echo "No changes to commit" | |
| git push | |
| else | |
| echo "No changes in docs/, nothing to commit." | |
| fi |