Skip to content

Commit 47b90a6

Browse files
author
Pacificojamal
authored
Merge branch 'main' into Pacificojamal-patch-1
2 parents 15fe960 + 86bc2ea commit 47b90a6

2,576 files changed

Lines changed: 2833613 additions & 2812983 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.

.github/workflows/benchmark-pages.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -116,9 +116,9 @@ jobs:
116116
echo ""
117117
echo "### Errors"
118118
echo ""
119-
echo "| Status | Mode | Path |"
120-
echo "|--------|------|------|"
121-
jq -r '.errors[] | "| \(.status) | \(.mode) | \(.path) |"' /tmp/benchmark-results.json
119+
echo "| Status | Mode | Path | Error |"
120+
echo "|--------|------|------|-------|"
121+
jq -r '.errors[] | "| \(.status) | \(.mode) | \(.path) | \(.errorBody // "" | gsub("\\|"; "\\|") | gsub("\r"; " ") | gsub("\n"; " ")) |"' /tmp/benchmark-results.json
122122
} >> "$BODY_FILE"
123123
fi
124124

.github/workflows/changelog-agent.yml

Lines changed: 762 additions & 0 deletions
Large diffs are not rendered by default.

.github/workflows/headless-tests.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ jobs:
3333
node:
3434
- playwright-rendering
3535
- playwright-a11y
36+
- playwright-secret-scanning
3637
fail-fast: false
3738
timeout-minutes: 60
3839
steps:
@@ -59,6 +60,7 @@ jobs:
5960
PLAYWRIGHT_WORKERS: ${{ fromJSON('[1, 4]')[github.repository == 'github/docs-internal'] }}
6061
# workaround for https://github.com/nodejs/node/issues/59364 as of 22.18.0
6162
NODE_OPTIONS: '--no-experimental-strip-types'
63+
PLAYWRIGHT_TIMEOUT: ${{ matrix.node == 'playwright-a11y' && '60000' || '' }}
6264

6365
# Run playwright rendering tests and a11y tests (axe scans) as distinct checks
6466
# so that we can run them without blocking merges until we can be confident

.github/workflows/index-general-search.yml

