diff --git a/.github/workflows/infra-docs.yml b/.github/workflows/infra-docs.yml index c89f69177..4166d4799 100644 --- a/.github/workflows/infra-docs.yml +++ b/.github/workflows/infra-docs.yml @@ -11,9 +11,7 @@ on: - 'requirements-mkdocs.txt' - 'scripts/check_docs_links.py' - '.github/workflows/infra-docs.yml' - # Run the trusted base-branch workflow so fork PRs can be skipped without - # waiting for maintainer approval. - pull_request_target: + pull_request: branches: [ main ] paths: - 'docs/**' @@ -26,19 +24,21 @@ on: permissions: contents: read + pages: write + id-token: write + +concurrency: + group: "pages" + cancel-in-progress: false jobs: build: - # MkDocs executes repository code; only trusted same-repository PRs run it. - if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v4 with: - ref: ${{ github.event.pull_request.head.sha || github.sha }} fetch-depth: 0 - persist-credentials: false - name: Setup Python uses: actions/setup-python@v5 @@ -52,7 +52,6 @@ jobs: run: uv pip install --system -r requirements-mkdocs.txt - name: Setup Pages - if: github.event_name == 'push' uses: actions/configure-pages@v4 - name: Build documentation @@ -62,22 +61,17 @@ jobs: run: python scripts/check_docs_links.py - name: Upload artifact - if: github.event_name == 'push' uses: actions/upload-pages-artifact@v3 with: path: ./site deploy: - permissions: - pages: write - id-token: write - concurrency: pages environment: name: github-pages url: ${{ steps.deployment.outputs.page_url }} runs-on: ubuntu-latest needs: build - if: github.event_name == 'push' + if: github.ref == 'refs/heads/main' steps: - name: Deploy to GitHub Pages id: deployment diff --git a/docs/contributing/ci_architecture.md b/docs/contributing/ci_architecture.md index 12829aeb4..6bbd77fa8 100644 --- a/docs/contributing/ci_architecture.md +++ b/docs/contributing/ci_architecture.md @@ -255,10 +255,9 @@ If you add a new CI test category: ### Documentation -`.github/workflows/infra-docs.yml` builds documentation for same-repository PRs -that touch `docs/**`, `mkdocs.yml`, `requirements-mkdocs.txt`, or the workflow -itself. Fork PRs skip this executable build instead of waiting for maintainer -approval. On pushes to `main`, it also deploys the built site to GitHub Pages. +`.github/workflows/infra-docs.yml` builds documentation for PRs that touch +`docs/**`, `mkdocs.yml`, `requirements-mkdocs.txt`, or the workflow itself. On +pushes to `main`, it also deploys the built site to GitHub Pages. The docs job: