Skip to content

ci: add scheduled audit-docs-paths workflow - #27245

Open
nickvigilante wants to merge 3 commits into
mainfrom
vigilante/docs-366-wire-audit-docs-pathsmjs-to-run-on-a-github-actions-cron
Open

ci: add scheduled audit-docs-paths workflow#27245
nickvigilante wants to merge 3 commits into
mainfrom
vigilante/docs-366-wire-audit-docs-pathsmjs-to-run-on-a-github-actions-cron

Conversation

@nickvigilante

@nickvigilante nickvigilante commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

What

Adds .github/workflows/audit-docs-paths.yaml, a scheduled workflow that runs the docs-URL drift audit (site/scripts/audit-docs-paths.mjs, added in #25740) on a weekly cron and on demand, so drift is caught automatically instead of only when someone runs the script by hand. Scheduling was suggested by @bpmct on #25740.

How it works

  • Triggers: schedule (weekly, Monday 09:00 UTC — same cadence as weekly-docs) and workflow_dispatch.
  • Checks out both repos: coder/coder (root) and coder/coder.com (into coder.com/, read with the cdrci CI-bot token). The audit covers references in both repos.
  • Runs the audit with absolute --roots (required, otherwise the report can't classify findings by repo).
  • Always uploads the dated report as the audit-docs-paths-report artifact and writes it to the run summary.
  • On findings: opens or updates a single deduplicated tracked issue with the report, and fails the run (red check). On a clean run: closes that issue.

Enabling (dormant until then)

The audit reads coder/coder.com, a private repo, which the default GITHUB_TOKEN can't read, so the coder.com checkout uses the existing cdrci CI-bot token (secrets.CDRCI_GITHUB_TOKEN) — already used for cross-repo checkouts in release.yaml/tag-and-release.yaml, and cdrci is a coder.com collaborator (verified). No new App to stand up. The job is gated behind vars.AUDIT_DOCS_PATHS_ENABLED so it merges dormant and can be validated before going live.

To turn it on:

  1. Set vars.AUDIT_DOCS_PATHS_ENABLED = 'true'.
  2. Run once via workflow_dispatch to confirm the end-to-end run.

Also in this PR

Removes the dormant audit-docs-paths job embedded in weekly-docs.yaml (added in #25740, gated off pending the same credential). The new dedicated workflow supersedes it; the weekly-docs.yaml diff is exactly that job removal.

Validation

  • actionlint -shellcheck= -ignore set-output passes locally; PR title, lint-actions, and lint-docs are green.
  • Credential check: cdrci is a collaborator on coder/coder.com (read access confirmed); secrets.CDRCI_GITHUB_TOKEN already exists in this repo. (Note: cdrci2 is not a coder.com collaborator, so an earlier CDRCI2_ attempt was corrected to CDRCI_.)
  • Pre-flight audit against current main (both repos): 0 findings — 148 /docs/* redirect rules indexed; 1846 coder/coder + 432 coder.com TS/TSX files scanned. So a workflow_dispatch on main today passes green with no issue filed (the "empty audit succeeds" criterion). The failure path can be checked by injecting a stale path on a throwaway branch.

Decisions for review

  • Mechanism = tracked issue + failed check + artifact ("both" from the issue). Easy to narrow to issue-only or fail-only.
  • Reused AUDIT_DOCS_PATHS_ENABLED and removed the embedded job rather than adding a second gate.
  • Named the file .yaml to match the repo's other docs workflows (the issue text said .yml).

Linear: https://linear.app/codercom/issue/DOCS-366

@linear-code

linear-code Bot commented Jul 14, 2026

Copy link
Copy Markdown

DOCS-366

@nickvigilante
nickvigilante force-pushed the vigilante/docs-366-wire-audit-docs-pathsmjs-to-run-on-a-github-actions-cron branch from 874c605 to ca3ca60 Compare July 14, 2026 21:25
@nickvigilante
nickvigilante marked this pull request as ready for review July 14, 2026 21:30
@nickvigilante
nickvigilante requested a review from bpmct July 23, 2026 20:53
@github-actions github-actions Bot added the stale This issue is like stale bread. label Aug 1, 2026
@github-actions github-actions Bot closed this Aug 4, 2026
@nickvigilante nickvigilante reopened this Aug 4, 2026
@nickvigilante nickvigilante removed the stale This issue is like stale bread. label Aug 4, 2026

@bpmct bpmct left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM assuming you have a solid solution for getting notified/assigned when a link is old/stale

Adds .github/workflows/audit-docs-paths.yaml running the docs-URL drift
audit on a weekly cron and on demand. It checks out coder/coder and
coder/coder.com, runs site/scripts/audit-docs-paths.mjs against both, and
always uploads the dated report as an artifact and to the run summary. On
findings it opens or updates a single deduplicated tracked issue and fails
the run; on a clean run it closes that issue.

The job is gated behind the AUDIT_DOCS_PATHS_ENABLED repository variable
because the audit reads the private coder.com repo, which needs a
dedicated GitHub App token that is not yet provisioned. This supersedes
the dormant audit-docs-paths job previously embedded in weekly-docs.yaml,
which is removed here to avoid a double run once the audit is enabled.

Ref: DOCS-366
Swaps the private coder.com checkout from a to-be-provisioned dedicated
GitHub App token to the existing cdrci2 machine-user token
(secrets.CDRCI2_GITHUB_TOKEN), so no new App has to be stood up. Enabling
is now just setting AUDIT_DOCS_PATHS_ENABLED=true once cdrci2's coder.com
read access is confirmed.

Ref: DOCS-366
@nickvigilante
nickvigilante force-pushed the vigilante/docs-366-wire-audit-docs-pathsmjs-to-run-on-a-github-actions-cron branch from ca3ca60 to 1fead48 Compare August 6, 2026 16:06
@nickvigilante

Copy link
Copy Markdown
Contributor Author

Follow-up: stacked PR #27924 wires the audit-docs-paths findings into Slack, reusing secrets.DOCS_LINK_SLACK_WEBHOOK (the same docs webhook weekly-docs.yaml uses for the dead-link check). It restores the Slack notification the embedded audit-docs-paths job here had before this dedicated workflow superseded it. That PR is based on this branch; I'll re-target it to main once this one merges.

Also: I rebased this branch onto main to clear the merge conflict. No content changes beyond the conflict resolution — kept main's actions/checkout v7.0.1 bump in the two remaining jobs and dropped the embedded audit-docs-paths job (as this PR already intended).

Tracked in DOCS-617.

@nickvigilante
nickvigilante enabled auto-merge (squash) August 6, 2026 17:44
@nickvigilante
nickvigilante disabled auto-merge August 6, 2026 17:44
cdrci2 is not a collaborator on coder/coder.com, so its token cannot read
the repo. cdrci is a coder.com collaborator, and its token
(secrets.CDRCI_GITHUB_TOKEN) is already used for cross-repo checkouts in
release.yaml/tag-and-release.yaml, so use that for the coder.com checkout.

Ref: DOCS-366
@nickvigilante
nickvigilante force-pushed the vigilante/docs-366-wire-audit-docs-pathsmjs-to-run-on-a-github-actions-cron branch from 1fead48 to d5ba3cd Compare August 6, 2026 17:46
@nickvigilante
nickvigilante enabled auto-merge (squash) August 6, 2026 17:46
@nickvigilante
nickvigilante disabled auto-merge August 6, 2026 17:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants