Skip to content

Commit b07cfbc

Browse files
authored
Merge pull request #45606 from github/repo-sync
Repo sync
2 parents 6bfa7cc + 50aa71b commit b07cfbc

4 files changed

Lines changed: 44 additions & 2 deletions

File tree

.github/actions/create-workflow-failure-issue/action.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,14 @@ runs:
9898
--repo "$ISSUE_REPO" \
9999
--label "workflow-failure" \
100100
--label "workflow-generated" \
101+
--label "engineering" \
102+
--label "priority-2" \
101103
--title "[Workflow Failure] $WORKFLOW_NAME" \
102104
--body "$body")
103105
echo "issue_url=$url" >> "$GITHUB_OUTPUT"
106+
107+
# Set the type separately, and tolerate failure. This action is itself the
108+
# failure path, so losing the whole issue because issue types are unavailable
109+
# or `gh` is too old (--type needs gh 2.94+) would hide the original failure.
110+
gh issue edit "$url" --type Bug \
111+
|| echo "Warning: could not set issue type on $url; leaving it unset."

.github/workflows/check-for-spammy-pr.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@ permissions:
1515
jobs:
1616
spammy-pr-check:
1717
name: Label PRs that only delete files or touch a large number of files
18-
if: github.repository == 'github/docs' && github.event_name == 'pull_request_target'
18+
if: >
19+
github.repository == 'github/docs' && github.event_name == 'pull_request_target' &&
20+
github.event.pull_request.user.login != 'docs-bot'
1921
runs-on: ubuntu-latest
2022
steps:
2123
- uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3
@@ -49,6 +51,6 @@ jobs:
4951
owner: owner,
5052
repo: repo,
5153
issue_number: pull_number,
52-
body: `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 a new issue.`
54+
body: `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.`,
5355
});
5456
}

src/languages/lib/correct-translation-content.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,17 @@ export function correctTranslatedContentStrings(
5858
'{%$1 data variables.$2$3',
5959
)
6060

61+
// Translators sometimes inserted a stray space right after a dot inside
62+
// a `{% data variables.X.Y %}` path (e.g. `{% data variables.product.
63+
// prodname_pages %}` or `{% data variables. product.prodname_pages %}`).
64+
// Liquid parses the space as ending the variable lookup early, breaking
65+
// the tag. Collapse the space back out. The English source never has
66+
// a space after a dot in a variable path, so this is safe globally.
67+
content = content.replace(
68+
/\{%(-?)\s*data\s+(?:variables|reusables)(?:\.\s*[A-Za-z0-9_-]+)+(?=\s*-?%\})/g,
69+
(path) => path.replace(/\.\s+/g, '.'),
70+
)
71+
6172
// The translation pipeline frequently splits Markdown bullet markers
6273
// (`*` and `-`) and table-cell pipes (`|`) onto their own line, with
6374
// the actual content pushed to the next line as deeply indented text.

src/languages/tests/correct-translation-content.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1664,6 +1664,27 @@ describe('correctTranslatedContentStrings', () => {
16641664
expect(fix('{% data .reusables.foo.bar %}', 'zh')).toBe('{% data reusables.foo.bar %}')
16651665
})
16661666

1667+
test('fixes stray space after a dot inside {% data variables/reusables paths', () => {
1668+
// Translators sometimes inserted a stray space right after a dot in a
1669+
// multi-segment `variables.X.Y` / `reusables.X.Y` path (e.g. wrapping
1670+
// long lines mid-path). Liquid parses the space as ending the variable
1671+
// lookup early, breaking the tag. Confirmed in de-de, ja-jp, ru-ru.
1672+
expect(fix('{% data variables.product. prodname_pages %}', 'de')).toBe(
1673+
'{% data variables.product.prodname_pages %}',
1674+
)
1675+
expect(fix('{% data variables. product.prodname_pro %}', 'ja')).toBe(
1676+
'{% data variables.product.prodname_pro %}',
1677+
)
1678+
expect(fix('{% data variables.copilot. copilot_chat_short %}', 'ru')).toBe(
1679+
'{% data variables.copilot.copilot_chat_short %}',
1680+
)
1681+
expect(fix('{%- data reusables.foo. bar -%}', 'de')).toBe('{%- data reusables.foo.bar -%}')
1682+
// Already-correct input is left unchanged.
1683+
expect(fix('{% data variables.product.prodname_pages %}', 'de')).toBe(
1684+
'{% data variables.product.prodname_pages %}',
1685+
)
1686+
})
1687+
16671688
test('fixes singular variable / reusable in {% data paths', () => {
16681689
// `{% data variable.product.X %}` (singular) → `{% data variables.product.X %}`
16691690
expect(fix('{% data variable.product.prodname_container_registry %}', 'zh')).toBe(

0 commit comments

Comments
 (0)