Skip to content

Commit

Permalink
Exit link checker and docs workflow early if no changes to /docs (#394)
Browse files Browse the repository at this point in the history
* Exit link checker and docs workflow early if no changes to /docs

* Update name for job
  • Loading branch information
peteski22 authored Nov 19, 2024
1 parent 6daec13 commit ca66bd8
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 4 deletions.
19 changes: 16 additions & 3 deletions .github/workflows/build_and_publish_docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,30 @@ permissions:

jobs:
build-docs:
name: Build and publish docs
name: Docs - Build and publish
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' }}

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Check for modified paths
uses: dorny/paths-filter@v3
id: filter
with:
filters: |
changes:
- 'docs/**'
- name: Set up Python 3.11
if: steps.filter.outputs.changes == 'true'
uses: actions/setup-python@v5
with:
python-version: "3.11"

- name: Set up environment
if: steps.filter.outputs.changes == 'true'
id: setup
run: |
curl -LsSf https://astral.sh/uv/install.sh | sh
Expand All @@ -38,29 +48,32 @@ jobs:
continue-on-error: false

- name: Install docs dependencies
if: steps.filter.outputs.changes == 'true'
id: install_build_dependencies
run: |
. .venv/bin/activate
uv pip install -r pyproject.toml --extra docs
continue-on-error: false

- name: Build documentation
if: steps.filter.outputs.changes == 'true'
run: |
. .venv/bin/activate
cd docs
sphinx-build source build/html
- name: Set up pages
if: steps.filter.outputs.changes == 'true'
uses: actions/configure-pages@v4

- name: Upload artifact
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
if: steps.filter.outputs.changes == 'true' && github.event_name == 'push' && github.ref == 'refs/heads/main'
uses: actions/upload-pages-artifact@v3
with:
path: docs/build/html/

- name: Deploy
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
if: steps.filter.outputs.changes == 'true' && github.event_name == 'push' && github.ref == 'refs/heads/main'
uses: actions/deploy-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
Expand Down
11 changes: 10 additions & 1 deletion .github/workflows/check_links.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Link checker
on:
push:
branches:
- '*'
- main
pull_request:
branches:
- "**"
Expand All @@ -16,7 +16,16 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Check for modified paths
uses: dorny/paths-filter@v3
id: filter
with:
filters: |
changes:
- 'docs/**'
- name: Link Checker
if: steps.filter.outputs.changes == 'true'
id: lychee
uses: lycheeverse/lychee-action@v2
with:
Expand Down

0 comments on commit ca66bd8

Please sign in to comment.