Skip to content

Commit d42e9e6

Browse files
authored
Merge pull request #46164 from github/repo-sync
Repo sync
2 parents 87cce24 + 1669655 commit d42e9e6

91 files changed

Lines changed: 873 additions & 10666 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/all-documents.yml‎

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
name: All documents script
22

3-
# **What it does**: Verifies that the all-documents script works.
4-
# **Why we have it**: Code quality and sustainability.
5-
# **Who does it impact**: docs-engineering
3+
# Catches all-documents crashes. This workflow has no output assertions.
64

75
on:
86
pull_request:
@@ -38,5 +36,3 @@ jobs:
3836
echo ""
3937
echo "Look at the first 50 lines of the file..."
4038
cat all-documents.json | jq | head -n 50
41-
42-
# We're essentially expecting it to not crash and fail.

‎.github/workflows/article-api-docs.yml‎

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,13 @@
11
name: 'Check article-api docs'
22

3-
# **What it does**: Makes sure changes to the article api are documented.
4-
# **Why we have it**: So what's documented doesn't fall behind
5-
# **Who does it impact**: Docs engineering, CGS team
3+
# Keeps generated article API docs from falling behind middleware changes.
64

75
on:
86
workflow_dispatch:
97
pull_request:
108
paths:
119
- 'src/article-api/middleware/article.ts'
1210
- 'src/article-api/middleware/pagelist.ts'
13-
# Self-test
1411
- .github/workflows/article-api-docs.yml
1512

1613
permissions:
@@ -34,8 +31,6 @@ jobs:
3431
if [ -n "$(git status --porcelain)" ]; then
3532
git status
3633
git diff
37-
38-
# Some whitespace for the sake of the message below
3934
echo ""
4035
echo ""
4136

‎.github/workflows/auto-add-ready-for-doc-review.yml‎

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
name: Auto-add ready-for-doc-review label
22

3-
# **What it does**: Automatically adds the "ready-for-doc-review" label to DIY docs PRs that contain content or data changes when they are opened in a non-draft state or converted from draft to ready for review.
4-
# **Why we have it**: To ensure DIY docs PRs are automatically added to the docs-content review board without requiring manual labeling.
5-
# **Who does it impact**: Contributors making content changes and docs-content reviewers.
3+
# Sends DIY content changes to the docs-content review board without manual labeling.
64

