|
78 | 78 | dry_run_release: ${{ steps.set-variables.outputs.dry_run_release }} |
79 | 79 | checkout_ref: ${{ steps.set-variables.outputs.checkout_ref }} |
80 | 80 | checkout_rev: ${{ steps.set-variables.outputs.checkout_rev }} |
| 81 | + has_docs: ${{ steps.check-docs.outputs.has_docs }} |
81 | 82 |
|
82 | 83 | steps: |
| 84 | + - name: Checkout for docs check |
| 85 | + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # ratchet:actions/checkout@v4 |
| 86 | + with: |
| 87 | + sparse-checkout: | |
| 88 | + docs |
| 89 | + sparse-checkout-cone-mode: false |
| 90 | + |
| 91 | + - name: Check if docs exist |
| 92 | + id: check-docs |
| 93 | + run: | |
| 94 | + if [ -d "docs" ] && [ "$(ls -A docs 2>/dev/null)" ]; then |
| 95 | + echo "has_docs=true" >> $GITHUB_OUTPUT |
| 96 | + echo "Documentation directory exists and is not empty" |
| 97 | + else |
| 98 | + echo "has_docs=false" >> $GITHUB_OUTPUT |
| 99 | + echo "Documentation directory does not exist or is empty" |
| 100 | + fi |
| 101 | +
|
83 | 102 | - name: Set action variables |
84 | 103 | id: set-variables |
85 | 104 | run: | |
@@ -127,7 +146,7 @@ jobs: |
127 | 146 |
|
128 | 147 | preview-docs: |
129 | 148 | needs: set-variables |
130 | | - if: ${{ needs.set-variables.outputs.skip_ci != 'true' && ( contains(github.event.pull_request.labels.*.name, 'docs-preview') || (github.event_name == 'workflow_dispatch' && inputs.run_docs_preview) ) }} |
| 149 | + if: ${{ needs.set-variables.outputs.has_docs == 'true' && needs.set-variables.outputs.skip_ci != 'true' && ( contains(github.event.pull_request.labels.*.name, 'docs-preview') || (github.event_name == 'workflow_dispatch' && inputs.run_docs_preview) ) }} |
131 | 150 | uses: ./.github/workflows/deploy-docs.yaml |
132 | 151 | permissions: |
133 | 152 | contents: read |
@@ -275,8 +294,8 @@ jobs: |
275 | 294 | secrets: inherit |
276 | 295 |
|
277 | 296 | deploy-docs: |
278 | | - needs: [test-python, nixci] |
279 | | - if: ${{ github.repository_owner == 'sciexp' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch') && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/beta') }} |
| 297 | + needs: [set-variables, test-python, nixci] |
| 298 | + if: ${{ needs.set-variables.outputs.has_docs == 'true' && github.repository_owner == 'sciexp' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch') && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/beta') }} |
280 | 299 | uses: ./.github/workflows/deploy-docs.yaml |
281 | 300 | permissions: |
282 | 301 | contents: read |
|
0 commit comments