Skip to content

Generate Python Diagrams #3

Generate Python Diagrams

Generate Python Diagrams #3

name: Generate Python Diagrams
on:
workflow_dispatch:
jobs:
generate-diagram:
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
env:
CI_COMMIT_MESSAGE: Update generated diagram
CI_COMMIT_AUTHOR: Diagram Creator
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}
- name: Git Global Config
run: |
git config --global user.name "${{ env.CI_COMMIT_AUTHOR }}"
git config --global user.email "actions@github.com"
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.x'
- name: Install system dependencies (Graphviz)
run: |
sudo apt-get update
sudo apt-get install -y graphviz
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
pip install diagrams graphviz
- name: Generate diagram using Python Diagrams
run: |
python scripts/generatediagram.py
- name: List generated files (for debugging)
run: ls -al output/
- name: Add output files & Status
run: |
git add output/
git status
- name: Commit changes & Push to origin/main
run: |
git commit --verbose -a -m "${{ env.CI_COMMIT_MESSAGE }}" || echo "No changes to commit"
git push origin main --force --verbose
- name: Push changes
uses: ad-m/github-push-action@master
with:
force: true
ref: ${{ github.head_ref }}
fetch-depth: 0