Skip to content

Commit cca0c9d

Browse files
authored
Merge pull request #46403 from github/repo-sync
Repo sync
2 parents 3a444c0 + ad8d32c commit cca0c9d

179 files changed

Lines changed: 5128 additions & 800 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.

‎.dockerignore‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,7 @@ docs-early-access/
88
node_modules/
99
README.md
1010
tests/
11+
# Local symlinks to docs-early-access. merge-early-access.sh creates these during the build.
12+
assets/images/early-access
13+
content/early-access
14+
data/early-access

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

Lines changed: 45 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ on:
88

99
permissions:
1010
contents: read
11+
issues: read
1112
pull-requests: write
1213

1314
jobs:
@@ -52,10 +53,49 @@ jobs:
5253
)
5354
const onlyIndexMd = files.length === 1 && files[0].filename.split('/').pop() === 'index.md'
5455
56+
// Content removals are allowed once the Docs team marks the linked issue `help wanted`.
57+
let hasApprovedIssue = false
58+
if (onlyDeletesLines || onlyDeletes) {
59+
try {
60+
const { repository } = await github.graphql(
61+
`query($owner: String!, $repo: String!, $number: Int!) {
62+
repository(owner: $owner, name: $repo) {
63+
pullRequest(number: $number) {
64+
closingIssuesReferences(first: 100) {
65+
nodes {
66+
repository {
67+
nameWithOwner
68+
}
69+
labels(first: 100) {
70+
nodes {
71+
name
72+
}
73+
}
74+
}
75+
}
76+
}
77+
}
78+
}`,
79+
{ owner, repo, number: pull_number },
80+
)
81+
const closingIssues = repository?.pullRequest?.closingIssuesReferences?.nodes || []
82+
// Issues in other repos don't count, since their owners can add the label themselves.
83+
hasApprovedIssue = closingIssues.some(issue =>
84+
issue.repository?.nameWithOwner?.toLowerCase() === `${owner}/${repo}` &&
85+
issue.labels.nodes.some(label => label.name.toLowerCase() === 'help wanted'),
86+
)
87+
} catch (error) {
88+
// Without the lookup, treat the removal as unapproved, as before.
89+
core.warning(`Could not check linked issues: ${error.message}`)
90+
}
91+
}
92+
const unapprovedLineDeletion = onlyDeletesLines && !hasApprovedIssue
93+
const unapprovedFileDeletion = onlyDeletes && !hasApprovedIssue
94+
5595
if (
5696
targetsNonMain ||
57-
onlyDeletesLines ||
58-
onlyDeletes ||
97+
unapprovedLineDeletion ||
98+
unapprovedFileDeletion ||
5999
isEmptyCommit ||
60100
touchesTooMany ||
61101
isBlankLineEdit ||
@@ -75,8 +115,8 @@ jobs:
75115
issue_number: pull_number,
76116
body: targetsNonMain
77117
? 'Pull requests must target the `main` branch. This pull request has been closed as invalid. If you think this is incorrect, please mention this in a corresponding issue.'
78-
: onlyDeletesLines
79-
? 'This pull request only removes existing content. Before submitting a content-removal pull request, please [open an issue](https://github.com/github/docs/issues/new/choose) explaining the proposed removal and wait for approval from the GitHub Docs team. Once the change has been approved, you can open a new pull request and link it to the issue.'
118+
: unapprovedLineDeletion
119+
? 'This pull request only removes existing content. Before submitting a content-removal pull request, please [open an issue](https://github.com/github/docs/issues/new/choose) explaining the proposed removal and wait for the GitHub Docs team to add the `help wanted` label to it. Once the issue has the `help wanted` label, you can open a new pull request that links the issue with `Closes: #<issue number>` in the description.'
80120
: "This pull request may have been opened accidentally. I'm going to close it now, but feel free to check out our [contribution guidelines](https://docs.github.com/en/contributing), or raise an issue.",
81121
})
82122
@@ -89,7 +129,7 @@ jobs:
89129
})
90130
}
91131
92-
if (onlyDeletesLines) {
132+
if (unapprovedLineDeletion) {
93133
core.setFailed(
94134
'This pull request only deletes lines. An approved issue is required first.',
95135
)

‎.github/workflows/content-pipelines.yml‎

Lines changed: 31 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,10 @@ jobs:
4949
GH_TOKEN: ${{ github.token }}
5050
UPDATE_BRANCH: ${{ steps.branch.outputs.update_branch }}
5151
run: |
52-
PR_NUMBER=$(gh pr list --head "$UPDATE_BRANCH" --state open --json number --jq '.[0].number // empty' 2>/dev/null || echo "")
52+
PR_NUMBER=$(gh pr list --head "$UPDATE_BRANCH" --state open --json number --jq '.[0].number // empty') || {
53+
echo "::error::Could not look up the PR for ${UPDATE_BRANCH}."
54+
exit 1
55+
}
5356
echo "pr_number=$PR_NUMBER" >> "$GITHUB_OUTPUT"
5457
5558
- name: Setup branch
@@ -137,23 +140,22 @@ jobs:
137140
echo "source_path=$SOURCE_PATH" >> "$GITHUB_OUTPUT"
138141
139142
- name: Create or update PR
140-
if: steps.commit.outputs.has_changes == 'true'
143+
if: steps.commit.outputs.has_changes == 'true' || steps.check-pr.outputs.pr_number != ''
141144
env:
142145
GH_TOKEN: ${{ secrets.DOCS_BOT_PAT_BASE }}
143146
UPDATE_BRANCH: ${{ steps.branch.outputs.update_branch }}
144147
PIPELINE_ID: ${{ matrix.id }}
145148
SOURCE_REPO: ${{ steps.source-info.outputs.source_repo }}
146149
SOURCE_PATH: ${{ steps.source-info.outputs.source_path }}
150+
PR_REF: ${{ steps.check-pr.outputs.pr_number }}
147151
run: |
148-
PR_NUMBER="${{ steps.check-pr.outputs.pr_number }}"
152+
set -euo pipefail
153+
149154
PR_TITLE="docs: update ${PIPELINE_ID} content from source docs"
150155
SOURCE_LINK="See the [upstream repo](https://github.com/${SOURCE_REPO}/tree/main/${SOURCE_PATH}) for changes that triggered this update."
151156
152-
if [ -n "$PR_NUMBER" ]; then
153-
echo "PR #$PR_NUMBER already exists"
154-
155-
echo "Ensuring PR #$PR_NUMBER is marked ready for review"
156-
gh pr ready "$PR_NUMBER" || echo "Unable to mark PR #$PR_NUMBER as ready (it may already be ready)"
157+
if [ -n "$PR_REF" ]; then
158+
echo "PR #$PR_REF already exists"
157159
else
158160
echo "Creating new PR"
159161
@@ -178,12 +180,30 @@ jobs:
178180
PR_BODY+="* Once satisfied, merge to keep docs up to date"$'\n'
179181
PR_BODY+="* A new PR will be created on the next run if there are further changes"
180182
181-
gh pr create \
183+
# The opened event must describe a draft before any labels are applied.
184+
PR_REF=$(gh pr create --draft \
182185
--title "$PR_TITLE" \
183186
--body "$PR_BODY" \
184187
--base main \
185-
--head "$UPDATE_BRANCH" \
186-
--label "workflow-generated,content-pipeline-update,ready-for-doc-review,skip FR board"
188+
--head "$UPDATE_BRANCH")
189+
fi
190+
191+
# Retry publication for existing PRs, including runs without content changes.
192+
gh pr edit "$PR_REF" --add-label "skip FR board" || {
193+
echo "::error::Could not apply skip FR board. The PR will not be marked ready."
194+
exit 1
195+
}
196+
for LABEL in "workflow-generated" "content-pipeline-update" "ready-for-doc-review"; do
197+
gh pr edit "$PR_REF" --add-label "$LABEL" \
198+
|| echo "::warning::Could not apply the \"$LABEL\" label."
199+
done
200+
201+
IS_DRAFT=$(gh pr view "$PR_REF" --json isDraft --jq '.isDraft')
202+
if [ "$IS_DRAFT" = "true" ]; then
203+
gh pr ready "$PR_REF" || {
204+
echo "::error::Could not mark the labeled PR ready for review."
205+
exit 1
206+
}
187207
fi
188208
189209
- uses: ./.github/actions/create-workflow-failure-issue

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77
workflow_dispatch:
88
inputs:
99
version:
10-
description: "Version to exclusively generate the search index for. E.g. 'dotcom', 'ghes-3.12'"
10+
description: "Version to exclusively generate the search index for: 'fpt', 'ghec', or a supported 'ghes-X.Y'. Leave empty for all."
1111
required: false
1212
default: ''
1313
languages:

‎.github/workflows/move-content.yml‎

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,31 @@ jobs:
4646
src/fixtures/fixtures/content/get-started/start-your-journey/hello-wurld.md
4747
git log | head -n 100
4848
49+
- name: Undo moving hello-world.md to hello-wurld.md
50+
env:
51+
ROOT: src/fixtures/fixtures
52+
run: |
53+
# The fixtures start with hello-world, so confirm the move rewrote them before testing undo.
54+
for file in src/fixtures/fixtures/content/index.md src/fixtures/fixtures/content/get-started/index.md; do
55+
grep -q -- '- /get-started/start-your-journey/hello-wurld$' "$file"
56+
done
57+
58+
npm run move-content -- --undo \
59+
src/fixtures/fixtures/content/get-started/start-your-journey/hello-world.md \
60+
src/fixtures/fixtures/content/get-started/start-your-journey/hello-wurld.md
61+
62+
test -f src/fixtures/fixtures/content/get-started/start-your-journey/hello-world.md
63+
test ! -e src/fixtures/fixtures/content/get-started/start-your-journey/hello-wurld.md
64+
# Undo must revert featuredLinks too, or they point at a page that no longer exists.
65+
for file in src/fixtures/fixtures/content/index.md src/fixtures/fixtures/content/get-started/index.md; do
66+
grep -q -- '- /get-started/start-your-journey/hello-world$' "$file"
67+
if grep -q hello-wurld "$file"; then
68+
echo "$file still links to hello-wurld"
69+
exit 1
70+
fi
71+
done
72+
git log | head -n 100
73+
4974
- name: Move code-security/getting-started to code-security/got-started
5075
env:
5176
ROOT: src/fixtures/fixtures

‎.github/workflows/purge-fastly.yml‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@ jobs:
6565
6666
- name: Wait for production to serve this build
6767
if: ${{ github.event_name == 'deployment_status' }}
68+
env:
69+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6870
run: npm run wait-for-build
6971

7072
- name: Purge Fastly (manual)

‎.github/workflows/site-policy-sync.yml‎

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -48,19 +48,21 @@ jobs:
4848
echo PR_TITLE: $PR_TITLE
4949
[[ ! -z $PR_TITLE ]] && DESCRIPTION="${PR_TITLE}" || DESCRIPTION="Update manually triggered by workflow"
5050
echo "DESCRIPTION=$DESCRIPTION" >> $GITHUB_ENV
51-
git commit -m "$(echo $DESCRIPTION)"
51+
# git commit exits 1 when the public repo already matches, which would fail the job.
52+
if git diff --cached --quiet; then
53+
echo "No updates to push to the public repo"
54+
echo "HAS_CHANGES=false" >> "$GITHUB_ENV"
55+
else
56+
git commit -m "$(echo $DESCRIPTION)"
57+
echo "HAS_CHANGES=true" >> "$GITHUB_ENV"
58+
fi
5259
5360
- name: If there are changes to push, create a branch in the public repo and push changes
61+
if: env.HAS_CHANGES == 'true'
5462
env:
5563
GITHUB_TOKEN: ${{ secrets.DOCS_BOT_PAT_BASE }}
5664
run: |
5765
cd public-repo
5866
git config --local user.name 'site-policy-bot'
5967
git config --local user.email 'site-policy-bot@github.com'
60-
NUM_FILES_CHANGED=$(git diff --name-only HEAD^..HEAD | wc -l)
61-
if [[ $NUM_FILES_CHANGED -ge 1 ]]
62-
then
63-
git push --set-upstream origin automated-sync-$GITHUB_RUN_ID
64-
else
65-
echo "No updates to push to the public repo"
66-
fi
68+
git push --set-upstream origin automated-sync-$GITHUB_RUN_ID

‎.github/workflows/validate-asset-images.yml‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ on:
88
paths:
99
- 'assets/**'
1010
- '.github/workflows/validate-asset-images.yml'
11+
# Dependency changes can break the validator.
12+
- 'package*.json'
13+
- 'src/assets/scripts/validate-asset-images.ts'
14+
- '.github/actions/node-npm-setup/action.yml'
1115

1216
permissions:
1317
contents: read

‎content/actions/reference/runners/self-hosted-runners.md‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ You can use a machine as a self-hosted runner as long as it meets these requirem
5959

6060
* `x64` - Linux, macOS, Windows.
6161
* `ARM64` - Linux, macOS{% ifversion actions-windows-arm %}, Windows (currently in {% data variables.release-phases.public_preview %}){% endif %}.
62-
* `ARM32` - Linux.
6362

6463
## Routing precedence for self-hosted runners
6564

‎content/actions/tutorials/develop-agentic-workflows-in-github-actions.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ This article walks through a simple setup that adds the agent's credential as a
5151
| --- | --- | --- |
5252
| Claude Code | `claude` | `ANTHROPIC_API_KEY` containing an Anthropic API key |
5353
| {% data variables.product.prodname_openai_codex %} | `codex` | `OPENAI_API_KEY` containing an OpenAI API key |
54-
| Google {% data variables.copilot.copilot_gemini %} CLI | `gemini` | `GEMINI_API_KEY` containing a Google AI Studio API key |
54+
| Google {% data variables.copilot.gemini %} CLI | `gemini` | `GEMINI_API_KEY` containing a Google AI Studio API key |
5555
| {% data variables.copilot.copilot_cli_short %} (default) | `copilot` | No secret needed for organization repositories (see below). For personal repositories, `COPILOT_GITHUB_TOKEN` containing a fine-grained {% data variables.product.pat_generic %} with **Copilot Requests** set to **Read**. |
5656

5757
Other engines such as Pi (experimental) are also supported. For the full list, see the [{% data variables.copilot.github_agentic_workflows %} authentication reference](https://github.github.com/gh-aw/reference/auth/).

0 commit comments

Comments
 (0)