Skip to content

Commit 6664638

Browse files
authored
Merge pull request #46381 from github/repo-sync
Repo sync
2 parents 9af3df3 + d589b2b commit 6664638

109 files changed

Lines changed: 3615 additions & 489 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/actions/node-npm-setup/action.yml‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ runs:
1313
SEGMENT_DOWNLOAD_TIMEOUT_MINS: '1'
1414
with:
1515
path: node_modules
16-
key: ${{ runner.os }}-node_modules-${{ hashFiles('package*.json') }}-${{ hashFiles('.github/actions/node-npm-setup/action.yml') }}
16+
# The postinstall script applies patches/ during npm ci, so patch changes must miss the cache.
17+
key: ${{ runner.os }}-node_modules-${{ hashFiles('package*.json', 'patches/**') }}-${{ hashFiles('.github/actions/node-npm-setup/action.yml') }}
1718

1819
# The npm download cache only helps npm ci, so skip its 153 MB restore when node_modules hits.
1920
- name: Setup Node.js

‎.github/workflows/orphaned-features-check.yml‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ on:
1414
- 'package*.json'
1515
- 'src/data-directory/scripts/find-orphaned-features/**'
1616
- .github/actions/clone-translations/action.yml
17+
- .github/actions/get-docs-early-access/action.yml
1718
- .github/actions/node-npm-setup/action.yml
1819

1920
permissions:
@@ -38,6 +39,11 @@ jobs:
3839

3940
- uses: ./.github/actions/node-npm-setup
4041

42+
# Early access docs use data/features too, so include them before deciding that a feature is unused.
43+
- uses: ./.github/actions/get-docs-early-access
44+
with:
45+
token: ${{ secrets.DOCS_BOT_PAT_BASE }}
46+
4147
- name: Check for orphaned features
4248
env:
4349
# The gh CLI reads GITHUB_TOKEN.

‎.github/workflows/repo-sync.yml‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,12 @@ permissions:
1212
contents: write
1313
pull-requests: write
1414

15+
# Queue overlapping runs. A second run closes every open repo-sync pull request, including one
16+
# the first run is still waiting to merge. Cancelling mid-merge would leave that pull request open.
17+
concurrency:
18+
group: ${{ github.workflow }}
19+
cancel-in-progress: false
20+
1521
jobs:
1622
repo-sync:
1723
if: github.repository == 'github/docs-internal' || github.repository == 'github/docs'

‎.github/workflows/reviewers-dependabot.yml‎

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,32 @@ on:
1212
- reopened
1313
- synchronize
1414
paths:
15-
- 'data/reusable/dependabot/**'
16-
- 'content/code-security/dependabot/**'
15+
- 'data/reusables/dependabot/**'
16+
- 'data/reusables/**/*dependabot*'
17+
- 'content/code-security/**/*dependabot*'
18+
- 'content/code-security/**/*dependabot*/**'
19+
# Dependabot articles whose paths do not contain "dependabot"
20+
- 'content/code-security/concepts/supply-chain-security/malware-alerts.md'
21+
- 'content/code-security/concepts/supply-chain-security/multi-ecosystem-updates.md'
22+
- 'content/code-security/how-tos/secure-at-scale/configure-enterprise-security/configure-specific-tools/configure-limited-internet-access.md'
23+
- 'content/code-security/how-tos/secure-your-supply-chain/manage-your-dependency-security/configure-access-to-private-registries.md'
24+
- 'content/code-security/how-tos/secure-your-supply-chain/manage-your-dependency-security/configure-on-github-hosted-runners.md'
25+
- 'content/code-security/how-tos/secure-your-supply-chain/manage-your-dependency-security/configure-on-self-hosted-runners.md'
26+
- 'content/code-security/how-tos/secure-your-supply-chain/manage-your-dependency-security/configure-private-registries.md'
27+
- 'content/code-security/how-tos/secure-your-supply-chain/manage-your-dependency-security/controlling-dependencies-updated.md'
28+
- 'content/code-security/how-tos/secure-your-supply-chain/manage-your-dependency-security/list-configured-dependencies.md'
29+
- 'content/code-security/how-tos/secure-your-supply-chain/manage-your-dependency-security/prioritize-with-preset-rules.md'
30+
- 'content/code-security/how-tos/secure-your-supply-chain/manage-your-dependency-security/remove-access-to-public-registries.md'
31+
- 'content/code-security/how-tos/secure-your-supply-chain/manage-your-dependency-security/resolve-a-blocked-host.md'
32+
- 'content/code-security/how-tos/secure-your-supply-chain/secure-your-dependencies/auto-update-actions.md'
33+
- 'content/code-security/how-tos/secure-your-supply-chain/secure-your-dependencies/configure-malware-alerts.md'
34+
- 'content/code-security/how-tos/secure-your-supply-chain/secure-your-dependencies/configure-security-updates.md'
35+
- 'content/code-security/how-tos/secure-your-supply-chain/secure-your-dependencies/configure-version-updates.md'
36+
- 'content/code-security/how-tos/secure-your-supply-chain/secure-your-dependencies/configuring-multi-ecosystem-updates.md'
37+
- 'content/code-security/reference/supply-chain-security/criteria-for-preset-rules.md'
38+
- 'content/code-security/reference/supply-chain-security/supported-ecosystems-and-manifests-for-dependency-scope.md'
39+
- 'content/code-security/reference/supply-chain-security/supported-ecosystems-and-repositories.md'
40+
- 'content/code-security/tutorials/secure-your-dependencies/optimizing-pr-creation-version-updates.md'
1741
- 'content/rest/dependabot/**'
1842
- '.github/workflows/reviewers-dependabot.yml'
1943

