name: Generate and update documentation images
on:
pull_request:
push:
branches:
- main
workflow_dispatch:
jobs:
docs-images:
name: Update documentation images
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
persist-credentials: false
- uses: dtolnay/rust-toolchain@stable
- name: Install Python
uses: actions/setup-python@v6
with:
python-version: "3.x"
- name: Generate documentation images
run: python scripts/regenerate_docs_images.py
- name: Commit changes if any
run: |
git config --local user.name "github-actions[bot]"
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add .
git diff-index --quiet HEAD || git commit -m "docs: update generated images"
- name: Rebase branch
run: |
BRANCH=${{ github.head_ref || github.ref_name }}
git fetch origin $BRANCH
git rebase origin/$BRANCH
- name: Push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GH_PAT }}
branch: ${{ github.head_ref }}