fix(docs-preview): set commit status via gh api for correct target_url (#37664)

* docs: mark scale partial pages as unlisted with proper titles

These MDX files are content partials imported into the scale-to-*-users
pages, mirroring the :orphan:/:nosearch: Sphinx pages they were migrated
from. Without frontmatter, Docusaurus rendered them as full standalone
pages with an ugly slug-derived title, breadcrumbs, and pagination.
unlisted: true keeps their routes alive (needed by the PDF book builder
and legacy redirects) while hiding them from the sidebar, breadcrumbs,
pagination, and search indexing.

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix(docs-preview): set commit status via gh api for correct target_url

The shared mattermost/actions/delivery/update-commit-status action accepts
a target_url input but ignores it, hardcoding the Actions run URL instead.
This made the docs-preview PR check's Details link point at the workflow
run rather than the S3-hosted preview site.

Switch docs-preview-template.yml and docs-preview-fork.yml to call the
GitHub Statuses API directly via `gh api repos/.../statuses/{sha}`, matching
the pattern in e2e-tests-playwright.yml, so the success status's target_url
points at the actual preview URL.

Co-authored-by: Cursor <cursoragent@cursor.com>

---------

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Eva Sarafianou
2026-07-27 10:28:39 +03:00
committed by GitHub
parent f0de1f485b
commit 8828e5a258
2 changed files with 33 additions and 25 deletions
+11 -8
View File
@@ -21,15 +21,18 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Set pending commit status
uses: mattermost/actions/delivery/update-commit-status@fec7b836001c9380d4bfaf28d443945c103a098c
env:
GITHUB_TOKEN: ${{ github.token }}
with:
repository_full_name: ${{ github.repository }}
commit_sha: ${{ inputs.COMMIT_SHA }}
context: docs-preview
description: "Docs preview build for ${{ inputs.COMMIT_SHA }} is running"
status: pending
COMMIT_SHA: ${{ inputs.COMMIT_SHA }}
CONTEXT_NAME: docs-preview
GH_TOKEN: ${{ github.token }}
GITHUB_REPOSITORY: ${{ github.repository }}
GITHUB_RUN_ID: ${{ github.run_id }}
run: |
gh api "repos/${GITHUB_REPOSITORY}/statuses/${COMMIT_SHA}" \
-f state=pending \
-f context="${CONTEXT_NAME}" \
-f description="Docs preview build for ${COMMIT_SHA} is running" \
-f target_url="https://github.com/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}"
deploy:
uses: ./.github/workflows/docs-preview-template.yml
+22 -17
View File
@@ -107,25 +107,30 @@ jobs:
# Details (⋯) on this check links to the preview URL via target_url.
- name: Set success commit status
if: ${{ inputs.STATUS_CONTEXT != '' }}
uses: mattermost/actions/delivery/update-commit-status@fec7b836001c9380d4bfaf28d443945c103a098c
env:
GITHUB_TOKEN: ${{ github.token }}
with:
repository_full_name: ${{ github.repository }}
commit_sha: ${{ inputs.COMMIT_SHA }}
context: ${{ inputs.STATUS_CONTEXT }}
description: "Docs preview build for ${{ inputs.COMMIT_SHA }} succeeded"
status: success
target_url: ${{ steps.preview.outputs.url }}
COMMIT_SHA: ${{ inputs.COMMIT_SHA }}
CONTEXT_NAME: ${{ inputs.STATUS_CONTEXT }}
PREVIEW_URL: ${{ steps.preview.outputs.url }}
GH_TOKEN: ${{ github.token }}
GITHUB_REPOSITORY: ${{ github.repository }}
run: |
gh api "repos/${GITHUB_REPOSITORY}/statuses/${COMMIT_SHA}" \
-f state=success \
-f context="${CONTEXT_NAME}" \
-f description="Docs preview build for ${COMMIT_SHA} succeeded" \
-f target_url="$PREVIEW_URL"
- name: Set failure commit status
if: ${{ always() && inputs.STATUS_CONTEXT != '' && (failure() || cancelled()) }}
uses: mattermost/actions/delivery/update-commit-status@fec7b836001c9380d4bfaf28d443945c103a098c
env:
GITHUB_TOKEN: ${{ github.token }}
with:
repository_full_name: ${{ github.repository }}
commit_sha: ${{ inputs.COMMIT_SHA }}
context: ${{ inputs.STATUS_CONTEXT }}
description: "Docs preview build for ${{ inputs.COMMIT_SHA }} failed"
status: failure
COMMIT_SHA: ${{ inputs.COMMIT_SHA }}
CONTEXT_NAME: ${{ inputs.STATUS_CONTEXT }}
GH_TOKEN: ${{ github.token }}
GITHUB_REPOSITORY: ${{ github.repository }}
GITHUB_RUN_ID: ${{ github.run_id }}
run: |
gh api "repos/${GITHUB_REPOSITORY}/statuses/${COMMIT_SHA}" \
-f state=failure \
-f context="${CONTEXT_NAME}" \
-f description="Docs preview build for ${COMMIT_SHA} failed" \
-f target_url="https://github.com/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}"