Lines changed: 60 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -294,33 +294,42 @@ jobs:
294294
echo 'EOF'
295295
} >> "$GITHUB_OUTPUT"
296296
297-
- name: Close previous scraping failure issues
297+
- name: Comment on or create scraping failure issue
298298
if: ${{ steps.check-artifacts.outputs.has_artifacts == 'true' && fromJSON(steps.aggregate.outputs.result || '{"hasFailures":false}').hasFailures }}
299299
env:
300300
GH_TOKEN: ${{ secrets.DOCS_BOT_PAT_BASE }}
301+
FAILURE_MESSAGE: ${{ fromJSON(steps.aggregate.outputs.result || '{"message":""}').message }}
301302
RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
303+
FILE_URL: ${{ github.server_url }}/${{ github.repository }}/blob/main/.github/workflows/index-general-search.yml
304+
WORKFLOW_NAME: ${{ github.workflow }}
302305
run: |
303-
open_issues=$(gh issue list \
306+
# Reuse the oldest open scraping-failures issue if one exists,
307+
# to keep the noise down. Otherwise open a new one.
308+
existing_issue=$(gh issue list \
304309
--repo github/docs-engineering \
305310
--label "search-scraping-failures" \
306311
--state open \
307-
--json number \
308-
--jq '.[].number')
309-
for issue in $open_issues; do
310-
gh issue close "$issue" \
312+
--limit 200 \
313+
--json number,createdAt \
314+
--jq 'sort_by(.createdAt) | .[0].number // empty')
315+
316+
today=$(date -u +%Y-%m-%d)
317+
318+
if [ -n "$existing_issue" ]; then
319+
comment_body=$(cat <<EOF
320+
### Search index scraping failures ($today)
321+
322+
$FAILURE_MESSAGE
323+
324+
**Workflow run:** $RUN_URL
325+
EOF
326+
)
327+
gh issue comment "$existing_issue" \
311328
--repo github/docs-engineering \
312-
--comment "Closing in favor of a newer scraping failure report from $RUN_URL"
313-
done
329+
--body "$comment_body"
330+
exit 0
331+
fi
314332
315-
- name: Create scraping failure issue
316-
if: ${{ steps.check-artifacts.outputs.has_artifacts == 'true' && fromJSON(steps.aggregate.outputs.result || '{"hasFailures":false}').hasFailures }}
317-
env:
318-
GH_TOKEN: ${{ secrets.DOCS_BOT_PAT_BASE }}
319-
FAILURE_MESSAGE: ${{ fromJSON(steps.aggregate.outputs.result || '{"message":""}').message }}
320-
RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
321-
FILE_URL: ${{ github.server_url }}/${{ github.repository }}/blob/main/.github/workflows/index-general-search.yml
322-
WORKFLOW_NAME: ${{ github.workflow }}
323-
run: |
324333
body=$(cat <<EOF
325334
### Search index scraping failures
326335
@@ -331,12 +340,45 @@ jobs:
331340
**Workflow file:** $FILE_URL
332341
333342
This issue was automatically created by the \`$WORKFLOW_NAME\` workflow.
343+
Subsequent failures from later workflow runs will be added as comments
344+
on this issue rather than opening a new issue each day.
345+
346+
---
347+
348+
## Instructions for the issue analysis agent
349+
350+
These scraping failures are **almost never timeouts**. They are
351+
almost always caused by Liquid/Markdown corruptions in the
352+
translated source that make the page fail to render. Please do not
353+
file this as a transient/timeout issue.
354+
355+
To investigate:
356+
357+
1. Pull the translation repos locally:
358+
\`\`\`
359+
npm run clone-translations
360+
\`\`\`
361+
2. Identify the specific corruptions with the canonical reporter
362+
(verify the exact script name in \`package.json\` before running):
363+
\`\`\`
364+
npm run count-translation-corruptions
365+
\`\`\`
366+
The script writes a structured JSON report to stdout listing each
367+
corrupted file, its location, the error message, and the
368+
offending/illegal tag token when available.
369+
3. **Open a pull request that fixes the corruptions** rather than
370+
just commenting the findings on this issue. The issue body above
371+
(and any subsequent comments) already lists the affected pages;
372+
the value the agent adds is the fix. Where possible, fix the
373+
underlying pattern in
374+
\`src/languages/lib/correct-translation-content.ts\` so the same
375+
corruption is corrected on future syncs.
334376
EOF
335377
)
336378
gh issue create \
337379
--repo github/docs-engineering \
338380
--label "search-scraping-failures" \
339-
--title "[Search Scraping Failures] $(date -u +%Y-%m-%d)" \
381+
--title "[Search Scraping Failures] $today" \
340382
--body "$body"
341383
342384
- name: Send consolidated Slack notification

.github/workflows/link-check-internal.yml

Lines changed: 85 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,16 @@ on:
1414
type: string
1515
required: true
1616
default: 'en'
17+
create_copilot_issue:
18+
description: 'Create a Copilot-assigned issue with the top 10 redirects to fix'
19+
type: boolean
20+
required: false
21+
default: false
22+
create_report:
23+
description: 'Create the combined broken links report issue in docs-content'
24+
type: boolean
25+
required: false
26+
default: true
1727

1828
permissions:
1929
contents: read
@@ -101,6 +111,80 @@ jobs:
101111
retention-days: 5
102112
if-no-files-found: ignore
103113

114+
- name: Create Copilot redirect issue
115+
if: inputs.create_copilot_issue
116+
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3
117+
with:
118+
github-token: ${{ secrets.DOCS_BOT_PAT_BASE }}
119+
script: |
120+
const fs = require('fs')
121+
const reportFile = 'artifacts/link-report-${{ matrix.version }}-${{ matrix.language }}.json'
122+
123+
if (!fs.existsSync(reportFile)) {
124+
core.info('No JSON report found — all links valid, skipping Copilot issue.')
125+
return
126+
}
127+
128+
const report = JSON.parse(fs.readFileSync(reportFile, 'utf8'))
129+
const allRedirectGroups = report.groups.filter(g => g.isWarning)
130+
const redirectGroups = allRedirectGroups.slice(0, 10)
131+
132+
if (redirectGroups.length === 0) {
133+
core.info('No redirect groups found, skipping Copilot issue.')
134+
return
135+
}
136+
137+
const tableRows = redirectGroups.map(g => {
138+
const occ = g.occurrences[0]
139+
const redirectTarget = occ?.redirectTarget ?? 'unknown'
140+
const file = occ?.file ?? 'unknown'
141+
const lines = (occ?.lines ?? []).join(', ')
142+
return `| \`${g.target}\` | \`${redirectTarget}\` | \`${file}\` | ${lines} |`
143+
}).join('\n')
144+
145+
const artifactsUrl = `${context.serverUrl}/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}/artifacts`
146+
147+
const bodyLines = [
148+
'Copilot please fix the redirected internal links listed in the table below. All changes should be made within the `github/docs-internal` repository. For each entry, open the source file and replace the **Current Link** with the **Update To** path.',
149+
'When all changes are made, open a pull request in `github/docs-internal` with the fixes. The pull request description should reference this issue to create a link between them. When the pull request is open, leave a comment on this issue with a link to it.',
150+
'',
151+
`These are the first ${redirectGroups.length} of ${allRedirectGroups.length} redirects found.`,
152+
'',
153+
'## Redirects to fix',
154+
'',
155+
'| Current Link | Update To | File | Line(s) |',
156+
'|---|---|---|---|',
157+
tableRows,
158+
]
159+
160+
const MAX_ISSUE_BODY_LENGTH = 65536
161+
const artifactNote = `\n\n> [!NOTE]\n> The report was truncated because it exceeded the issue body length limit. [View the complete redirect report in the workflow artifacts](${artifactsUrl}).`
162+
163+
let body = bodyLines.join('\n')
164+
if (body.length > MAX_ISSUE_BODY_LENGTH) {
165+
const truncatedLength = MAX_ISSUE_BODY_LENGTH - artifactNote.length
166+
const lastNewline = body.lastIndexOf('\n', truncatedLength)
167+
body = body.slice(0, lastNewline > 0 ? lastNewline : truncatedLength) + artifactNote
168+
}
169+
170+
// Use the REST API with agent_assignment to properly trigger Copilot cloud agent.
171+
// See: https://docs.github.com/en/copilot/how-tos/use-copilot-agents/cloud-agent/start-copilot-sessions#using-the-rest-api
172+
const issue = await github.request('POST /repos/{owner}/{repo}/issues', {
173+
owner: 'github',
174+
repo: 'docs-content',
175+
title: '[Copilot Task] Fix top redirect links: ${{ matrix.version }}/${{ matrix.language }}',
176+
body,
177+
labels: ['broken link report'],
178+
assignees: ['copilot-swe-agent[bot]'],
179+
agent_assignment: {
180+
target_repo: 'github/docs-internal',
181+
base_branch: 'main',
182+
custom_instructions: 'For each entry in the table, open the source file in the github/docs-internal repository and replace the Current Link with the Update To path. When all changes are made, open a pull request in github/docs-internal with the fixes. When the pull request is open, leave a comment on this issue with a link to it.',
183+
},
184+
})
185+
186+
core.info(`Created Copilot redirect issue: ${issue.data.html_url}`)
187+
104188
- uses: ./.github/actions/slack-alert
105189
if: ${{ failure() && github.event_name != 'workflow_dispatch' }}
106190
with:
@@ -159,7 +243,7 @@ jobs:
159243
fi
160244
161245
- name: Create issue if broken links found
162-
if: steps.combine.outputs.has_reports == 'true'
246+
if: steps.combine.outputs.has_reports == 'true' && (github.event_name != 'workflow_dispatch' || inputs.create_report != false)
163247
uses: peter-evans/create-issue-from-file@fca9117c27cdc29c6c4db3b86c48e4115a786710 # v5
164248
with:
165249
token: ${{ secrets.DOCS_BOT_PAT_BASE }}

