|
| 1 | +name: Update Graph Documentation 🦜📚 |
| 2 | +on: |
| 3 | + pull_request: |
| 4 | + types: [opened, synchronize] |
| 5 | + branches: [main] |
| 6 | + paths: |
| 7 | + - "minitap/mobile_use/graph/graph.py" |
| 8 | + workflow_dispatch: |
| 9 | + |
| 10 | +permissions: |
| 11 | + contents: write |
| 12 | + |
| 13 | +jobs: |
| 14 | + update-docs: |
| 15 | + runs-on: ubuntu-latest |
| 16 | + steps: |
| 17 | + - name: Checkout code |
| 18 | + uses: actions/checkout@v5 |
| 19 | + with: |
| 20 | + token: ${{ secrets.GITHUB_TOKEN }} |
| 21 | + fetch-depth: 0 |
| 22 | + ref: ${{ github.head_ref }} |
| 23 | + |
| 24 | + - name: Set up Python |
| 25 | + uses: actions/setup-python@v5 |
| 26 | + with: |
| 27 | + python-version: "3.12" |
| 28 | + |
| 29 | + - name: Install system dependencies |
| 30 | + run: | |
| 31 | + sudo apt-get update |
| 32 | + sudo apt-get install -y graphviz graphviz-dev |
| 33 | +
|
| 34 | + - name: Install uv |
| 35 | + uses: astral-sh/setup-uv@v6 |
| 36 | + with: |
| 37 | + enable-cache: true |
| 38 | + |
| 39 | + - name: Install dependencies |
| 40 | + run: | |
| 41 | + uv sync |
| 42 | +
|
| 43 | + - name: Generate graph documentation |
| 44 | + run: uv run python scripts/doc/generate_graph_docs.py |
| 45 | + |
| 46 | + - name: Check for changes |
| 47 | + id: changes |
| 48 | + run: | |
| 49 | + git add doc/graph.png |
| 50 | + if git diff --cached --quiet doc/graph.png; then |
| 51 | + echo "changed=false" >> $GITHUB_OUTPUT |
| 52 | + else |
| 53 | + echo "changed=true" >> $GITHUB_OUTPUT |
| 54 | + fi |
| 55 | +
|
| 56 | + - name: Get last commit author |
| 57 | + if: steps.changes.outputs.changed == 'true' |
| 58 | + id: author |
| 59 | + run: | |
| 60 | + echo "name=$(git log -1 --pretty=format:'%an')" >> $GITHUB_OUTPUT |
| 61 | + echo "email=$(git log -1 --pretty=format:'%ae')" >> $GITHUB_OUTPUT |
| 62 | +
|
| 63 | + - name: Commit and push changes |
| 64 | + if: steps.changes.outputs.changed == 'true' |
| 65 | + run: | |
| 66 | + git config --local user.email "${{ steps.author.outputs.email }}" |
| 67 | + git config --local user.name "${{ steps.author.outputs.name }}" |
| 68 | + git add doc/graph.png |
| 69 | + git commit -m "chore(doc): Update graph documentation [skip ci]" |
| 70 | + git push |
0 commit comments