From 735edb24b8c88b1e72fb2d97281040cedfd528fb Mon Sep 17 00:00:00 2001 From: Kenny Root Date: Sat, 21 Nov 2026 11:58:48 -0800 Subject: [PATCH] fix(ci): defer doc publish while source CI runs If the main branch were still building, it would have an error in the Actions list. However, after the main branch builds, it would trigger another documentation build. So instead of having an error, just defer until the doc build is triggered. --- .github/workflows/docs.yml | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 885b8cfc6..29ae34679 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -35,6 +35,7 @@ jobs: pages: read outputs: artifact_id: ${{ steps.upload.outputs.artifact_id }} + deferred: ${{ steps.admission.outputs.deferred }} failures: ${{ steps.docs.outputs.failures }} steps: - name: Checkout source from main @@ -44,13 +45,30 @@ jobs: fetch-depth: 0 fetch-tags: true + - name: Check whether source CI is still running + id: admission + if: github.event_name == 'workflow_run' + env: + GH_TOKEN: ${{ github.token }} + run: | + source_commit=$(git rev-parse HEAD) + status=$(gh api --method GET "repos/$GITHUB_REPOSITORY/actions/workflows/ci.yml/runs" \ + -f "head_sha=$source_commit" -f event=push -F per_page=1 \ + --jq '.workflow_runs[0].status // empty') + if [[ -n "$status" && "$status" != completed ]]; then + echo 'deferred=true' >> "$GITHUB_OUTPUT" + echo "Documentation for $source_commit is deferred until push CI completes (current status $status)." >> "$GITHUB_STEP_SUMMARY" + fi + - name: Set up JDK + if: steps.admission.outputs.deferred != 'true' uses: actions/setup-java@v6.3.0 with: distribution: zulu java-version: '17' - name: Set up Gradle + if: steps.admission.outputs.deferred != 'true' uses: gradle/actions/setup-gradle@v6.4.1 with: validate-wrappers: true @@ -58,6 +76,7 @@ jobs: - name: Reconcile and save documentation archive id: docs + if: steps.admission.outputs.deferred != 'true' uses: connectbot/actions/docs@main env: GH_TOKEN: ${{ github.token }} @@ -67,7 +86,7 @@ jobs: require-ci: 'true' - name: Preserve build logs - if: always() + if: always() && steps.admission.outputs.deferred != 'true' uses: actions/upload-artifact@v7.0.2 with: name: documentation-build-logs @@ -110,13 +129,14 @@ jobs: path: ${{ runner.temp }}/docs-site - name: Report unavailable site - if: steps.docs.outputs.ready != 'true' + if: steps.admission.outputs.deferred != 'true' && steps.docs.outputs.ready != 'true' run: | echo '::error::No documentation site is ready. See the job summary and build logs.' exit 1 deploy: needs: assemble + if: needs.assemble.outputs.deferred != 'true' runs-on: ubuntu-latest timeout-minutes: 15 permissions: