Skip to content

Commit 5a5a0a6

Browse files
committed
Merge branch 'am-stead/20429' of https://github.com/github/docs-internal into am-stead/20429
2 parents 5bb2218 + 29c7630 commit 5a5a0a6

890 files changed

Lines changed: 4865 additions & 3330 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.
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
name: Create workflow failure issue
2+
description: Create or update a GitHub issue in docs-engineering when a workflow fails, for automated diagnosis by an agentic workflow.
3+
4+
inputs:
5+
token:
6+
description: A token with issues write permission on the target repo
7+
required: true
8+
repo:
9+
description: The repository to create the issue in
10+
default: github/docs-engineering
11+
required: false
12+
13+
runs:
14+
using: composite
15+
steps:
16+
- name: Check for existing open issue
17+
id: check-existing
18+
shell: bash
19+
env:
20+
GH_TOKEN: ${{ inputs.token }}
21+
ISSUE_REPO: ${{ inputs.repo }}
22+
WORKFLOW_NAME: ${{ github.workflow }}
23+
run: |
24+
existing=$(gh issue list \
25+
--repo "$ISSUE_REPO" \
26+
--label "workflow-failure" \
27+
--search "in:title [Workflow Failure] $WORKFLOW_NAME" \
28+
--state open \
29+
--json number \
30+
--jq '.[0].number // empty' 2>/dev/null || true)
31+
echo "existing_issue=$existing" >> "$GITHUB_OUTPUT"
32+
33+
- name: Comment on existing issue
34+
if: steps.check-existing.outputs.existing_issue != ''
35+
shell: bash
36+
env:
37+
GH_TOKEN: ${{ inputs.token }}
38+
ISSUE_REPO: ${{ inputs.repo }}
39+
ISSUE_NUMBER: ${{ steps.check-existing.outputs.existing_issue }}
40+
WORKFLOW_NAME: ${{ github.workflow }}
41+
SOURCE_REPO: ${{ github.repository }}
42+
RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
43+
EVENT_NAME: ${{ github.event_name }}
44+
GIT_REF: ${{ github.ref }}
45+
run: |
46+
body=$(cat <<EOF
47+
### Repeat failure
48+
49+
**Workflow:** \`$WORKFLOW_NAME\`
50+
**Repository:** \`$SOURCE_REPO\`
51+
**Run:** $RUN_URL
52+
**Event:** \`$EVENT_NAME\`
53+
**Ref:** \`$GIT_REF\`
54+
**Timestamp:** $(date -u +%Y-%m-%dT%H:%M:%SZ)
55+
EOF
56+
)
57+
gh issue comment "$ISSUE_NUMBER" \
58+
--repo "$ISSUE_REPO" \
59+
--body "$body"
60+
61+
- name: Create workflow failure issue
62+
if: steps.check-existing.outputs.existing_issue == ''
63+
shell: bash
64+
env:
65+
GH_TOKEN: ${{ inputs.token }}
66+
ISSUE_REPO: ${{ inputs.repo }}
67+
WORKFLOW_NAME: ${{ github.workflow }}
68+
SOURCE_REPO: ${{ github.repository }}
69+
RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
70+
EVENT_NAME: ${{ github.event_name }}
71+
GIT_REF: ${{ github.ref }}
72+
ACTOR: ${{ github.actor }}
73+
run: |
74+
body=$(cat <<EOF
75+
### Workflow failure
76+
77+
**Workflow:** \`$WORKFLOW_NAME\`
78+
**Repository:** \`$SOURCE_REPO\`
79+
**Run:** $RUN_URL
80+
**Event:** \`$EVENT_NAME\`
81+
**Ref:** \`$GIT_REF\`
82+
**Triggered by:** \`$ACTOR\`
83+
**Timestamp:** $(date -u +%Y-%m-%dT%H:%M:%SZ)
84+
85+
---
86+
This issue was automatically created by the create-workflow-failure-issue action to enable automated diagnosis.
87+
EOF
88+
)
89+
gh issue create \
90+
--repo "$ISSUE_REPO" \
91+
--label "workflow-failure" \
92+
--title "[Workflow Failure] $WORKFLOW_NAME" \
93+
--body "$body"

.github/instructions/all.instructions.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,12 @@ When you create a pull request:
2929
3. Label with "llm-generated".
3030
4. If an issue exists, include "fixes owner/repo#issue" or "towards owner/repo#issue" as appropriate.
3131
5. Always create PRs in **draft mode** using `--draft` flag.
32-
6. When you are using gh cli, always _escape backticks_.
32+
33+
## Accessing docs.github.com content programmatically
34+
35+
When you need to read GitHub Docs, use these endpoints on `docs.github.com` in order of preference:
36+
37+
1. `/llms.txt` — Start here. Returns a structured overview of the site with links to pagelist endpoints for each product version.
38+
2. `/api/pagelist/:lang/:version` — Returns a list of all pages for a given language and version (e.g., `/api/pagelist/en/free-pro-team@latest`). Use `/api/pagelist/versions` and `/api/pagelist/languages` for available options.
39+
3. `/api/search/v1?query=...&language=...&version=...&client_name=...` — Search docs content (e.g., `/api/search/v1?query=actions&language=en&version=free-pro-team@latest&client_name=copilot`).
40+
4. `/api/article/body?pathname=...` — Returns the rendered markdown body of a page. Handles all page types including REST, GraphQL, and webhook reference pages.

.github/instructions/code.instructions.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,16 @@ For code reviews, follow guidelines, tests, and validate instructions. For creat
99
## Guidelines
1010

1111
- If available, use ripgrep (`rg`) instead of `grep`.
12-
- When using gh cli, always _escape backticks_.
12+
- When using gh cli in double-quoted strings, escape backticks to prevent bash command substitution. In single-quoted strings, backticks do not need escaping.
1313
- All scripts should be listed in `package.json` and use `tsx`.
1414
- Whenever you create or comment on an issue or pull request, indicate you are GitHub Copilot.
1515
- Be careful fetching full HTML pages off the internet. Prefer to use MCP or gh cli whenever possible for github.com. Limit the number of tokens when grabbing HTML.
1616
- Avoid pull requests with over 300 lines of code changed. When significantly larger, offer to split up into smaller pull requests if possible.
1717
- All new code should be written in TypeScript and not JavaScript.
1818
- We use absolute imports, relative to the `src` directory, using the `@` symbol. For example, `getRedirect` which lives in `src/redirects/lib/get-redirect.ts` can be imported with `import getRedirect from '@/redirects/lib/get-redirect'`. The same rule applies for TypeScript (`.ts`) imports, e.g. `import type { GeneralSearchHit } from '@/search/types'`
1919
- For updates to the content linter, read important information in `src/content-linter/README.md`.
20+
- Do not commit to `main` branch.
21+
- Do not use git force push, and avoid git rebase.
2022

2123
## Tests
2224

.github/instructions/content.instructions.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,14 @@ Examples:
7272
* ❌ Incorrect: `For more information, see [Using GitHub Copilot](/copilot/using-github-copilot).`
7373
* ❌ Incorrect: `For more information, see {% link /copilot/using-github-copilot %}.`
7474

75+
## RAI application and platform cards
76+
77+
Articles with `contentType: rai` in their frontmatter are **application or platform cards**—legally mandated documents describing the responsible use of AI-powered features. The content linter enforces the required section structure (GHD064) and reusable isolation (GHD035).
78+
79+
* **Template**: See `content/contributing/writing-for-github-docs/templates.md` for the full application/platform card template with all required sections and boilerplate reusables.
80+
* **Reusables**: RAI articles must only reference reusables from `data/reusables/rai/`. Place new RAI reusables there too.
81+
* **Frontmatter**: New application cards use `contentType: rai`. The older `type: rai` is for legacy transparency notes not yet migrated.
82+
7583
## Parenthetical dashes
7684

7785
Where a sentence of normal body text contains a parenthetical dash, the dash should always be an em dash without spaces at either side. This rule does not apply to text within code blocks.

.github/workflows/codeql.yml

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() && github.event_name != 'pull_request' }}
47+
with:
48+
token: ${{ secrets.DOCS_BOT_PAT_BASE }}

.github/workflows/content-pipelines.yml

Lines changed: 59 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,10 @@ jobs:
6262
echo "pr_number=$PR_NUMBER" >> "$GITHUB_OUTPUT"
6363
6464
- name: Setup branch
65+
id: setup-branch
6566
env:
6667
UPDATE_BRANCH: ${{ steps.branch.outputs.update_branch }}
68+
PR_NUMBER: ${{ steps.check-pr.outputs.pr_number }}
6769
run: |
6870
git config user.name "github-actions[bot]"
6971
git config user.email "github-actions[bot]@users.noreply.github.com"
@@ -76,14 +78,20 @@ jobs:
7678
git merge --abort 2>/dev/null || true
7779
git checkout main
7880
git branch -D "$UPDATE_BRANCH"
79-
git push origin --delete "$UPDATE_BRANCH" || true
81+
if [ -z "$PR_NUMBER" ]; then
82+
git push origin --delete "$UPDATE_BRANCH" || true
83+
else
84+
echo "Skipping remote branch delete — PR #$PR_NUMBER is open"
85+
echo "force_push=true" >> "$GITHUB_OUTPUT"
86+
fi
8087
git checkout -b "$UPDATE_BRANCH"
8188
}
8289
else
8390
git checkout -b "$UPDATE_BRANCH"
8491
fi
8592
8693
- name: Run content pipeline update script
94+
id: update
8795
env:
8896
GH_TOKEN: ${{ secrets.DOCS_BOT_PAT_BASE }}
8997
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -111,44 +119,78 @@ jobs:
111119
if: steps.commit.outputs.has_changes == 'true'
112120
env:
113121
UPDATE_BRANCH: ${{ steps.branch.outputs.update_branch }}
114-
run: git push origin "$UPDATE_BRANCH"
122+
FORCE_PUSH: ${{ steps.setup-branch.outputs.force_push }}
123+
run: |
124+
if [ "$FORCE_PUSH" = "true" ]; then
125+
echo "Force-pushing to align branch after merge conflict reset"
126+
git push --force-with-lease origin "$UPDATE_BRANCH"
127+
else
128+
git push origin "$UPDATE_BRANCH"
129+
fi
115130
116131
- name: Create or update PR
117132
if: steps.commit.outputs.has_changes == 'true'
118133
env:
119-
GH_TOKEN: ${{ github.token }}
134+
GH_TOKEN: ${{ secrets.DOCS_BOT_PAT_BASE }}
120135
UPDATE_BRANCH: ${{ steps.branch.outputs.update_branch }}
121136
PIPELINE_ID: ${{ matrix.id }}
137+
COMPARE_URL: ${{ steps.update.outputs.compare_url }}
138+
SHORT_RANGE: ${{ steps.update.outputs.short_range }}
122139
run: |
123140
PR_NUMBER="${{ steps.check-pr.outputs.pr_number }}"
124141
PR_TITLE="docs: update ${PIPELINE_ID} content from source docs"
125-
126-
PR_BODY="_GitHub Copilot generated this pull request._"$'\n\n'
127-
PR_BODY+="> [!NOTE]"$'\n'
128-
PR_BODY+="> This PR is **automatically generated** by the [content pipeline update workflow](${{ github.server_url }}/${{ github.repository }}/actions/workflows/content-pipelines.yml). Each run adds a new commit with any documentation changes detected."$'\n\n'
129-
PR_BODY+="## What this does"$'\n\n'
130-
PR_BODY+="Runs the \`content-pipeline-update\` agent (${PIPELINE_ID}) against the latest source docs and updates official articles under \`content/\` that have fallen out of sync."$'\n\n'
131-
PR_BODY+="## Review"$'\n\n'
132-
PR_BODY+="* Review each commit for accuracy — the agent uses AI, so spot-check important changes"$'\n'
133-
PR_BODY+="* To adjust agent behavior, see [Modifying results](${{ github.server_url }}/${{ github.repository }}/blob/main/src/content-pipelines/README.md#modifying-results)"$'\n'
134-
PR_BODY+="* Once satisfied, merge to keep docs up to date"$'\n'
135-
PR_BODY+="* A new PR will be created on the next run if there are further changes"
142+
NEW_ITEM="* [\`${SHORT_RANGE}\`](${COMPARE_URL})"
136143
137144
if [ -n "$PR_NUMBER" ]; then
138-
echo "PR #$PR_NUMBER already exists — new commit pushed"
145+
echo "PR #$PR_NUMBER already exists — appending source changes to body"
146+
147+
EXISTING_BODY=$(gh pr view "$PR_NUMBER" --json body --jq '.body')
148+
149+
# Append a new bullet before the SOURCE_CHANGES end marker
150+
# Uses bash parameter expansion for safe literal string replacement
151+
MARKER="<!-- /SOURCE_CHANGES -->"
152+
INSERTION="${NEW_ITEM}"$'\n'
153+
INSERTION+="${MARKER}"
154+
UPDATED_BODY="${EXISTING_BODY/$MARKER/$INSERTION}"
155+
156+
gh pr edit "$PR_NUMBER" --body "$UPDATED_BODY"
157+
158+
echo "Ensuring PR #$PR_NUMBER is marked ready for review"
159+
gh pr ready "$PR_NUMBER" || echo "Unable to mark PR #$PR_NUMBER as ready (it may already be ready)"
139160
else
140161
echo "Creating new PR"
162+
163+
PR_BODY="_GitHub Copilot generated this pull request._"$'\n\n'
164+
PR_BODY+="> [!NOTE]"$'\n'
165+
PR_BODY+="> This PR is **automatically generated** by the [content pipeline update workflow](${{ github.server_url }}/${{ github.repository }}/actions/workflows/content-pipelines.yml). Each run adds a new commit with any documentation changes detected."$'\n\n'
166+
PR_BODY+="## What this does"$'\n\n'
167+
PR_BODY+="Runs the \`content-pipeline-update\` agent (${PIPELINE_ID}) against the latest source docs and updates official articles under \`content/\` that have fallen out of sync."$'\n\n'
168+
PR_BODY+="## Source changes"$'\n\n'
169+
PR_BODY+="Changes in the source repo that triggered this update:"$'\n\n'
170+
PR_BODY+="<!-- SOURCE_CHANGES -->"$'\n'
171+
PR_BODY+="${NEW_ITEM}"$'\n'
172+
PR_BODY+="<!-- /SOURCE_CHANGES -->"$'\n\n'
173+
PR_BODY+="## Review"$'\n\n'
174+
PR_BODY+="* Review each commit for accuracy — the agent uses AI, so spot-check important changes"$'\n'
175+
PR_BODY+="* To adjust agent behavior, see [Modifying results](${{ github.server_url }}/${{ github.repository }}/blob/main/src/content-pipelines/README.md#modifying-results)"$'\n'
176+
PR_BODY+="* Once satisfied, merge to keep docs up to date"$'\n'
177+
PR_BODY+="* A new PR will be created on the next run if there are further changes"
178+
141179
gh pr create \
142180
--title "$PR_TITLE" \
143181
--body "$PR_BODY" \
144182
--base main \
145183
--head "$UPDATE_BRANCH" \
146-
--label "workflow-generated,content-pipeline-update" \
147-
--draft
184+
--label "workflow-generated,content-pipeline-update,ready-for-doc-review"
148185
fi
149186
150187
- uses: ./.github/actions/slack-alert
151188
if: ${{ failure() && github.event_name != 'workflow_dispatch' }}
152189
with:
153190
slack_channel_id: ${{ secrets.DOCS_ALERTS_SLACK_CHANNEL_ID }}
154191
slack_token: ${{ secrets.SLACK_DOCS_BOT_TOKEN }}
192+
193+
- uses: ./.github/actions/create-workflow-failure-issue
194+
if: ${{ failure() && github.event_name != 'workflow_dispatch' }}
195+
with:
196+
token: ${{ secrets.DOCS_BOT_PAT_BASE }}

.github/workflows/create-changelog-pr.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,3 +164,8 @@ jobs:
164164
with:
165165
slack_channel_id: ${{ secrets.DOCS_ALERTS_SLACK_CHANNEL_ID }}
166166
slack_token: ${{ secrets.SLACK_DOCS_BOT_TOKEN }}
167+
168+
- uses: ./.github/actions/create-workflow-failure-issue
169+
if: ${{ failure() && github.event_name != 'workflow_dispatch' }}
170+
with:
171+
token: ${{ secrets.DOCS_BOT_PAT_BASE }}

.github/workflows/delete-orphan-translation-files.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ name: Delete orphan translation files
1414
on:
1515
workflow_dispatch:
1616
schedule:
17-
- cron: '20 16 * * 3' # Run every Wednesday at 16:20 UTC / 8:20 PST — orphan & hygiene cleanup theme
17+
- cron: '20 16 * * 1' # Run every Monday at 16:20 UTC / 8:20 PST
1818

1919
permissions:
2020
contents: write
@@ -140,3 +140,8 @@ jobs:
140140
with:
141141
slack_channel_id: ${{ secrets.DOCS_ALERTS_SLACK_CHANNEL_ID }}
142142
slack_token: ${{ secrets.SLACK_DOCS_BOT_TOKEN }}
143+
144+
- uses: ./.github/actions/create-workflow-failure-issue
145+
if: ${{ failure() && github.event_name != 'workflow_dispatch' }}
146+
with:
147+
token: ${{ secrets.DOCS_BOT_PAT_BASE }}

.github/workflows/docs-review-collect.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,3 +47,8 @@ jobs:
4747
with:
4848
slack_channel_id: ${{ secrets.DOCS_ALERTS_SLACK_CHANNEL_ID }}
4949
slack_token: ${{ secrets.SLACK_DOCS_BOT_TOKEN }}
50+
51+
- uses: ./.github/actions/create-workflow-failure-issue
52+
if: ${{ failure() && github.event_name != 'workflow_dispatch' }}
53+
with:
54+
token: ${{ secrets.DOCS_BOT_PAT_BASE }}

.github/workflows/enterprise-dates.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ name: Enterprise date updater
1111
on:
1212
workflow_dispatch:
1313
schedule:
14-
- cron: '20 16 * * 4' # Run every Thursday at 16:20 UTC / 8:20 PST — infrastructure & releases theme
14+
- cron: '20 16 * * 1' # Run every Monday at 16:20 UTC / 8:20 PST
1515

1616
permissions:
1717
contents: write
@@ -74,3 +74,8 @@ jobs:
7474
with:
7575
slack_channel_id: ${{ secrets.DOCS_ALERTS_SLACK_CHANNEL_ID }}
7676
slack_token: ${{ secrets.SLACK_DOCS_BOT_TOKEN }}
77+
78+
- uses: ./.github/actions/create-workflow-failure-issue
79+
if: ${{ failure() && github.event_name != 'workflow_dispatch' }}
80+
with:
81+
token: ${{ secrets.DOCS_BOT_PAT_BASE }}

0 commit comments

Comments
 (0)