diff --git a/.github/workflows/uml.yml b/.github/workflows/uml.yml new file mode 100644 index 00000000..a8afc78f --- /dev/null +++ b/.github/workflows/uml.yml @@ -0,0 +1,54 @@ +name: Update the UML Diagrams +on: + workflow_dispatch: + schedule: + - cron: '0 12 * * 1' + +jobs: + build: + runs-on: ubuntu-latest + permissions: write-all + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + ref: main + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: "3.10" + + - name: Configure Git Identity + run: | + git config user.name 'github-actions[bot]' + git config user.email 'github-actions[bot]@users.noreply.github.com' + - name: Update the UML Diagrams + run: | + sudo apt-get update && sudo apt-get install -y graphviz + make uml + - name: Detect UML changes + id: changes + run: | + git add docs/source/uml/*.png + if git diff --staged --exit-code; then + echo "No changes to commit" + echo "changes_exist=false" >> $GITHUB_OUTPUT + else + echo "changes_exist=true" >> $GITHUB_OUTPUT + fi + - name: Create PR for changes + if: steps.changes.outputs.changes_exist == 'true' + run: | + git checkout -b update-uml-diagrams + git commit -m "Update UML Diagrams" + git push -u origin update-uml-diagrams + gh pr create \ + --base main \ + --title "Update UML Diagrams" \ + --body "This PR updates the UML diagrams + This PR was created automatically by the [UML workflow](https://github.com/pymc-labs/CausalPy/blob/main/.github/workflows/uml.yml). + See the logs [here](https://github.com/pymc-labs/CausalPy/actions/workflows/uml.yml) for more details." \ + --label "no releasenotes" \ + --reviewer drbenvincent + env: + GH_TOKEN: ${{ github.token }}