‎.github/workflows/sync-audit-logs.yml‎

Lines changed: 61 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -47,61 +47,81 @@ jobs:
4747
env:
4848
GITHUB_TOKEN: ${{ secrets.DOCS_BOT_PAT_BASE }}
4949
run: |
50-
echo "Creating a new branch if needed..."
5150
branchname=audit-logs-schema-update-${{ steps.audit-log-allowlists.outputs.COMMIT_SHA }}
52-
remotesha=$(git ls-remote --heads origin $branchname)
53-
if [ -n "$remotesha" ]; then
54-
echo "Branch $branchname already exists in 'github/docs-internal'. Exiting..."
55-
exit 0
56-
fi
57-
git checkout -b $branchname
58-
echo "Created a new branch $branchname"
59-
60-
echo "Preparing commit..."
61-
git config --global user.name "docs-bot"
62-
git config --global user.email "77750099+docs-bot@users.noreply.github.com"
63-
git add -A .
64-
echo "Prepared commit"
65-
66-
echo "Check if there are changes..."
67-
if git diff-index --cached --quiet HEAD -- . ':(exclude)src/audit-logs/lib/config.json'
68-
then
69-
echo "No real changes (only the SHA in config.json moved). Exiting…"
51+
52+
# People close sync PRs that fail to deploy or merge, so do not reopen this SHA after a close.
53+
# Reuse an open PR from an earlier run so a rerun does not restart its CI.
54+
# --head matches fork branches too, so only trust same-repo PRs that docs-bot opened.
55+
existing_pr=$(gh pr list --repo github/docs-internal --head "$branchname" --state all --json number,state,author,isCrossRepository \
56+
--jq 'map(select(.author.login == "docs-bot" and (.isCrossRepository | not))) | .[0] | select(.) | "\(.number) \(.state)"')
57+
if [ -n "$existing_pr" ] && [ "${existing_pr#* }" != "OPEN" ]; then
58+
echo "Pull request #${existing_pr% *} for branch $branchname is ${existing_pr#* }. Exiting..."
7059
exit 0
60+
elif [ -n "$existing_pr" ]; then
61+
pr=${existing_pr% *}
62+
echo "Pull request #$pr already exists for branch $branchname. Checking that it holds only the regenerated data..."
63+
# Others can push to the branch, so approve only if it matches this run's output.
64+
git add -A .
65+
git fetch --depth=1 origin "$branchname"
66+
pr_files=$(gh api --paginate "repos/github/docs-internal/pulls/$pr/files" --jq '.[].filename')
67+
unexpected_files=$(echo "$pr_files" | grep -v -e '^src/audit-logs/data/' -e '^src/audit-logs/lib/config\.json$' || true)
68+
if [ -n "$unexpected_files" ] || ! git diff --cached --quiet FETCH_HEAD -- src/audit-logs/data src/audit-logs/lib/config.json; then
69+
echo "Pull request #$pr does not match the regenerated audit log data. Fix or close it by hand."
70+
echo "Unexpected files: ${unexpected_files:-none}"
71+
exit 1
72+
fi
73+
echo "Pull request #$pr matches the regenerated data. Skipping to approval."
74+
else
75+
git checkout -b $branchname
76+
echo "Created a new branch $branchname"
77+
78+
echo "Preparing commit..."
79+
git config --global user.name "docs-bot"
80+
git config --global user.email "77750099+docs-bot@users.noreply.github.com"
81+
git add -A .
82+
echo "Prepared commit"
83+
84+
echo "Check if there are changes..."
85+
if git diff-index --cached --quiet HEAD -- . ':(exclude)src/audit-logs/lib/config.json'
86+
then
87+
echo "No real changes (only the SHA in config.json moved). Exiting…"
88+
exit 0
89+
fi
90+
echo "Changes detected, proceeding"
91+
92+
echo "Creating commit..."
93+
git commit -m "Add updated audit log event data"
94+
echo "Created commit"
95+
96+
# Force-push reruns over failed attempts; this workflow exclusively owns these branches.
97+
echo "Pushing commit..."
98+
git push --force -u origin $branchname
99+
echo "Pushed commit"
100+
101+
echo "Creating pull request..."
102+
pr=$(gh pr create \
103+
--title "Update audit log event data" \
104+
--body '👋 Docs First Responder. This PR updates the audit log event data with the latest changes, synced from github/audit-log-allowlists.
105+
Make sure the PR builds successfully and there are no gross errors (for example, a file is deleted). You do not need to validate the contents (that is the responsibility of product teams).
106+
If CI does not pass or other problems arise, contact #technical-content on slack.' \
107+
--repo github/docs-internal \
108+
--label audit-log-pipeline,workflow-generated \
109+
--head=$branchname)
110+
echo "Created pull request $pr"
71111
fi
72-
echo "Changes detected, proceeding"
73-
74-
echo "Creating commit..."
75-
git commit -m "Add updated audit log event data"
76-
echo "Created commit"
77-
78-
echo "Pushing commit..."
79-
git push origin $branchname
80-
echo "Pushed commit"
81-
82-
echo "Creating pull request..."
83-
gh pr create \
84-
--title "Update audit log event data" \
85-
--body '👋 Docs First Responder. This PR updates the audit log event data with the latest changes, synced from github/audit-log-allowlists.
86-
Make sure the PR builds successfully and there are no gross errors (for example, a file is deleted). You do not need to validate the contents (that is the responsibility of product teams).
87-
If CI does not pass or other problems arise, contact #technical-content on slack.' \
88-
--repo github/docs-internal \
89-
--label audit-log-pipeline,workflow-generated \
90-
--head=$branchname
91-
echo "Created pull request"
92112
93113
# docs-bot cannot approve its own PR, so GITHUB_TOKEN approves it.
94114
echo "Approving pull request..."
95115
unset GITHUB_TOKEN
96116
gh auth login --with-token <<< "${{ secrets.GITHUB_TOKEN }}"
97-
gh pr review --approve
117+
gh pr review "$pr" --approve
98118
echo "Approved pull request"
99119
100120
# GITHUB_TOKEN cannot enable auto-merge here, so docs-bot enables it.
101121
echo "Setting pull request to auto merge..."
102122
unset GITHUB_TOKEN
103123
gh auth login --with-token <<< "${{ secrets.DOCS_BOT_PAT_BASE }}"
104-
gh pr merge --auto
124+
gh pr merge "$pr" --auto
105125
echo "Set pull request to auto merge"
106126
107127
- uses: ./.github/actions/create-workflow-failure-issue

