Skip to content

Commit 0d6e4f8

Browse files
authored
Merge pull request #442 from pymc-labs/uml-autoupdate
New GitHub workflow to generate PR's which update the UML diagrams
2 parents c0ea8a5 + df0c0f9 commit 0d6e4f8

File tree

1 file changed

+54
-0
lines changed

1 file changed

+54
-0
lines changed

.github/workflows/uml.yml

+54
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: Update the UML Diagrams
2+
on:
3+
workflow_dispatch:
4+
schedule:
5+
- cron: '0 12 * * 1'
6+
7+
jobs:
8+
build:
9+
runs-on: ubuntu-latest
10+
permissions: write-all
11+
steps:
12+
- name: Checkout repository
13+
uses: actions/checkout@v4
14+
with:
15+
ref: main
16+
- name: Set up Python
17+
uses: actions/setup-python@v5
18+
with:
19+
python-version: "3.10"
20+
21+
- name: Configure Git Identity
22+
run: |
23+
git config user.name 'github-actions[bot]'
24+
git config user.email 'github-actions[bot]@users.noreply.github.com'
25+
- name: Update the UML Diagrams
26+
run: |
27+
sudo apt-get update && sudo apt-get install -y graphviz
28+
make uml
29+
- name: Detect UML changes
30+
id: changes
31+
run: |
32+
git add docs/source/uml/*.png
33+
if git diff --staged --exit-code; then
34+
echo "No changes to commit"
35+
echo "changes_exist=false" >> $GITHUB_OUTPUT
36+
else
37+
echo "changes_exist=true" >> $GITHUB_OUTPUT
38+
fi
39+
- name: Create PR for changes
40+
if: steps.changes.outputs.changes_exist == 'true'
41+
run: |
42+
git checkout -b update-uml-diagrams
43+
git commit -m "Update UML Diagrams"
44+
git push -u origin update-uml-diagrams
45+
gh pr create \
46+
--base main \
47+
--title "Update UML Diagrams" \
48+
--body "This PR updates the UML diagrams
49+
This PR was created automatically by the [UML workflow](https://github.com/pymc-labs/CausalPy/blob/main/.github/workflows/uml.yml).
50+
See the logs [here](https://github.com/pymc-labs/CausalPy/actions/workflows/uml.yml) for more details." \
51+
--label "no releasenotes" \
52+
--reviewer drbenvincent
53+
env:
54+
GH_TOKEN: ${{ github.token }}

0 commit comments

Comments
 (0)