Repository navigation
Conversation
|
Disclaimer: This works for a custom Astro build of the docs (https://clickhouse-docs.vercel.app/docs). It's not actually triggering a Mintlify deploy. The two sites are visually and functionally identical though so we can use this for now as a work around for Mintlify's short-comings. |
| DOCS_REMOTE_NAME: ${{ inputs.remote_name }} | ||
| DOCS_REMOTE_REF: ${{ steps.request.outputs.head_sha }} | ||
| DOCS_REMOTE_REPOSITORY: ${{ github.repository }} | ||
| DOCS_REMOTE_SOURCE_REPOSITORY: ${{ steps.request.outputs.head_repository }} |
There was a problem hiding this comment.
Would this work with community forks? Not sure if the process would be able to work with forks where the vercel app is not installed 🤔
There was a problem hiding this comment.
I don't think it would work as is. The suggestion to use refs/pull/N/head makes sense to me - pushed a change.
It would work like this:
- Maintainer adds the
docs-previewlabel. This is done as a first gate, as it might be a PR to fix a typo or something not requiring a preview. - Workflow triggers a preview build in Vercel. Using Vercel Connect app, the docs site from
ClickHouse/ClickHouseis fetched (currently what is in development at https://github.com/ClickHouse/mintlify-docs-dev), it also fetches the markdown files from dbt-clickhouse branch usingrefs/pull/N/head. We use a dedicated Vercel environment containing only the necessary Vercel Connect secret. The Connect app mints short lived OIDC tokens and we separate out the Git fetch process from the build process. Tokens are cleaned before any .mdx is built. - Workflow polls for the preview link and posts it as a comment
|
Blocking
Should fix
Minor
|
| ### `remote-docs-preview.yml` - Request a remote documentation preview | ||
|
|
||
| Starts a scoped documentation preview for a pull request in a repository | ||
| registered by `ClickHouse/mintlify-docs-dev/remotes.json`. A maintainer enables |
There was a problem hiding this comment.
Will change to ClickHouse/ClickHouse/docs, testing in this repo for now
|
Second review feedback addressed in 679beea
|
|
LGTM! @alex-clickhouse @joe-clickhouse I see you're mainly doing changes in this repo. Is there something else you may miss from this PR? 👀 |
Adds a reusable remote documentation preview workflow. A constrained
pull_request_targetcaller pins that pull request's exact head SHA and directly creates a Vercel deployment of trusted Nimbusmainin theconnect-previewCustom Environment.A maintainer can get a docs preview by adding the
docs-previewlabel - this is done both to save unnecessary preview builds and to ensure there's a gate on what code gets run. JS can run inside of MDX so there is a security concern there:I have taken care to separate out MDX processing from the part of the build process which fetches the docs content from remote sources. The label acts as gate keeping mainly for community PRs.
The Actions workflow never checks out or executes pull-request content and never passes a GitHub credential into Vercel. During the build, Vercel Connect exchanges the deployment OIDC identity for a short-lived
contents:readtoken scoped to the selected source repository. The workflow waits for completion, cancels superseded deployments, and posts a sticky preview link on the source pull request.Callers receive
VERCEL_TOKEN,VERCEL_ORG_ID, andVERCEL_PROJECT_IDthrough organization Actions secrets. A copy-paste caller and configuration documentation are included. Each caller can use the nativepathsfilter to select which changes are eligible, for exampledocs/**. A new PR commit requires a new label event, so approval remains bound to the SHA selected when the label was added.Registering a remote source
Before installing the caller, add an entry to
remotes.jsoninClickHouse/mintlify-docs-dev. Setnameto the value passed asremote_name,repoto the source repository,pathto its documentation directory, andmountto its destination relative to/docs. Addassetsmappings andprivate: truewhen required. Do not pin a branch in the registry: production reads the source's default branch, while an approved preview supplies the exact pull-request SHA.