‎content/actions/how-tos/secure-your-work/security-harden-deployments/oidc-in-jfrog.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ jobs:
8787
```yaml
8888
{% data reusables.actions.actions-not-certified-by-github-comment %}
8989
- name: Sign in to Artifactory Docker registry
90-
uses: docker/login-action@v3
90+
uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3.7.0
9191
with:
9292
registry: {% raw %}${{ env.JF_URL }}{% endraw %}
9393
username: {% raw %}${{ steps.setup-jfrog-cli.outputs.oidc-user }}{% endraw %}

‎content/copilot/how-tos/copilot-sdk/auth/server-to-server-tokens.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
- uses: {% data reusables.actions.action-checkout %}
3131
- run: your-application
3232
env:
33-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
33+
GITHUB_TOKEN: {% raw %}${{ secrets.GITHUB_TOKEN }}{% endraw %}
3434
```
3535
3636
The organization's **Allow use of Copilot CLI billed to the organization** policy must be enabled. This approach needs no GitHub App or stored authentication secret. For details, see [AUTOTITLE](/copilot/how-tos/copilot-cli/use-copilot-cli-in-actions).

‎data/ui.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ rest:
210210
banner:
211211
api_versioned: The REST API is now versioned.
212212
api_version_info: For more information, see "<a href="{{ versionWithApiVersion }}/rest/overview/api-versions">About API versioning</a>."
213-
ghes_api_versioned: After a site administrator upgrades your Enterprise Server instance to {{ firstGhesReleaseWithApiVersions.versionTitle }} or later, the REST API will be versioned. To learn how to find your instance's version, see "<a href="/{{ currentVersion }}/get-started/learning-about-github/about-versions-of-github-docs#github-enterprise-server">About versions of GitHub Docs</a>".
213+
ghes_api_versioned: After a site administrator upgrades your Enterprise Server instance to {{ firstGhesReleaseWithApiVersions.versionTitle }} or later, the REST API will be versioned. To learn how to find your instance's version, see "<a href="/{{ currentVersion }}/get-started/using-github-docs/about-versions-of-github-docs#github-enterprise-server">About versions of GitHub Docs</a>".
214214
redirect_notice: We've recently moved some of the REST API documentation.
215215
redirect_repo: If you can't find what you're looking for, you might try the new {{ newRestPagesLinks }} REST API pages.
216216
redirect_enterprise: If you can't find what you're looking for, you might try the {{ actionsPageLink }} REST API page.

