Files
coder/.github/workflows/audit-docs-paths.yaml
dependabot[bot] 2af483fe9a ci: bump the github-actions group across 1 directory with 12 updates
Bumps the github-actions group with 12 updates in the / directory:

| Package | From | To |
| --- | --- | --- |
| [step-security/harden-runner](https://github.com/step-security/harden-runner) | `2.21.1` | `2.22.4` |
| [actions/upload-artifact](https://github.com/actions/upload-artifact) | `7.0.1` | `7.0.2` |
| [docker/login-action](https://github.com/docker/login-action) | `4.6.0` | `4.8.0` |
| [pnpm/action-setup](https://github.com/pnpm/action-setup) | `6.1.0` | `6.1.1` |
| [depot/build-push-action](https://github.com/depot/build-push-action) | `1.18.0` | `1.19.0` |
| [actions/download-artifact](https://github.com/actions/download-artifact) | `7.0.0` | `8.0.2` |
| [astral-sh/setup-uv](https://github.com/astral-sh/setup-uv) | `10.3.0` | `10.3.3` |
| [linear/linear-release-action](https://github.com/linear/linear-release-action) | `0.18.1` | `0.18.2` |
| [toshimaru/auto-author-assign](https://github.com/toshimaru/auto-author-assign) | `3.1.0` | `3.1.1` |
| [github/codeql-action/upload-sarif](https://github.com/github/codeql-action) | `4.39.0` | `4.39.3` |
| [github/codeql-action/init](https://github.com/github/codeql-action) | `4.39.0` | `4.39.3` |
| [github/codeql-action/analyze](https://github.com/github/codeql-action) | `4.39.0` | `4.39.3` |



Updates `step-security/harden-runner` from 2.21.1 to 2.22.4
- [Release notes](https://github.com/step-security/harden-runner/releases)
- [Commits](https://github.com/step-security/harden-runner/compare/v2.21.1...1d88384fd173af6ecb012dfd0264a306b711241a)

Updates `actions/upload-artifact` from 7.0.1 to 7.0.2
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](https://github.com/actions/upload-artifact/compare/v7.0.1...cf430e030ddbb5b0abf93d22962f4752f3646cd9)

Updates `docker/login-action` from 4.6.0 to 4.8.0
- [Release notes](https://github.com/docker/login-action/releases)
- [Commits](https://github.com/docker/login-action/compare/dbcb813823bdd20940b903addbd779551569679f...8aa5831fb8d48d8f76594c7ddde61ae58019f550)

Updates `pnpm/action-setup` from 6.1.0 to 6.1.1
- [Release notes](https://github.com/pnpm/action-setup/releases)
- [Commits](https://github.com/pnpm/action-setup/compare/ea17c68df8912ef543352723c149a84f56e3d413...73e46992e05b19abd31f2f3c20e0e7370d762115)

Updates `depot/build-push-action` from 1.18.0 to 1.19.0
- [Release notes](https://github.com/depot/build-push-action/releases)
- [Commits](https://github.com/depot/build-push-action/compare/98e78adca7817480b8185f474a400b451d74e287...0f27be7c41d76663a98518dfe68f1c46582242c4)

Updates `actions/download-artifact` from 7.0.0 to 8.0.2
- [Release notes](https://github.com/actions/download-artifact/releases)
- [Commits](https://github.com/actions/download-artifact/compare/v7...9000827ccba6bdab643e8b6fd33ac0654aef8333)

Updates `astral-sh/setup-uv` from 10.3.0 to 10.3.3
- [Release notes](https://github.com/astral-sh/setup-uv/releases)
- [Commits](https://github.com/astral-sh/setup-uv/compare/1c37ad07a6a961277cf70c0d37d6f313000f5884...68559e99cc807c1eb7e9238fd43a15bba460eec2)

Updates `linear/linear-release-action` from 0.18.1 to 0.18.2
- [Release notes](https://github.com/linear/linear-release-action/releases)
- [Commits](https://github.com/linear/linear-release-action/compare/30f9ae77461ec29f07fffe0c52edd1909bfbb6f5...dd4fc407f860b9460d2cf0b3fb1edd8985cf443f)

Updates `toshimaru/auto-author-assign` from 3.1.0 to 3.1.1
- [Release notes](https://github.com/toshimaru/auto-author-assign/releases)
- [Changelog](https://github.com/toshimaru/auto-author-assign/blob/main/CHANGELOG.md)
- [Commits](https://github.com/toshimaru/auto-author-assign/compare/a78a94b219445cece8ccf0d45fec60af449f212a...415448809ea5ba0e171b251632720b009df3d8d6)

Updates `github/codeql-action/upload-sarif` from 4.39.0 to 4.39.3
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/github/codeql-action/compare/6f2ac81f5cd81fe351a197ba0b00d91d03cd2aee...33d7b85da1a04171e211befe2c739303b9a4c066)

Updates `github/codeql-action/init` from 4.39.0 to 4.39.3
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/github/codeql-action/compare/6f2ac81f5cd81fe351a197ba0b00d91d03cd2aee...33d7b85da1a04171e211befe2c739303b9a4c066)

Updates `github/codeql-action/analyze` from 4.39.0 to 4.39.3
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/github/codeql-action/compare/6f2ac81f5cd81fe351a197ba0b00d91d03cd2aee...33d7b85da1a04171e211befe2c739303b9a4c066)

---
updated-dependencies:
- dependency-name: actions/download-artifact
  dependency-version: 8.0.2
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: github-actions
- dependency-name: actions/upload-artifact
  dependency-version: 7.0.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: github-actions
- dependency-name: astral-sh/setup-uv
  dependency-version: 10.3.3
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: github-actions
- dependency-name: depot/build-push-action
  dependency-version: 1.19.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: github-actions
- dependency-name: docker/login-action
  dependency-version: 4.8.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: github-actions
- dependency-name: github/codeql-action/analyze
  dependency-version: 4.39.3
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: github-actions
- dependency-name: github/codeql-action/init
  dependency-version: 4.39.3
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: github-actions
- dependency-name: github/codeql-action/upload-sarif
  dependency-version: 4.39.3
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: github-actions
- dependency-name: linear/linear-release-action
  dependency-version: 0.18.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: github-actions
- dependency-name: pnpm/action-setup
  dependency-version: 6.1.1
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: github-actions
- dependency-name: step-security/harden-runner
  dependency-version: 2.22.4
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: github-actions
- dependency-name: toshimaru/auto-author-assign
  dependency-version: 3.1.1
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: github-actions
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-11-24 12:10:06 +00:00

258 lines
11 KiB
YAML

name: audit-docs-paths
# Scheduled audit for docs-URL drift.
#
# site/scripts/audit-docs-paths.mjs cross-references every docs("...")
# call, every hardcoded coder.com/docs/... URL, and every ](/docs/...)
# Markdown link in the TS/TSX of BOTH coder/coder (site/src) and
# coder/coder.com (src) against the source side of every /docs/* rule in
# coder/coder.com/redirects.json. Anything that matches a redirect source
# is stale: the reference points at a path that now redirects elsewhere
# and should be updated to the redirect's destination.
#
# This runs the audit on a weekly cron (and on demand) so drift is caught
# automatically instead of only when someone remembers to run the script.
# The suggestion to schedule it came from the audit script's original PR,
# coder/coder#25740.
#
# Why this job is gated (vars.AUDIT_DOCS_PATHS_ENABLED)
# ----------------------------------------------------
# The audit needs coder/coder.com, which is a PRIVATE repo. The default
# GITHUB_TOKEN cannot read another repo, so the coder.com checkout below
# uses a read-only coder-ci-reader App token scoped to coder.com. Issue
# writes on this repo use the default GITHUB_TOKEN. The job stays dormant
# behind a repository variable so it can merge without running until an
# operator has validated it once.
#
# To enable
# 1. Set the repository variable AUDIT_DOCS_PATHS_ENABLED to 'true'.
# 2. Trigger once from the Actions UI (workflow_dispatch) to confirm an
# end-to-end run before relying on the schedule.
#
# What it does with findings
# * Always uploads the dated report as a build artifact and writes it to
# the run summary, so a report exists even when the audit is clean.
# * On findings, opens (or updates) a single deduplicated tracked issue
# with the report and fails the run so the check goes red.
# * On a clean run, closes the tracked issue if one is open.
on:
schedule:
# Weekly, Monday 09:00 UTC - same cadence as the weekly-docs link check.
- cron: "0 9 * * 1"
workflow_dispatch: # manual, for testing and on-demand audits
permissions:
contents: read
concurrency:
group: audit-docs-paths
cancel-in-progress: false
jobs:
audit-docs-paths:
# Dormant until an operator flips the variable. See the header comment.
if: vars.AUDIT_DOCS_PATHS_ENABLED == 'true'
runs-on: ubuntu-latest
environment: main
permissions:
contents: read # checkout
issues: write # open/update/close the tracked issue via GITHUB_TOKEN
id-token: write # Cloud KMS signs the coder-ci-reader App's JWT
steps:
- name: Harden Runner
uses: step-security/harden-runner@1d88384fd173af6ecb012dfd0264a306b711241a # v2.22.4
with:
egress-policy: audit
# coder/coder at the workspace root so the local composite actions
# under ./.github/actions/* resolve normally.
- name: Checkout coder/coder
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Generate coder-ci-reader App token
id: reader_token
# The App's key is a non-exportable Cloud KMS key; only this workflow, in this environment,
# may sign with it.
uses: coder/github-app-token-action@00eaec58ee1bfea9c8b48655b7ab7470b07739e5 # main 2026-11-17
with:
client-id: ${{ secrets.CODER_CI_READER_APP_ID }}
kms-key: ${{ secrets.CODER_CI_READER_APP_KMS_KEY }}
workload-identity-provider: ${{ secrets.APP_KEYS_WORKLOAD_ID_PROVIDER }}
owner: coder
repositories: coder.com
permissions: |
contents: read
# coder/coder.com beside it, read with the coder-ci-reader token
# (the default GITHUB_TOKEN can't read another private repo). The
# audit's report path detection keys off the ".../coder/site/" and
# ".../coder.com/src/" path segments, which the absolute --roots
# below preserve.
- name: Checkout coder/coder.com
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
repository: ${{ github.repository_owner }}/coder.com
path: coder.com
token: ${{ steps.reader_token.outputs.token }}
persist-credentials: false
- name: Set up mise tools
uses: ./.github/actions/setup-mise
with:
install-args: "node"
- name: Run docs-paths audit
id: audit
env:
WORKSPACE: ${{ github.workspace }}
run: |
set -euo pipefail
# audit-docs-paths.mjs treats a missing scan root as a warning, not an error, so fail the step here.
for root in "${WORKSPACE}/site/src" "${WORKSPACE}/coder.com/src"; do
[ -d "${root}" ] || { echo "::error::audit scan root not found: ${root}"; exit 1; }
done
# Absolute --roots are required: the audit classifies findings by
# matching the "/coder/site/" and "/coder.com/src/" segments in
# each file's absolute path. Relative roots would leave every
# finding unclassified.
node site/scripts/audit-docs-paths.mjs \
--redirects="${WORKSPACE}/coder.com/redirects.json" \
--roots="${WORKSPACE}/site/src,${WORKSPACE}/coder.com/src" \
--out="${WORKSPACE}/audit-report.md" \
2>&1 | tee "${WORKSPACE}/audit-output.txt"
# No fallback: a missing "Total findings:" line must fail, not read as zero.
count=$(grep -oP 'Total findings: \K\d+' "${WORKSPACE}/audit-output.txt")
echo "count=${count}" >> "$GITHUB_OUTPUT"
echo "Total findings: ${count}"
{
echo "# audit-docs-paths"
echo
echo "Findings: **${count}**"
echo
cat "${WORKSPACE}/audit-report.md"
} >> "$GITHUB_STEP_SUMMARY"
- name: Send Slack notification on drift
id: slack_drift
# Reuses weekly-docs.yaml's docs Slack webhook (same channel, no new secret).
# Runs before the report/issue/fail steps so their failure can't drop the ping.
if: steps.audit.outputs.count != '' && steps.audit.outputs.count != '0'
env:
COUNT: ${{ steps.audit.outputs.count }}
RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
SLACK_WEBHOOK: ${{ secrets.DOCS_LINK_SLACK_WEBHOOK }}
run: |
set -euo pipefail
[ -n "${SLACK_WEBHOOK}" ] || { echo "::error::DOCS_LINK_SLACK_WEBHOOK is not set"; exit 1; }
# -f: a revoked or misconfigured webhook must fail the step, not log success.
curl \
-fsS \
--max-time 10 \
--retry 3 \
--retry-all-errors \
-X POST \
-H 'Content-type: application/json' \
-d '{"text":":warning: *Docs URL drift detected by audit-docs-paths.*\n'"${COUNT}"' stale docs path reference(s) resolve to a redirect source. See the run: '"${RUN_URL}"'"}' \
"${SLACK_WEBHOOK}"
echo "Sent Slack drift notification"
- name: Upload audit report
if: always()
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: audit-docs-paths-report
path: ${{ github.workspace }}/audit-report.md
if-no-files-found: warn
- name: Open, update, or close tracked issue
if: always() && steps.audit.outcome == 'success'
env:
GH_TOKEN: ${{ github.token }}
REPO: ${{ github.repository }}
COUNT: ${{ steps.audit.outputs.count }}
REPORT: ${{ github.workspace }}/audit-report.md
RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
run: |
set -euo pipefail
TITLE="Docs URL drift detected by audit-docs-paths"
MARKER="<!-- audit-docs-paths-tracked-issue -->"
# Find an existing open tracked issue by exact title.
existing=$(gh issue list --repo "$REPO" --state open \
--search "${TITLE} in:title" \
--json number,title \
--jq "map(select(.title == \"${TITLE}\")) | (.[0].number // empty)")
if [ "${COUNT:-0}" -gt 0 ]; then
body_file="$(mktemp)"
{
echo "${MARKER}"
echo
echo "The scheduled \`audit-docs-paths\` workflow found **${COUNT}** stale docs path reference(s) that resolve to a redirect source in \`coder/coder.com/redirects.json\`. Each should be updated to the redirect's destination."
echo
echo "- Latest run: ${RUN_URL}"
echo "- Full report: the \`audit-docs-paths-report\` artifact on that run."
echo
echo "<details><summary>Report</summary>"
echo
# Cap the embedded report to stay under GitHub's ~65k issue
# body limit; the full report is always in the artifact.
head -c 55000 "${REPORT}"
echo
echo "</details>"
} > "${body_file}"
if [ -n "${existing}" ]; then
gh issue edit "${existing}" --repo "${REPO}" --body-file "${body_file}"
echo "Updated tracked issue #${existing}."
else
gh issue create --repo "${REPO}" --title "${TITLE}" --body-file "${body_file}"
echo "Created tracked issue."
fi
else
if [ -n "${existing}" ]; then
gh issue comment "${existing}" --repo "${REPO}" \
--body "Audit is clean as of [this run](${RUN_URL}). Closing."
gh issue close "${existing}" --repo "${REPO}"
echo "Closed tracked issue #${existing} (audit clean)."
else
echo "Audit clean and no tracked issue open; nothing to do."
fi
fi
- name: Fail the run when findings exist
if: steps.audit.outputs.count != '' && steps.audit.outputs.count != '0'
env:
COUNT: ${{ steps.audit.outputs.count }}
run: |
echo "::error::audit-docs-paths found ${COUNT} stale docs path reference(s). See the tracked issue and the audit-docs-paths-report artifact."
exit 1
- name: Send Slack notification on failure
# A failed scheduled run notifies nobody, so ping on any job failure the
# drift step above didn't already announce.
if: failure() && steps.slack_drift.outcome != 'success'
env:
RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
SLACK_WEBHOOK: ${{ secrets.DOCS_LINK_SLACK_WEBHOOK }}
run: |
set -euo pipefail
[ -n "${SLACK_WEBHOOK}" ] || { echo "::error::DOCS_LINK_SLACK_WEBHOOK is not set"; exit 1; }
curl \
-fsS \
--max-time 10 \
--retry 3 \
--retry-all-errors \
-X POST \
-H 'Content-type: application/json' \
-d '{"text":":rotating_light: *audit-docs-paths failed; docs URL drift monitoring needs attention.* See the run: '"${RUN_URL}"'"}' \
"${SLACK_WEBHOOK}"
echo "Sent Slack failure notification"