Generate and Deploy to GitHub Pages #4
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 HTML Report | |
| on: | |
| push: | |
| branches: [ main ] | |
| paths: | |
| - 'Graph Analysis/unified_analysis.py' | |
| - 'reports/unified_analysis_report_explained.md' | |
| workflow_dispatch: # Allow manual trigger | |
| permissions: | |
| contents: write | |
| jobs: | |
| generate-html: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 # Fetch full history for proper git operations | |
| - name: Set up Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: '3.11' | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -r requirements.txt | |
| - name: Generate HTML report | |
| run: | | |
| python "Graph Analysis/unified_analysis.py" --html --html-output docs/index.html | |
| - name: Commit and push if changed | |
| run: | | |
| git config --local user.email "action@github.com" | |
| git config --local user.name "GitHub Action" | |
| git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git | |
| git add docs/index.html | |
| if git diff --staged --quiet; then | |
| echo "No changes to commit" | |
| else | |
| git commit -m "Auto-update HTML report [skip ci]" | |
| git push origin HEAD:main | |
| fi | |