Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

automate UML diagrams #395

Open
wants to merge 17 commits into
base: main
Choose a base branch
from
50 changes: 50 additions & 0 deletions .github/workflows/uml.yml
Original file line number Diff line number Diff line change
@@ -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
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am very much a beginner when it comes to GitHub actions, but I've not seen anything about coffin of git identity in the other workflows. Could this be related to the permissions issue?

Or is it required for the later pushed changes?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Required for pushing later.

Could be cause of permission. Not sure at the moment

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Think it might be if repo doesn't allow for bots to push code. I am seeing that the pre-commit bot didn't push either though the command was recognized

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 }}
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ docs = [
"sphinx-notfound-page",
"ipywidgets",
"sphinx-design",
"pylint",
]
lint = ["interrogate", "pre-commit", "ruff"]
test = ["pytest", "pytest-cov"]
Expand Down
Loading