‎src/article-api/lib/summarize-schema.ts‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,22 @@ function renderProperties(
142142

143143
if (propType === 'array' && prop.items) {
144144
const itemTitle = prop.items.title
145+
const itemKey = (['oneOf', 'anyOf', 'allOf'] as const).find((k) => prop.items![k])
146+
if (itemKey) {
147+
const label = `${itemTitle ? `array of \`${itemTitle}\`` : 'array of items'}${isNullable ? ' or null' : ''}`
148+
if (shouldReference(itemTitle, depth < MAX_DEPTH, seen)) {
149+
lines.push(`${prefix}* \`${name}\`: ${reqStr}${label} (see above)`)
150+
} else {
151+
lines.push(`${prefix}* \`${name}\`: ${reqStr}${label}:`)
152+
if (prop.items.properties && depth < MAX_DEPTH) {
153+
lines.push(renderProperties(prop.items, indent + 1, depth + 1, seen))
154+
}
155+
lines.push(
156+
renderCompositionVariants(itemKey, prop.items[itemKey]!, indent + 1, depth, seen),
157+
)
158+
}
159+
continue
160+
}
145161
const canExpand = Boolean(prop.items.properties) && depth < MAX_DEPTH
146162
if (shouldReference(itemTitle, canExpand, seen)) {
147163
lines.push(

‎src/article-api/middleware/article.ts‎

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import {
1212
import { getArticleBody } from './article-body'
1313
import { getMetadata } from './article-pageinfo'
1414
import {
15-
makeLanguageSurrogateKey,
15+
makeContentSurrogateKeys,
1616
setFastlySurrogateKey,
1717
} from '@/frame/middleware/set-fastly-surrogate-key'
1818
import statsd from '@/observability/lib/statsd'
@@ -60,6 +60,7 @@ router.get(
6060
recordBodySize(req, bodyContent)
6161

6262
defaultCacheControl(res)
63+
setArticleSurrogateKeys(req, res)
6364
return res.json({
6465
meta,
6566
body: bodyContent,
@@ -102,12 +103,11 @@ router.get(
102103
recordBodySize(req, bodyContent)
103104

104105
defaultCacheControl(res)
106+
setArticleSurrogateKeys(req, res)
105107
return res.type('text/markdown').send(bodyContent)
106108
}),
107109
)
108110

109-
// /api/article/meta sets a language surrogate key because /api URLs lack a language segment.
110-
// Fastly needs the key for staggered language purges.
111111
/**
112112
* Get metadata about an article.
113113
* @route GET /api/article/meta
@@ -147,16 +147,21 @@ router.get(
147147

148148
incrementArticleLookup(req, 'meta')
149149
defaultCacheControl(res)
150-
151-
setFastlySurrogateKey(
152-
res,
153-
makeLanguageSurrogateKey(req.pageinfo?.page?.languageCode || 'en'),
154-
true,
155-
)
150+
setArticleSurrogateKeys(req, res)
156151
return res.json(meta)
157152
}),
158153
)
159154

155+
// /api URLs lack a language segment, so every Article API route sets language and page keys.
156+
// The page key matches the key that deploy purges build from changed content files.
157+
function setArticleSurrogateKeys(req: ExtendedRequestWithPageInfo, res: Response) {
158+
const keys = makeContentSurrogateKeys({
159+
langCode: req.pageinfo.page?.languageCode || 'en',
160+
relativePath: req.pageinfo.page?.relativePath,
161+
})
162+
setFastlySurrogateKey(res, keys.join(' '), true)
163+
}
164+
160165
// Keep Datadog metric tags consistent across Article API endpoints.
161166
// Datadog tags max at 200 characters, so path and source tags are truncated.
162167
// See https://docs.datadoghq.com/getting_started/tagging/#define-tags

0 commit comments

Comments
 (0)