From 53f5881d1f6fb0906e50d66d59053d9288dd4518 Mon Sep 17 00:00:00 2001 From: Alex VanTol Date: Fri, 13 Oct 2023 10:44:11 -0500 Subject: [PATCH] fix(ci): don't try to push docs on master push --- .github/workflows/ci.yaml | 4 ++- .github/workflows/docs.yaml | 55 +++++++++++++++++++++++++++++++++++++ 2 files changed, 58 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/docs.yaml diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index d3234cd2f..45dcfdd6f 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -1,6 +1,7 @@ name: CI on: + # run on pushes to master and on pull requests push: pull_request: types: [opened, reopened] @@ -19,7 +20,8 @@ jobs: python-version: '3.9' build_docs: - runs-on: ubuntu-latest + runs-on: ubuntu-latest' + if: github.event_name == 'pull_request' && github.event.action == 'closed' && github.event.pull_request.merged == true steps: - uses: actions/checkout@v2 diff --git a/.github/workflows/docs.yaml b/.github/workflows/docs.yaml new file mode 100644 index 000000000..9039682ca --- /dev/null +++ b/.github/workflows/docs.yaml @@ -0,0 +1,55 @@ +name: CI + +on: + # DON't run on pushes to master and only on pull requests + pull_request: + types: [opened, reopened] + +jobs: + build_docs: + runs-on: ubuntu-latest' + if: github.event_name == 'pull_request' && github.event.action == 'closed' && github.event.pull_request.merged == true + + steps: + - uses: actions/checkout@v2 + with: + ref: ${{github.event.pull_request.head.ref}} + repository: ${{github.event.pull_request.head.repo.full_name}} + - name: Set up Python 3.9 + uses: actions/setup-python@v1 + with: + python-version: 3.9 + - uses: actions/cache@preview + with: + path: ~/.cache/pypoetry/virtualenvs + key: ${{ runner.os }}-poetry-${{ hashFiles(format('{0}{1}', github.workspace, '/poetry.lock')) }} + restore-keys: | + ${{ runner.os }}-poetry- + - name: Install dependencies + run: | + pip install poetry + poetry config virtualenvs.create false + poetry install -vv --all-extras --no-interaction + poetry show -vv + + # install sphinx from PyPI (as of 03/16/21 python3-sphinx is broken) + # sudo apt-get install python3-sphinx + pip install sphinx + pip uninstall -y asyncio + pip list + cd + - name: Build docs + run: | + sphinx-build --version + export PYTHONPATH="${PYTHONPATH}:${{ env.pythonLocation }}/lib/python3.9/site-packages" + cd docs + poetry run make html + cd .. + + - uses: stefanzweifel/git-auto-commit-action@v4.8.0 + with: + commit_message: Apply automatic documentation changes + + # Optional name of the branch the commit should be pushed to + # Required if Action is used in Workflow listening to the `pull_request` event + branch: ${{ github.head_ref }}