.github/workflows/needs-sme-stale-check.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,3 +41,8 @@ jobs:
4141
with:
4242
slack_channel_id: ${{ secrets.DOCS_ALERTS_SLACK_CHANNEL_ID }}
4343
slack_token: ${{ secrets.SLACK_DOCS_BOT_TOKEN }}
44+
45+
- uses: ./.github/actions/create-workflow-failure-issue
46+
if: ${{ failure() }}
47+
with:
48+
token: ${{ secrets.DOCS_BOT_PAT_BASE }}

.github/workflows/no-response.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,3 +63,8 @@ jobs:
6363
with:
6464
slack_channel_id: ${{ secrets.DOCS_ALERTS_SLACK_CHANNEL_ID }}
6565
slack_token: ${{ secrets.SLACK_DOCS_BOT_TOKEN }}
66+
67+
- uses: ./.github/actions/create-workflow-failure-issue
68+
if: ${{ failure() }}
69+
with:
70+
token: ${{ secrets.DOCS_BOT_PAT_BASE }}

.github/workflows/notify-about-deployment.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,3 +75,8 @@ jobs:
7575
with:
7676
slack_channel_id: ${{ secrets.DOCS_ALERTS_SLACK_CHANNEL_ID }}
7777
slack_token: ${{ secrets.SLACK_DOCS_BOT_TOKEN }}
78+
79+
- uses: ./.github/actions/create-workflow-failure-issue
80+
if: ${{ failure() }}
81+
with:
82+
token: ${{ secrets.DOCS_BOT_PAT_BASE }}

.github/workflows/repo-sync.yml

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,29 @@ jobs:
2828
persist-credentials: false
2929

