diff --git a/.github/workflows/python-docs.yml b/.github/workflows/python-docs.yml index 7fdd0c4..2dcf35b 100644 --- a/.github/workflows/python-docs.yml +++ b/.github/workflows/python-docs.yml @@ -24,6 +24,8 @@ jobs: build: name: build docs runs-on: ubuntu-latest + outputs: + pages-enabled: ${{ steps.pages-check.outputs.enabled }} steps: - name: Checkout @@ -45,9 +47,26 @@ jobs: with: path: docs/generated + - name: Check GitHub Pages status + id: pages-check + env: + GH_TOKEN: ${{ github.token }} + run: | + STATUS=$(curl -s -o /dev/null -w "%{http_code}" \ + -H "Authorization: Bearer ${GH_TOKEN}" \ + -H "Accept: application/vnd.github+json" \ + "https://api.github.com/repos/${{ github.repository }}/pages") + if [ "${STATUS}" = "200" ]; then + echo "enabled=true" >> "${GITHUB_OUTPUT}" + else + echo "enabled=false" >> "${GITHUB_OUTPUT}" + echo "::notice::GitHub Pages is not configured for this repository. Skipping deployment." + fi + deploy: name: deploy to GitHub Pages needs: build + if: needs.build.outputs.pages-enabled == 'true' runs-on: ubuntu-latest environment: