mirror of
https://github.com/coder/coder.git
synced 2026-06-06 14:38:23 +00:00
76d3181aba
The `check-docs` job has been failing on every PR touching `docs/**` since 2026-05-29. `umbrelladocs/action-linkspector` runs linkspector under puppeteer, which expects an exact Chrome build (e.g. `148.0.7778.97`) in `/home/runner/.cache/puppeteer`. When that build isn't present on the hosted runner, linkspector crashes with `Could not find Chrome` and reviewdog then fails parsing the empty rdjson output with `proto: syntax error`. The pinned `v1.4.1` of the action was installing linkspector `0.4.7`, whose puppeteer requires `148.0.7778.97`; that build is no longer in the runner cache. Upstream `v1.5.2` upgrades linkspector to `0.5.3` and adds Chromium fallback logic, but on `ubuntu-22.04` x86_64 none of its new code paths fire (the AppArmor branch is gated on `lsb_release -rs == "24.04"`, the system-Chromium branch on aarch64 or missing 24.04 sysctl), so the bump alone leaves the same Chrome error in place. This PR: - Bumps the action to `v1.5.2` (linkspector `0.5.3`). - Sets `PUPPETEER_EXECUTABLE_PATH=/usr/bin/google-chrome` on the action step. The hosted `ubuntu-22.04` image ships Google Chrome at that path. `v1.5.2`'s `script.sh` short-circuits Chromium setup when this env is set, so puppeteer skips the cache lookup and uses the runner binary directly. End-to-end verified by temporarily perturbing `docs/**` on this branch so the workflow's `pull_request` trigger would fire: https://github.com/coder/coder/actions/runs/26732938434. `check-docs` ran linkspector against `docs/**` for ~2m30s and exited 0, with no `Could not find Chrome` or reviewdog parse errors in the log. That perturbation has been removed from the branch. Refs UmbrellaDocs/action-linkspector#62, UmbrellaDocs/action-linkspector#61
82 lines
3.1 KiB
YAML
82 lines
3.1 KiB
YAML
name: weekly-docs
|
|
# runs every monday at 9 am
|
|
on:
|
|
schedule:
|
|
- cron: "0 9 * * 1"
|
|
workflow_dispatch: # allows to run manually for testing
|
|
pull_request:
|
|
branches:
|
|
- main
|
|
paths:
|
|
- "docs/**"
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
jobs:
|
|
check-docs:
|
|
# later versions of Ubuntu have disabled unprivileged user namespaces, which are required by the action
|
|
runs-on: ubuntu-22.04
|
|
permissions:
|
|
pull-requests: write # required to post PR review comments by the action
|
|
steps:
|
|
- name: Harden Runner
|
|
uses: step-security/harden-runner@f808768d1510423e83855289c910610ca9b43176 # v2.17.0
|
|
with:
|
|
egress-policy: audit
|
|
|
|
- name: Checkout
|
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
|
with:
|
|
persist-credentials: false
|
|
|
|
- name: Rewrite same-repo links for PR branch
|
|
if: github.event_name == 'pull_request'
|
|
env:
|
|
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
|
|
run: |
|
|
# Rewrite same-repo blob/tree main links to the PR head SHA
|
|
# so that files or directories introduced in the PR are
|
|
# reachable during link checking.
|
|
{
|
|
echo 'replacementPatterns:'
|
|
echo " - pattern: \"https://github.com/coder/coder/blob/main/\""
|
|
echo " replacement: \"https://github.com/coder/coder/blob/${HEAD_SHA}/\""
|
|
echo " - pattern: \"https://github.com/coder/coder/tree/main/\""
|
|
echo " replacement: \"https://github.com/coder/coder/tree/${HEAD_SHA}/\""
|
|
} >> .github/.linkspector.yml
|
|
|
|
# TODO: Remove this workaround once action-linkspector sets
|
|
# package-manager-cache: false in its internal setup-node step.
|
|
# See: https://github.com/UmbrellaDocs/action-linkspector/issues/54
|
|
- name: Enable corepack and create pnpm store
|
|
run: |
|
|
corepack enable pnpm
|
|
mkdir -p "$(pnpm store path --silent)"
|
|
|
|
- name: Check Markdown links
|
|
uses: umbrelladocs/action-linkspector@036f295d12b67b0c4b445bc83db0538afb78db69 # v1.5.2
|
|
id: markdown-link-check
|
|
# checks all markdown files from /docs including all subfolders
|
|
env:
|
|
# Use the runner-provided Chrome instead of letting linkspector's
|
|
# puppeteer download a specific version that may not match the
|
|
# runner's puppeteer cache. See: https://github.com/UmbrellaDocs/action-linkspector/issues/62
|
|
PUPPETEER_EXECUTABLE_PATH: /usr/bin/google-chrome
|
|
with:
|
|
reporter: github-pr-review
|
|
config_file: ".github/.linkspector.yml"
|
|
fail_on_error: "true"
|
|
filter_mode: "file"
|
|
|
|
- name: Send Slack notification
|
|
if: failure() && github.event_name == 'schedule'
|
|
run: |
|
|
curl \
|
|
-X POST \
|
|
-H 'Content-type: application/json' \
|
|
-d '{"msg":"Broken links found in the documentation. Please check the logs at '"${LOGS_URL}"'"}' "${{ secrets.DOCS_LINK_SLACK_WEBHOOK }}"
|
|
echo "Sent Slack notification"
|
|
env:
|
|
LOGS_URL: https://github.com/coder/coder/actions/runs/${{ github.run_id }}
|