75
on:
86
pull_request:
@@ -34,8 +32,7 @@ jobs:
3432
github-token: ${{ secrets.DOCS_BOT_PAT_BASE }}
3533
script: |
3634
try {
37-
// Team is addressed by numeric ID (org github = 9919, team docs = 325922)
38-
// because IDs survive team renames and slugs do not.
35+
// 9919 is the github org and 325922 the docs team; numeric IDs survive renames.
3936
await github.request('GET /organizations/{org_id}/team/{team_id}/memberships/{username}', {
4037
org_id: 9919,
4138
team_id: 325922,

‎.github/workflows/auto-close-dependencies.yml‎

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
name: Auto Close Open Source Dependency Updates
22

3-
# **What it does**:
4-
# - close-external: Automatically close dependabot's pull requests in the open-source repository.
5-
# **Why we have it**:
6-
# - close-external: To avoid duplicating updates against the internal repository.
7-
# **Who does it impact**: It helps docs engineering focus on higher value work.
3+
# Closes Dependabot dependency updates in github/docs because the internal repo owns them.
84

95
on:
106
pull_request:
@@ -48,7 +44,7 @@ jobs:
4844
run: |
4945
gh pr comment "$PR_URL" --body "This dependency update will be handled internally by our engineering team."
5046
51-
# Because we get far too much spam ;_;
47+
# Lock conversations to stop repeated dependency-update comments.
5248
- name: Lock conversations
5349
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3
5450
env:

‎.github/workflows/benchmark-pages.yml‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
name: 'Weekly page benchmark'
22

3-
# **What it does**: Benchmarks all pages via the article API, flags errors and slow pages
4-
# **Why we have it**: Catch perf regressions and broken pages before users hit them
5-
# **Who does it impact**: Docs engineering
3+
# Catches slow or broken article API pages before users hit them.
64

75
on:
86
workflow_dispatch:
97
schedule:
10-
- cron: '20 16 * * 1' # Every Monday at 16:20 UTC / 8:20 PST
8+
- cron: '20 16 * * 1' # Mondays at 16:20 UTC.
119

1210
permissions:
1311
contents: read

‎.github/workflows/changelog-agent.yml‎

Lines changed: 7 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
11
name: Changelog agent — draft entry when a qualified PR merges
22

3-
# **What it does**: When a PR merges that closes a docs-content issue with a
4-
# parent issue, uses an LLM to draft a changelog entry, opens a PR in
5-
# github/docs-content, and DMs the author in Slack for review.
6-
# **Why we have it**: Automates the changelog drafting process so authors
7-
# don't have to remember to write a changelog entry manually.
8-
# **Who does it impact**: docs-content team members.
3+
# Drafts internal changelog entries for merged PRs that close a docs-content child issue.
4+
# Authors review generated PRs before publication.
95

106
on:
117
pull_request:
@@ -81,7 +77,6 @@ jobs:
8177
script: |
8278
const author = '${{ steps.resolve_pr.outputs.pr_author }}';
8379
84-
// Fetch github-to-slack.json from docs-content via API
8580
let mapping = {};
8681
try {
8782
const { data } = await github.rest.repos.getContent({
@@ -96,7 +91,6 @@ jobs:
9691
return;
9792
}
9893
99-
// Remove non-user keys (like _comment)
10094
const teamMembers = Object.keys(mapping).filter(k => !k.startsWith('_'));
10195
10296
if (!teamMembers.includes(author)) {
@@ -119,8 +113,7 @@ jobs:
119113
script: |
120114
const body = process.env.PR_BODY || '';
121115
122-
// Match closing keywords followed by docs-content issue references.
123-
// Supports: closes github/docs-content#123, fixes https://github.com/github/docs-content/issues/123
116+
// Finds docs-content issues closed by the source PR body.
124117
const patterns = [
125118
/(?:close[sd]?|fix(?:e[sd])?|resolve[sd]?):?\s+github\/docs-content#(\d+)/gi,
126119
/(?:close[sd]?|fix(?:e[sd])?|resolve[sd]?):?\s+https:\/\/github\.com\/github\/docs-content\/issues\/(\d+)/gi,
@@ -168,7 +161,6 @@ jobs:
168161
return;
169162
}
170163
171-
// Query for parent issue via GraphQL
172164
const query = `
173165
query($nodeId: ID!) {
174166
node(id: $nodeId) {
@@ -218,7 +210,6 @@ jobs:
218210
core.setOutput('parent_assignees', (parent.assignees?.nodes || []).map(a => a.login).join(','));
219211
core.setOutput('parent_repo', parent.repository.nameWithOwner);
220212
221-
// Also store the docs-content issue details
222213
core.setOutput('dc_issue_title', issue.title);
223214
core.setOutput('dc_issue_body', issue.body || '');
224215
@@ -236,7 +227,6 @@ jobs:
236227
const prNumber = parseInt('${{ steps.resolve_pr.outputs.pr_number }}', 10);
237228
const prAuthor = '${{ steps.resolve_pr.outputs.pr_author }}';
238229
239-
// Get approved reviewers (exclude bots and PR author)
240230
const { data: reviews } = await github.rest.pulls.listReviews({
241231
owner: context.repo.owner,
242232
repo: context.repo.repo,
@@ -249,7 +239,6 @@ jobs:
249239
.map(r => r.user.login)
250240
)];
251241
252-
// Get changed files (paths only, limit to 50)
253242
const { data: files } = await github.rest.pulls.listFiles({
254243
owner: context.repo.owner,
255244
repo: context.repo.repo,
@@ -297,15 +286,13 @@ jobs:
297286
with:
298287
github-token: ${{ secrets.DOCS_BOT_PAT_BASE }}
299288
script: |
300-
// Fetch changelog-internal.md from docs-content
301289
const { data } = await github.rest.repos.getContent({
302290
owner: 'github',
303291
repo: 'docs-content',
304292
path: 'docs-content-docs/docs-content-workflows/changelog-internal.md',
305293
});
306294
const changelog = Buffer.from(data.content, 'base64').toString('utf-8');
307295
308-
// Extract the first 3 entries (each starts with **date**)
309296
const lines = changelog.split('\n');
310297
let count = 0;
311298
let examples = [];
@@ -420,12 +407,8 @@ jobs:
420407
uses: actions/ai-inference@2c43c91ae16266ca159d311430343c67a5ffa222 # v3
421408
with:
422409
provider: copilot
423-
# Must be an explicit empty string, not omitted. This action defaults
424-
# `model` to "gpt-4.1" and always forwards it as --model, and that slug
425-
# is retired, so omitting the input fails with:
426-
# Error: Model "gpt-4.1" from --model flag is not available.
427-
# An empty string makes the action skip --model entirely and lets the
428-
# Copilot CLI pick its own current default. See actions/ai-inference#271.
410+
# Keep this empty string. Omitting it makes actions/ai-inference pass
411+
# its retired gpt-4.1 default, which fails.
429412
model: ''
430413
prompt-file: prompt.txt
431414
system-prompt-file: system-prompt.txt
@@ -471,7 +454,6 @@ jobs:
471454
const branchName = `changelog-agent-${{ steps.resolve_pr.outputs.pr_number }}`;
472455
const filePath = 'docs-content-docs/docs-content-workflows/changelog-internal.md';
473456
474-
// Get the current changelog file from docs-content
475457
const { data: fileData } = await github.rest.repos.getContent({
476458
owner: 'github',
477459
repo: 'docs-content',
@@ -480,11 +462,9 @@ jobs:
480462
481463
let changelog = Buffer.from(fileData.content, 'base64').toString('utf-8');
482464
483-
// Build the new entry
484465
const entry = `**${process.env.DATE_STR}**\n\n${process.env.DRAFT}\n\n<hr>`;
485466
486-
// Insert after the first H1 heading so leading frontmatter, comments,
487-
// or blank lines do not affect placement.
467+
// Insert after the first H1 heading so frontmatter, comments, or blank lines do not affect placement.
488468
const lines = changelog.split('\n');
489469
const headingIndex = lines.findIndex((line) => line.startsWith('# '));
490470
@@ -498,14 +478,12 @@ jobs:
498478
: `${beforeAndHeading}\n\n${entry}`;
499479
}
500480
501-
// Get the default branch SHA for creating a new branch
502481
const { data: ref } = await github.rest.git.getRef({
503482
owner: 'github',
504483
repo: 'docs-content',
505484
ref: 'heads/main',
506485
});
507486
508-
// Create the branch in docs-content
509487
try {
510488
await github.rest.git.createRef({
511489
owner: 'github',
@@ -521,15 +499,13 @@ jobs:
521499
}
522500
}
523501
524-
// Fetch the file from the branch (handles both new and existing branches)
525502
const { data: branchFileData } = await github.rest.repos.getContent({
526503
owner: 'github',
527504
repo: 'docs-content',
528505
path: filePath,
529506
ref: branchName,
530507
});
531508
532-
// Update the changelog file on the new branch
533509
await github.rest.repos.createOrUpdateFileContents({
534510
owner: 'github',
535511
repo: 'docs-content',
@@ -544,7 +520,6 @@ jobs:
544520
},
545521
});
546522
547-
// Build credits for the PR body
548523
const reviewers = process.env.APPROVED_REVIEWERS
549524
? process.env.APPROVED_REVIEWERS.split(',').map(r => `@${r}`).join(', ')
550525
: 'None';
@@ -586,7 +561,6 @@ jobs:
586561
draft: false,
587562
});
588563
589-
// Add labels
590564
try {
591565
await github.rest.issues.addLabels({
592566
owner: 'github',
@@ -598,7 +572,6 @@ jobs:
598572
core.warning(`Failed to add labels: ${err.message}`);
599573
}
600574
601-
// Request review from PR author
602575
try {
603576
await github.rest.pulls.requestReviewers({
604577
owner: 'github',
@@ -632,7 +605,6 @@ jobs:
632605
const author = process.env.PR_AUTHOR;
633606
const changelogPrUrl = process.env.CHANGELOG_PR_URL;
634607
635-
// Fetch GitHub-to-Slack mapping from docs-content
636608
let slackMapping = {};
637609
try {
638610
const { data } = await github.rest.repos.getContent({
@@ -648,7 +620,6 @@ jobs:
648620
649621
const slackUserId = slackMapping[author];
650622
651-
// Build credits summary for the DM
652623
const reviewers = process.env.APPROVED_REVIEWERS
653624
? process.env.APPROVED_REVIEWERS.split(',').join(', ')
654625
: 'none';
@@ -699,7 +670,6 @@ jobs:
699670
core.warning(`No Slack mapping found for GitHub user: ${author}`);
700671
}
701672
702-
// Fallback: post a GitHub comment on the source PR
703673
core.info('Falling back to GitHub comment notification.');
704674
await github.rest.issues.createComment({
705675
owner: context.repo.owner,
@@ -732,7 +702,7 @@ jobs:
732702
body: `<!-- changelog-agent-handled -->\n🤖 A changelog draft PR has been automatically created in docs-content: ${changelogPrUrl}`,
733703
});
734704
735-
# Local composite actions below require the repository to be checked out.
705+
# Check out the repository before local composite actions run after a failure.
736706
- name: Check out repo
737707
if: ${{ failure() && github.event_name != 'workflow_dispatch' }}
738708
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0

‎.github/workflows/check-for-spammy-issues.yml‎

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
name: Check for Spammy Issues
22

3-
# **What it does**: This action closes low value issues in the open-source repository.
4-
# **Why we have it**: We get lots of spam in the open-source repository.
5-
# **Who does it impact**: Open-source contributors.
3+
# Closes low-value public issues so spam does not stay open in github/docs.
64

75
on:
86
issues:
@@ -39,24 +37,15 @@ jobs:
3937
username: context.payload.sender.login,
4038
});
4139
42-
// Do not perform this workflow with GitHub employees. This return
43-
// statement only gets hit if the user is a GitHub employee
40+
// Skip GitHub employees so legitimate internal reports stay open.
4441
return
4542
} catch (err) {
46-
// An error will be thrown if the user is not a GitHub employee
47-
// If a user is not a GitHub employee, we should check to see if title has at least the minimum required number of words in it and if it does, we can exit the workflow
48-
43+
// The membership lookup throws for non-employees, so fall through to title checks.
4944
if (titleWordCount >= titleWordCountMin && !titleHasUrl && !titleHasDollarSign) {
5045
return
5146
}
5247
}
5348
54-
//
55-
// Assuming the user is not a GitHub employee and the issue title
56-
// does not contain the minimum number of words required, proceed.
57-
//
58-
59-
// Close the issue and add the invalid label
6049
await github.rest.issues.update({
6150
owner: owner,
6251
repo: repo,
@@ -65,15 +54,13 @@ jobs:
6554
state: 'closed'
6655
});
6756
68-
// Comment on the issue
6957
await github.rest.issues.createComment({
7058
owner: owner,
7159
repo: repo,
7260
issue_number: issue.number,
7361
body: `This issue may have been opened accidentally. I'm going to close it now, but feel free to open a new issue with a more descriptive title! Make sure not to include full URLs in your issue titles, and use paths instead.`
7462
});
7563
76-
// Add the issue to the Done column on the triage board
7764
try {
7865
await github.rest.projects.createCard({
7966
column_id: 11167427,

‎.github/workflows/check-for-spammy-prs.yml‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
name: Check for Spammy PRs
22

3-
# **What it does**: This action closes low value pull requests and PRs that do not target main.
4-
# **Why we have it**: We get lots of spam in the open-source repository.
5-
# **Who does it impact**: Open-source contributors.
3+
# Flags low-value public PRs and closes PRs that target branches other than main.
64

75
on:
86
pull_request_target:

0 commit comments

Comments
 (0)