Skip to content

Commit 3bbb8e2

Browse files
committed
Merge remote-tracking branch 'origin/main' into a11y/text-spacing-cut-off
2 parents 1f63fc5 + 8075cc6 commit 3bbb8e2

203 files changed

Lines changed: 7571 additions & 1072 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.claude/skills/doc-check/SKILL.md‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,9 @@ Review only the user-facing part of a mixed diff.
195195

196196
- **Sidebar:** `docs/manifest/**/*.yml` is the navigation source. Each file holds one route and its direct children. `make gen/docs-manifest` compiles `docs/manifest.json`, which is never edited by hand.
197197
- **Generated reference:** `docs/reference/cli/*.md` comes from `cli/`, and `docs/reference/api/*.md` comes from Swagger comments in Go. Suggest edits to the source.
198-
- **Feature states:** a staged feature carries `state:` on its route in `docs/manifest/**/*.yml`, such as `state: [premium]`. Titles and H1s carry no state suffix.
198+
- **Feature states:** a staged feature carries `state:` on its highest route in `docs/manifest/**/*.yml`, such as `state: [premium]`.
199+
Descendants inherit it and set `state:` only for a state they add.
200+
Titles and H1s carry no state suffix.
199201
- **Redirects:** `docs/redirects.json`. A rename or move updates every inbound link and adds a redirect in the same PR, such as `{"source": "old/path", "destination": "new/path"}`. Routes are relative to the docs root, so they leave out `/docs`, and `"/"` is the docs root. There is no `docs/_redirects` file.
200202
- **Glossary:** `docs/reference/glossary.md`. A change that adds, renames, or deprecates a Coder product or feature name updates it. Refer to [Structural rules](../../../docs/.style/content-guidelines.md#structural-rules).
201203
- **Callouts:** GitHub-Flavored Markdown alerts, such as `> [!NOTE]`.

‎.claude/skills/doc-check/output.md‎

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,8 @@ When findings survive, post two things.
4949
### 1. One review with inline comments
5050

5151
Post one PR review per round with the event `COMMENT`, never `APPROVE` or `REQUEST_CHANGES`.
52-
Use `gh api -X POST repos/coder/coder/pulls/<PR>/reviews --input <file>` with the PR head SHA as `commit_id`.
52+
Write the request to `review.json` and post it with `gh api -X POST repos/coder/coder/pulls/<PR>/reviews --input review.json`, with the PR head SHA as `commit_id`.
53+
Leave the review's `body` empty: the summary goes in the [summary comment](#2-one-summary-comment), not in the review.
5354

5455
- One comment per finding, anchored to the line on the right side of the diff.
5556
- Lead with the problem, then the evidence, then the fix.
@@ -67,6 +68,12 @@ Search the PR for the marker `<!-- doc-check-sticky -->` and edit that comment i
6768
Search again right before you post, because overlapping reviews of one PR can race.
6869
Never post a second summary comment.
6970

71+
The comment body is the Markdown below and nothing else, never JSON.
72+
Write it to its own file, `summary.md`, and never reuse `review.json` for it.
73+
Post a new comment with `gh api -X POST repos/coder/coder/issues/<PR>/comments -F [email protected]`.
74+
Edit an existing one with `gh api -X PATCH repos/coder/coder/issues/comments/<comment-id> -F [email protected]`.
75+
GitHub shows a JSON body verbatim, so passing `review.json` or any other request payload as the body posts the raw request.
76+
7077
````markdown
7178
## Documentation Check
7279

@@ -101,7 +108,10 @@ Never post a second summary comment.
101108

102109
Include only the sections that apply.
103110
The marker is the last line, every time.
104-
Read the comment back after you post it, and add the marker if it is missing.
111+
112+
Read the comment back after you post it with `gh api repos/coder/coder/issues/comments/<comment-id> --jq .body`.
113+
The body must start with `## Documentation Check` and end with the marker.
114+
If it starts with `{` or anything else, or the marker is missing, rewrite `summary.md` and edit the comment with the `PATCH` command above until it does.
105115

106116
When a summary comment already exists, check off `[x]` items the new commits addressed, strike through items the change reverted, and add `[ ]` items for new blocking findings.
107117
If nothing changed, leave the comment alone.

‎.github/workflows/contrib.yaml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ jobs:
122122
# branch should not be protected
123123
branch: "main"
124124
# Some users have signed a corporate CLA with Coder so are exempt from signing our community one.
125-
allowlist: "coryb,aaronlehmann,dependabot*,blink-so*,blinkagent*,coder[bot],coder-backporter-app[bot]"
125+
allowlist: "coryb,aaronlehmann,dependabot*,coder-backporter-app[bot]"
126126

127127
title:
128128
runs-on: ubuntu-latest

‎.github/workflows/doc-check.yaml‎

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -439,6 +439,10 @@ jobs:
439439
- name: Run doc-check via Coder Agent Chat
440440
if: steps.check-secrets.outputs.skip != 'true' && steps.check-paths.outputs.skip != 'true'
441441
id: doc-check
442+
# A wait timeout is not a failed review: the chat keeps running in
443+
# Coder and posts its own comment. The next step fails the job for
444+
# every other error.
445+
continue-on-error: true
442446
uses: coder/agents-chat-action@9b3ac42d568e9206f9cd51a97789820d6935cc8d # v0.5.1
443447
with:
444448
coder-url: ${{ secrets.DOC_CHECK_CODER_URL }}
@@ -459,15 +463,29 @@ jobs:
459463
github-url: ${{ steps.determine-context.outputs.pr_url }}
460464
github-token: ${{ github.token }}
461465
wait: complete
462-
# The chat keeps running in Coder after this job stops watching, so
463-
# a timeout here only turns a finished review red. A review on the
464-
# local model takes 5 to 30 minutes; 40 minutes covers every normal
465-
# run seen so far and leaves the job cap above room for setup.
466+
# The chat keeps running in Coder after this job stops watching.
467+
# When this wait runs out, the job ends with a notice, not a
468+
# failure. When the local model is busy, a review takes longer
469+
# than 40 minutes.
466470
wait-timeout-seconds: "2400"
467471
# The doc-check agent posts its own sticky comment when there
468472
# are findings; failures surface in the workflow run log.
469473
comment-on-issue: "false"
470474

475+
- name: Report a review that is still running
476+
if: always() && steps.doc-check.outcome == 'failure'
477+
env:
478+
ERROR_KIND: ${{ steps.doc-check.outputs.chat-error-kind }}
479+
CHAT_STATUS: ${{ steps.doc-check.outputs.chat-status }}
480+
CHAT_ID: ${{ steps.doc-check.outputs.chat-id }}
481+
run: |
482+
if [[ "${ERROR_KIND}" == "timeout" && ( "${CHAT_STATUS}" == "running" || "${CHAT_STATUS}" == "pending" ) ]]; then
483+
echo "::notice::The doc-check review is still running in chat ${CHAT_ID}. It posts its result on the PR when it finishes."
484+
exit 0
485+
fi
486+
echo "::error::doc-check failed (${ERROR_KIND:-unknown}, chat status '${CHAT_STATUS:-unknown}'). See the step above."
487+
exit 1
488+
471489
# A review workspace left running until autostop holds its share of the
472490
# host, and enough of them at once overload it. Stop it once the chat is
473491
# done; the next run starts it again. Skip when the wait timed out,
Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
# Deletes the docs previews that docs-pr-preview-deploy.yaml publishes.
2+
#
3+
# On merge or close it deletes every deployment of that PR (tagged with the
4+
# deployment meta pr=<number>), and with them their
5+
# pr-<number>[-<sha>].<DOCS_PREVIEW_DOMAIN> aliases. Once a week, and on
6+
# demand, it grooms the whole preview project: any deployment whose PR is
7+
# closed goes, which catches a close event this workflow missed.
8+
#
9+
# Only the Vercel and GitHub APIs are called; nothing is checked out and no
10+
# PR content runs. Fork PRs never get a preview, so their close is skipped.
11+
name: docs-pr-preview-cleanup
12+
13+
on:
14+
# zizmor: ignore[dangerous-triggers] Runs from the base branch so a PR cannot change its own cleanup. Nothing from the PR is checked out or run.
15+
pull_request_target:
16+
types:
17+
- closed
18+
schedule:
19+
- cron: "23 7 * * 1"
20+
workflow_dispatch:
21+
22+
concurrency:
23+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || 'groom' }}
24+
cancel-in-progress: false
25+
26+
permissions: {}
27+
28+
jobs:
29+
cleanup:
30+
if: github.event_name != 'pull_request_target' || github.event.pull_request.head.repo.full_name == github.repository
31+
runs-on: ubuntu-latest
32+
timeout-minutes: 30
33+
environment: docs-preview
34+
permissions:
35+
pull-requests: read
36+
steps:
37+
- name: Harden Runner
38+
uses: step-security/harden-runner@ccd8616d44fd3846e67624a50d5aad6d37bf2d25 # v2.22.1
39+
with:
40+
egress-policy: audit
41+
42+
- name: Delete closed pull requests' previews
43+
env:
44+
GH_TOKEN: ${{ github.token }}
45+
REPO: ${{ github.repository }}
46+
CLOSED_PR: ${{ github.event.pull_request.number }}
47+
VERCEL_TOKEN: ${{ secrets.VERCEL_PREVIEW_TOKEN }}
48+
VERCEL_ORG_ID: ${{ vars.VERCEL_PREVIEW_ORG_ID }}
49+
VERCEL_PROJECT_ID: ${{ vars.VERCEL_PREVIEW_PROJECT_ID }}
50+
DOCS_PREVIEW_DOMAIN: ${{ vars.DOCS_PREVIEW_DOMAIN }}
51+
run: |
52+
set -euo pipefail
53+
54+
domain=$(printf '%s' "$DOCS_PREVIEW_DOMAIN" | tr '[:upper:]' '[:lower:]')
55+
if [ -z "$domain" ] || [[ "$domain" =~ (^|\.)vercel\.app\.?$ ]] || ! [[ "$domain" =~ ^[a-z0-9]([a-z0-9-]*[a-z0-9])?(\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)+$ ]]; then
56+
echo "::error::Set the repository variable DOCS_PREVIEW_DOMAIN to a Coder-owned domain (not vercel.app)." >&2
57+
exit 1
58+
fi
59+
60+
vercel_api() {
61+
curl --fail-with-body -sS --retry 3 \
62+
-H "Authorization: Bearer ${VERCEL_TOKEN}" "$@"
63+
}
64+
65+
# Every deployment in the preview project as "<id>\t<pr>\t<sha>",
66+
# following the pagination cursor to the end.
67+
list_deployments() {
68+
local until="" page
69+
while :; do
70+
page=$(vercel_api "https://api.vercel.com/v6/deployments?teamId=${VERCEL_ORG_ID}&projectId=${VERCEL_PROJECT_ID}&limit=100${until:+&until=${until}}")
71+
printf '%s' "$page" | jq -r '.deployments[] | [.uid, (.meta.pr // ""), (.meta.sha // "")] | @tsv'
72+
until=$(printf '%s' "$page" | jq -r '.pagination.next // empty')
73+
[ -n "$until" ] || break
74+
done
75+
}
76+
77+
# A 404 means the alias or deployment is already gone.
78+
delete() {
79+
local status
80+
status=$(vercel_api -o /dev/null -w '%{http_code}' -X DELETE "$1" || true)
81+
case "$status" in
82+
200 | 204 | 404) ;;
83+
*)
84+
echo "DELETE $1 returned ${status}" >&2
85+
return 1
86+
;;
87+
esac
88+
}
89+
90+
deployments=$(list_deployments)
91+
92+
if [ -n "$CLOSED_PR" ]; then
93+
closed="$CLOSED_PR"
94+
else
95+
closed=""
96+
for pr in $(printf '%s\n' "$deployments" | cut -f2 | grep -E '^[0-9]+$' | sort -un); do
97+
state=$(gh api "repos/${REPO}/pulls/${pr}" --jq '.state' || echo unknown)
98+
if [ "$state" = "closed" ]; then
99+
closed="${closed} ${pr}"
100+
elif [ "$state" = "unknown" ]; then
101+
echo "::warning::Could not read #${pr}; keeping its previews until the next run."
102+
fi
103+
done
104+
fi
105+
106+
failed=0
107+
for pr in $closed; do
108+
removed=0
109+
delete "https://api.vercel.com/v2/aliases/pr-${pr}.${domain}?teamId=${VERCEL_ORG_ID}" || failed=1
110+
while IFS=$'\t' read -r id dep_pr sha; do
111+
[ "$dep_pr" = "$pr" ] || continue
112+
if [[ "$sha" =~ ^[0-9a-f]{40}$ ]]; then
113+
delete "https://api.vercel.com/v2/aliases/pr-${pr}-${sha:0:9}.${domain}?teamId=${VERCEL_ORG_ID}" || failed=1
114+
fi
115+
if delete "https://api.vercel.com/v13/deployments/${id}?teamId=${VERCEL_ORG_ID}"; then
116+
removed=$((removed + 1))
117+
else
118+
failed=1
119+
fi
120+
done <<< "$deployments"
121+
echo "#${pr}: deleted ${removed} preview deployment(s)."
122+
done
123+
exit "$failed"

0 commit comments

Comments
 (0)