3030
- name: Sync repo to branch
31-
uses: repo-sync/github-sync@3832fe8e2be32372e1b3970bbae8e7079edeec88
32-
with:
33-
source_repo: https://${{ secrets.DOCS_BOT_PAT_REPO_SYNC }}@github.com/github/${{ github.repository == 'github/docs-internal' && 'docs' || 'docs-internal' }}.git
34-
source_branch: main
35-
destination_branch: repo-sync
36-
github_token: ${{ secrets.DOCS_BOT_PAT_REPO_SYNC }}
31+
env:
32+
SOURCE_REPO: https://${{ secrets.DOCS_BOT_PAT_REPO_SYNC }}@github.com/github/${{ github.repository == 'github/docs-internal' && 'docs' || 'docs-internal' }}.git
33+
SOURCE_BRANCH: main
34+
DESTINATION_BRANCH: repo-sync
35+
GH_TOKEN: ${{ secrets.DOCS_BOT_PAT_REPO_SYNC }}
36+
run: |
37+
set -euo pipefail
38+
39+
: "${GH_TOKEN:?DOCS_BOT_PAT_REPO_SYNC is empty}"
40+
: "${SOURCE_REPO:?SOURCE_REPO is empty}"
41+
: "${SOURCE_BRANCH:?SOURCE_BRANCH is empty}"
42+
: "${DESTINATION_BRANCH:?DESTINATION_BRANCH is empty}"
43+
44+
git config --unset-all http."https://github.com/".extraheader || true
45+
46+
git remote remove tmp_upstream 2>/dev/null || true
47+
trap 'git remote remove tmp_upstream 2>/dev/null || true' EXIT
48+
49+
git remote set-url origin "https://x-access-token:${GH_TOKEN}@github.com/${GITHUB_REPOSITORY}.git"
50+
git remote add tmp_upstream "${SOURCE_REPO}"
51+
52+
git fetch tmp_upstream --quiet
53+
git push origin "refs/remotes/tmp_upstream/${SOURCE_BRANCH}:refs/heads/${DESTINATION_BRANCH}" --force
3754
3855
- name: Ship pull request
3956
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3

.github/workflows/reviewers-docs-engineering.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ jobs:
4040
${{ github.repository == 'github/docs-internal' &&
4141
!github.event.pull_request.draft &&
4242
!contains(github.event.pull_request.labels.*.name, 'reviewers-docs-engineering') &&
43+
!contains(github.event.pull_request.labels.*.name, 'lockfile-churn-only') &&
4344
github.event.pull_request.head.ref != 'repo-sync' }}
4445
runs-on: ubuntu-latest
4546
env:
@@ -50,7 +51,45 @@ jobs:
5051
- name: Checkout repository
5152
uses: actions/checkout@v6.0.1
5253

54+
# Detect PRs that only changed package-lock.json (no engineering source files).
55+
# These are usually cross-platform `npm install` churn from contributors
56+
# editing content. We comment with reset instructions instead of pulling in
57+
# docs-engineering for review.
58+
- name: Detect lockfile-only churn
59+
id: detect
60+
run: |
61+
changed=$(gh pr diff "$PR" --name-only)
62+
echo "Changed files:"
63+
echo "$changed"
64+
lockfile=$(echo "$changed" | grep -c '^package-lock\.json$' || true)
65+
other_eng=$(echo "$changed" | grep -cE '(\.tsx?$|\.scss$|^src/|^package\.json$|^\.github/|^config/|^\.devcontainer/|Dockerfile)' || true)
66+
if [ "$lockfile" -gt 0 ] && [ "$other_eng" -eq 0 ]; then
67+
echo "lockfile_only=true" >> "$GITHUB_OUTPUT"
68+
else
69+
echo "lockfile_only=false" >> "$GITHUB_OUTPUT"
70+
fi
71+
72+
- name: Comment and label lockfile-only PRs
73+
if: steps.detect.outputs.lockfile_only == 'true'
74+
run: |
75+
cat > /tmp/lockfile-churn-body.md <<'EOF'
76+
_Posted by Copilot on behalf of docs-engineering._
77+
78+
This PR includes `package-lock.json` changes but no engineering files. Please reset the lockfile:
79+
80+
```
81+
git checkout origin/main -- package-lock.json
82+
git commit -m "Reset package-lock.json"
83+
git push
84+
```
85+
86+
If the lockfile change is intentional, remove the `lockfile-churn-only` label and request docs-engineering review.
87+
EOF
88+
gh pr comment "$PR" --body-file /tmp/lockfile-churn-body.md
89+
gh pr edit "$PR" --add-label lockfile-churn-only
90+
5391
- name: Add docs engineering as a reviewer
92+
if: steps.detect.outputs.lockfile_only != 'true'
5493
uses: ./.github/actions/retry-command
5594
with:
5695
command: gh pr edit $PR --add-reviewer github/docs-engineering --add-label reviewers-docs-engineering

0 commit comments

Comments
 (0)