name: Build Site on: push: branches: - master # Or your main branch, e.g., main jobs: build: runs-on: ubuntu-latest if: github.actor != 'github-actions[bot]' && github.ref == 'refs/heads/master' # Or your main branch permissions: contents: write steps: - name: Checkout repository uses: actions/checkout@v4 - name: Setup Node.js uses: actions/setup-node@v4 with: node-version: '20' # LTS version - name: Build site run: node build.js - name: Commit and push changes run: | git config --local user.email "github-actions[bot]@users.noreply.github.com" git config --local user.name "github-actions[bot]" # Add all HTML files in the website directory git add -- 'website/*.html' # Only commit if there are staged changes git diff --staged --quiet || git commit -m "Automated build: Update generated site files" git push