Files
mattermost/docs
d584e92645 docs(site): render IME diagram PNG on PRs that touch it (#38782)
* Add docs-ime-render workflow

Regenerates the rendered PNG snapshot of the IME diagram
(docs/site/static/img/ime/entadv.png) on merges to master when the
IMEDiagram component, its content modules, or its logo/banner assets
change, and commits the result back to master.

The live docs site renders <IMEDiagram /> at page-view time, so this
PNG only exists for external use (marketing decks, PR descriptions,
emails) where a live React component can't be embedded. Being
committed and shipped by docs-cd means it lives at
https://docs.mattermost.com/img/ime/entadv.png — a stable URL that
survives branch deletion, unlike raw.githubusercontent.com links.

Trigger paths cover everything the render depends on; the auto-commit
only touches static/img/ime/entadv.png, which is not in the trigger
paths, so the workflow cannot self-recurse. Concurrency group
serializes runs so a rapid sequence of merges collapses to one final
committed PNG. workflow_dispatch allows the first render (and any
manual re-render) without needing an eligible source change.

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

* fix(docs-ime-render): use npm start so prestart fires

npx docusaurus start bypasses the npm 'prestart' lifecycle, so the
sidebars, OpenAPI reference, and plugin docs are never generated.
Docusaurus then crashes at boot on a missing require in
sidebars/api.ts and wait-on times out.

Switch to 'npm start -- --port ... --no-open' so prestart runs first.
Bump the wait-on timeout to 10 minutes to cover prestart (OpenAPI +
plugin godocs) plus Rspack's cold compile.

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

* docs-ime-render: submodule checkout + first-run PNG detection

- Enable 'submodules: true' on checkout. prestart runs
  stage-agents-docs.mjs which needs the docs/vendor/mattermost-plugin-agents
  submodule; without it, Docusaurus fails to boot. Matches the setup
  in docs-cd and docs-ci.
- Fix the commit-if-changed step to detect an untracked PNG (the
  first-ever render): stage the file first, then diff --staged. The
  previous 'git diff --quiet' only saw tracked changes and silently
  no-op'd on first run.
- Drop the '[skip ci]' commit trailer. GITHUB_TOKEN pushes never
  trigger workflow runs regardless of the trailer, and the trigger
  paths already exclude the PNG output so this workflow can't
  self-recurse. The trailer was cosmetic and misleading.

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

* trigger CI

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

* chore(docs): refresh rendered IME diagram

Auto-generated by .github/workflows/docs-ime-render.yml.

* render-ime: widen viewport + hide site chrome before screenshot

Two visible bugs in the CI-produced PNG:

- Viewport 1280x900 minus the docs sidebar left the diagram wrapper
  below its 900px container-query breakpoint, collapsing the whole
  component to a 2-column mobile layout. Bump viewport to 1728px so
  the wrapper lands at its 1240px max-width.

- Playwright element screenshot captures whatever pixels sit inside
  the element's bounding box, including position: sticky chrome that
  overlays it during scroll. When the diagram was tall (2810 CSS px
  after the mobile collapse), the Docusaurus navbar bled into the
  middle of the PNG. Inject a small style tag before screenshot that
  hides the navbar, sidebar, TOC, footer, and pagination-nav.

The style injection is scoped to this render only (page-level, not
persisted), and the export URL flag (?imeExport=1) is unchanged.

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

* chore(docs): refresh rendered IME diagram

Auto-generated by .github/workflows/docs-ime-render.yml.

* docs-ime-render: drop rationale comments from workflow

Design context now lives in the PR description; the workflow only
keeps the top-line 'what this does'.

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

* docs-ime-render: bump actions to latest majors

- actions/checkout v6.0.2 -> v7.0.1
- actions/setup-node v6.3.0 -> v7.0.0
- actions/setup-go v6.3.0 -> v7.0.0

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

* docs-ime-render: drop unused perm + scope push token

- Remove pull-requests: read (workflow never calls the PR API)
- persist-credentials: false on checkout so GITHUB_TOKEN isn't left in
  .git/config where npm ci and postinstall scripts from PR-controlled
  deps could read it
- Push step sets its own token-scoped remote URL for the single command

Addresses review from @NARSimoes on #38782.

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

---------

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-09-25 17:41:49 +03:00
..
2026-09-25 08:33:38 -04:00