diff --git a/.github/workflows/uml.yml b/.github/workflows/uml.yml new file mode 100644 index 00000000..af1518d8 --- /dev/null +++ b/.github/workflows/uml.yml @@ -0,0 +1,50 @@ +name: Update the UML Diagrams + +on: + pull_request: + types: [closed] + branches: [main] + paths: + - "causalpy/**" + +jobs: + build: + if: github.event.pull_request.merged == true + runs-on: ubuntu-latest + permissions: write-all + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + ref: ${{ github.head_ref || 'main' }} + repository: ${{ github.event.pull_request.head.repo.full_name }} + + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: "3.10" + + - name: Configure Git Identity + run: | + git config user.name "$(git log -n 1 --pretty=format:%an)" + git config user.email "$(git log -n 1 --pretty=format:%ae)" + + - name: Update the UML Diagrams + run: | + sudo apt-get update && sudo apt-get install -y graphviz + pip install --upgrade pip && pip install ".[docs]" + make uml + + - name: Push up the changes + run: | + git add docs/source/_static/*.png + if git diff --staged --exit-code; then + echo "No changes to commit" + else + echo "Committing the changes" + echo ${GITHUB_HEAD_REF} + git commit -m "Update UML Diagrams" + git push upstream HEAD:${GITHUB_HEAD_REF:-main} + fi + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/pyproject.toml b/pyproject.toml index 83345b80..6ced1ed5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -67,6 +67,7 @@ docs = [ "sphinx-notfound-page", "ipywidgets", "sphinx-design", + "pylint", ] lint = ["interrogate", "pre-commit", "ruff"] test = ["pytest", "pytest-cov"]