Skip to content

Commit 49d9837

Browse files
authored
Merge pull request #43208 from github/repo-sync
Repo sync
2 parents 4af4649 + 33dfcc3 commit 49d9837

File tree

632 files changed

+999
-1586
lines changed

Some content is hidden

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

632 files changed

+999
-1586
lines changed

.github/workflows/codeql.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,6 @@ on:
88
pull_request:
99
branches:
1010
- main
11-
paths:
12-
- '**/*.ts'
13-
- '**/*.tsx'
14-
- '.github/workflows/codeql.yml'
1511
# This is so that when CodeQL runs on a pull request, it can compare
1612
# against the state of the base branch.
1713
push:

.github/workflows/repo-sync.yml

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -146,14 +146,30 @@ jobs:
146146
147147
console.log('Merging the pull request')
148148
// Admin merge pull request to avoid squash
149-
await github.rest.pulls.merge({
150-
owner,
151-
repo,
152-
pull_number,
153-
merge_method: 'merge',
154-
})
155-
// Error loud here, so no try/catch
156-
console.log('Merged the pull request successfully')
149+
// Retry once per minute for up to 15 minutes to wait for required checks (e.g. CodeQL)
150+
const maxAttempts = 15
151+
const delay = 60_000 // 1 minute
152+
for (let attempt = 1; attempt <= maxAttempts; attempt++) {
153+
try {
154+
await github.rest.pulls.merge({
155+
owner,
156+
repo,
157+
pull_number,
158+
merge_method: 'merge',
159+
})
160+
console.log('Merged the pull request successfully')
161+
break
162+
} catch (mergeError) {
163+
const msg = mergeError.message || mergeError.response?.data?.message || ''
164+
const isRuleViolation = mergeError.status === 405 &&
165+
msg.includes('Repository rule violations')
166+
if (!isRuleViolation || attempt === maxAttempts) {
167+
throw mergeError
168+
}
169+
console.log(`Merge blocked by required checks (attempt ${attempt}/${maxAttempts}), retrying in 60s...`)
170+
await new Promise(resolve => setTimeout(resolve, delay))
171+
}
172+
}
157173
158174
- uses: ./.github/actions/slack-alert
159175
if: ${{ failure() && github.event_name != 'workflow_dispatch' }}
Lines changed: 171 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,171 @@
1+
name: Sync llms.txt to github/github
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches:
7+
- main
8+
paths:
9+
- 'data/llms-txt-config.yml'
10+
- 'src/workflows/generate-llms-txt.ts'
11+
schedule:
12+
- cron: '20 16 * * 1-5' # Weekdays at ~9:20am Pacific
13+
14+
permissions:
15+
contents: read
16+
17+
concurrency:
18+
group: '${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}'
19+
cancel-in-progress: true
20+
21+
jobs:
22+
sync:
23+
name: Sync llms.txt
24+
if: github.repository == 'github/docs-internal'
25+
runs-on: ubuntu-latest
26+
steps:
27+
- name: Checkout docs-internal
28+
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
29+
with:
30+
persist-credentials: false
31+
32+
- uses: ./.github/actions/node-npm-setup
33+
34+
- name: Generate llms.txt
35+
env:
36+
DOCS_BOT_PAT_BASE: ${{ secrets.DOCS_BOT_PAT_BASE }}
37+
run: |
38+
echo "Generating llms.txt from page catalog and popularity data..."
39+
npm run generate-llms-txt --silent > /tmp/llms.txt
40+
echo "Generated llms.txt ($(wc -l < /tmp/llms.txt) lines, $(wc -c < /tmp/llms.txt) bytes)"
41+
42+
- name: Fetch current llms.txt from github/github
43+
id: fetch
44+
env:
45+
GH_TOKEN: ${{ secrets.DOCS_BOT_PAT_BASE }}
46+
run: |
47+
echo "Fetching current public/llms.txt from github/github..."
48+
if gh api repos/github/github/contents/public/llms.txt \
49+
--jq '.content' 2>/dev/null | base64 -d > /tmp/current.txt; then
50+
echo "Fetched current file ($(wc -l < /tmp/current.txt) lines)"
51+
else
52+
echo "No existing file found (first run)"
53+
rm -f /tmp/current.txt
54+
fi
55+
56+
- name: Diff generated vs current
57+
id: diff
58+
run: |
59+
echo "Comparing generated llms.txt against current..."
60+
if [ -f /tmp/current.txt ] && diff -q /tmp/llms.txt /tmp/current.txt > /dev/null 2>&1; then
61+
echo "No changes detected, skipping push"
62+
echo "changed=false" >> "$GITHUB_OUTPUT"
63+
else
64+
echo "Changes detected:"
65+
diff --unified=0 /tmp/current.txt /tmp/llms.txt | head -30 || true
66+
echo "changed=true" >> "$GITHUB_OUTPUT"
67+
fi
68+
69+
- name: Ensure sync branch exists in github/github
70+
if: steps.diff.outputs.changed == 'true'
71+
env:
72+
GH_TOKEN: ${{ secrets.DOCS_BOT_PAT_BASE }}
73+
run: |
74+
BRANCH="auto/sync-llms-txt"
75+
REPO="github/github"
76+
77+
echo "Checking if branch '$BRANCH' exists..."
78+
BRANCH_SHA=$(gh api "repos/$REPO/git/ref/heads/$BRANCH" --jq '.object.sha' 2>/dev/null || true)
79+
if [ -n "$BRANCH_SHA" ]; then
80+
echo "Branch exists at $BRANCH_SHA"
81+
else
82+
echo "Branch does not exist, creating from default branch..."
83+
DEFAULT_BRANCH=$(gh api "repos/$REPO" --jq '.default_branch')
84+
BASE_SHA=$(gh api "repos/$REPO/git/ref/heads/$DEFAULT_BRANCH" --jq '.object.sha')
85+
gh api "repos/$REPO/git/refs" \
86+
--method POST \
87+
-f ref="refs/heads/$BRANCH" \
88+
-f sha="$BASE_SHA"
89+
echo "Created branch from $DEFAULT_BRANCH at $BASE_SHA"
90+
fi
91+
92+
- name: Commit llms.txt to github/github
93+
if: steps.diff.outputs.changed == 'true'
94+
env:
95+
GH_TOKEN: ${{ secrets.DOCS_BOT_PAT_BASE }}
96+
run: |
97+
BRANCH="auto/sync-llms-txt"
98+
REPO="github/github"
99+
CONTENT=$(base64 -w 0 /tmp/llms.txt)
100+
101+
echo "Checking for existing file SHA on branch..."
102+
EXISTING_SHA=$(gh api "repos/$REPO/contents/public/llms.txt?ref=$BRANCH" \
103+
--jq '.sha' 2>/dev/null || true)
104+
if [ -n "$EXISTING_SHA" ]; then
105+
echo "Existing file SHA: $EXISTING_SHA"
106+
else
107+
echo "No existing file on branch (new file)"
108+
fi
109+
110+
echo "Committing llms.txt to $REPO/$BRANCH..."
111+
COMMIT_ARGS=(-f "message=Sync llms.txt from docs.github.com"
112+
-f "content=$CONTENT"
113+
-f "branch=$BRANCH")
114+
if [ -n "$EXISTING_SHA" ]; then
115+
COMMIT_ARGS+=(-f "sha=$EXISTING_SHA")
116+
fi
117+
gh api "repos/$REPO/contents/public/llms.txt" \
118+
--method PUT \
119+
"${COMMIT_ARGS[@]}" --jq '.commit.sha'
120+
echo "Committed successfully"
121+
122+
- name: Create PR if needed
123+
if: steps.diff.outputs.changed == 'true'
124+
env:
125+
GH_TOKEN: ${{ secrets.DOCS_BOT_PAT_BASE }}
126+
run: |
127+
BRANCH="auto/sync-llms-txt"
128+
REPO="github/github"
129+
130+
echo "Checking for existing PR from '$BRANCH'..."
131+
EXISTING_PR=$(gh pr list --repo "$REPO" --head "$BRANCH" \
132+
--json number --jq '.[0].number' 2>/dev/null || true)
133+
if [ -n "$EXISTING_PR" ]; then
134+
echo "PR #$EXISTING_PR already exists, updated with new commit"
135+
exit 0
136+
fi
137+
138+
RUN_URL="${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}"
139+
DEFAULT_BRANCH=$(gh api "repos/$REPO" --jq '.default_branch')
140+
141+
PR_BODY="The [sync-llms-txt workflow]($RUN_URL) generated this PR.
142+
143+
Updates \`public/llms.txt\` served at \`github.com/llms.txt\`. The docs-internal script builds this file from the page catalog and popularity data.
144+
145+
No feature flags. Static file in \`public/\`, no code changes.
146+
147+
<!--
148+
Labels for github/github PR template automation:
149+
(\`environment:production-dotcom\`)
150+
(\`risk:low\`)
151+
(\`validate:other\`)
152+
(\`mitigate:rollback\`)
153+
(\`backend/rails/api-only\`)
154+
pull_request_template_version=2
155+
-->"
156+
157+
echo "Creating PR..."
158+
gh pr create \
159+
--repo "$REPO" \
160+
--title "Sync llms.txt from docs.github.com" \
161+
--body "$PR_BODY" \
162+
--head "$BRANCH" \
163+
--base "$DEFAULT_BRANCH" \
164+
--label "docs"
165+
echo "PR created successfully"
166+
167+
- uses: ./.github/actions/slack-alert
168+
if: ${{ failure() && github.event_name != 'workflow_dispatch' }}
169+
with:
170+
slack_channel_id: ${{ secrets.DOCS_ALERTS_SLACK_CHANNEL_ID }}
171+
slack_token: ${{ secrets.SLACK_DOCS_BOT_TOKEN }}

CHANGELOG.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,19 @@
11
# Docs changelog
22

3+
**2 March 2026**
4+
5+
We've added an article about the new `/research` slash command in Copilot CLI:
6+
7+
[Researching with GitHub Copilot CLI](https://docs.github.com/copilot/concepts/agents/copilot-cli/research)
8+
9+
<hr>
10+
11+
**27 February 2026**
12+
13+
We've extended the reference information for Copilot CLI, adding much more detail. See [GitHub Copilot CLI command reference](https://docs.github.com/en/copilot/reference/cli-command-reference#custom-agents-reference).
14+
15+
<hr>
16+
317
**25 February 2026**
418

519
We've added many new articles to coincide with the [general availability release](https://github.blog/changelog/2026-02-25-github-copilot-cli-is-now-generally-available/) of Copilot CLI. These include:

0 commit comments

Comments
 (0)