Skip to content

Commit dd5f618

Browse files
authored
Merge pull request #15291 from github/repo-sync
repo sync
2 parents 0eceded + 7a57b2b commit dd5f618

26 files changed

Lines changed: 192 additions & 103 deletions

File tree

components/Search.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,9 +132,9 @@ export function Search({
132132
if (router.pathname === '/') {
133133
// Don't include router.locale so next doesn't attempt a
134134
// request to `/_next/static/chunks/pages/en.js`
135-
router.replace(`/?${params.toString()}`, asPath)
135+
router.replace(`/?${params.toString()}`, asPath, { shallow: true })
136136
} else {
137-
router.replace(asPath)
137+
router.replace(asPath, undefined, { shallow: true })
138138
}
139139
}
140140
}, [debouncedQuery])

lib/render-content/plugins/rewrite-local-links.js

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ import nonEnterpriseDefaultVersion from '../../non-enterprise-default-version.js
88
import { allVersions } from '../../all-versions.js'
99
import removeFPTFromPath from '../../remove-fpt-from-path.js'
1010
import readJsonFile from '../../read-json-file.js'
11-
const supportedVersions = Object.keys(allVersions)
12-
const supportedPlans = Object.values(allVersions).map((v) => v.plan)
11+
12+
const supportedPlans = new Set(Object.values(allVersions).map((v) => v.plan))
1313
const externalRedirects = readJsonFile('./lib/redirects/external-sites.json')
1414

1515
// Matches any <a> tags with an href that starts with `/`
@@ -36,18 +36,6 @@ export default function rewriteLocalLinks({ languageCode, version }) {
3636
}
3737
}
3838

39-
// The versions that some links might start with, which we need to know
40-
// because if it's the case, we inject the language into the link as
41-
// the first prefix.
42-
// E.g. It can turn `/enterprise-cloud@latest/foo`
43-
// into `/en/enterprise-cloud@latest/foo`.
44-
// Using a Set to turn any lookups on this into a O(1) operation.
45-
const allSupportedVersionsPrefixes = new Set([
46-
...supportedPlans,
47-
...supportedVersions,
48-
'enterprise-server@latest',
49-
])
50-
5139
function getNewHref(node, languageCode, version) {
5240
const { href } = node.properties
5341
// Exceptions to link rewriting
@@ -62,7 +50,7 @@ function getNewHref(node, languageCode, version) {
6250
// /enterprise-server/rest/reference/oauth-authorizations (this redirects to the latest version)
6351
// /enterprise-server@latest/rest/reference/oauth-authorizations (this redirects to the latest version)
6452
const firstLinkSegment = href.split('/')[1]
65-
if (allSupportedVersionsPrefixes.has(firstLinkSegment)) {
53+
if (supportedPlans.has(firstLinkSegment.split('@')[0])) {
6654
newHref = path.posix.join('/', languageCode, href)
6755
}
6856

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
title: Page with deprecated enterprise links
3+
versions:
4+
free-pro-team: '*'
5+
enterprise-server: '*'
6+
---
7+
8+
9+
- [Version 2.22](/enterprise-server@2.22)
10+
11+
- [Version 3.2](/enterprise-server@3.2)

tests/unit/page.js

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,32 @@ describe('Page class', () => {
113113
).toBeGreaterThan(0)
114114
})
115115

116+
// Much of this test is based on making sure we don't
117+
// repeat the bug introduced in issue 1545.
118+
test('rewrites links correctly for unsupported enterprise-server links', async () => {
119+
const page = await Page.init({
120+
relativePath: 'page-with-deprecated-enterprise-links.md',
121+
basePath: path.join(__dirname, '../fixtures'),
122+
languageCode: 'en',
123+
})
124+
const context = {
125+
page: { version: `enterprise-server@${enterpriseServerReleases.latest}` },
126+
currentVersion: `enterprise-server@${enterpriseServerReleases.latest}`,
127+
currentPath: '/en/page-with-deprecated-enterprise-links',
128+
currentLanguage: 'en',
129+
}
130+
const rendered = await page.render(context)
131+
// That page only contains exactly 2 links. And we can know
132+
// exactly what we expect each one to be.
133+
const $ = cheerio.load(rendered)
134+
const first = $('a[href]').first()
135+
expect(first.text()).toBe('Version 2.22')
136+
expect(first.attr('href')).toBe('/en/enterprise-server@2.22')
137+
const last = $('a[href]').last()
138+
expect(last.text()).toBe('Version 3.2')
139+
expect(last.attr('href')).toBe('/en/enterprise-server@3.2')
140+
})
141+
116142
test('rewrites links on prerendered GraphQL page include the current language prefix and version', async () => {
117143
const graphqlVersion =
118144
allVersions[`enterprise-server@${enterpriseServerReleases.latest}`].miscVersionName

translations/pt-BR/content/actions/learn-github-actions/expressions.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,12 @@ env:
5050
5151
Como parte da expressão, você pode usar os tipos de dados `boolean`, `null`, `number` ou `string`.
5252

53-
| Tipo de dados | Valor do literal |
54-
| ------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
55-
| `boolean` | `true` ou `false` |
56-
| `null` | `null` |
57-
| `number` | Qualquer formato de número aceito por JSON. |
58-
| `string` | Você não precisa anexar strings em {% raw %}${{{% endraw %} e {% raw %}}}{% endraw %}. However, if you do, you must use single quotes around the string and escape literal single quotes with an additional single quote. |
53+
| Tipo de dados | Valor do literal |
54+
| ------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
55+
| `boolean` | `true` ou `false` |
56+
| `null` | `null` |
57+
| `number` | Qualquer formato de número aceito por JSON. |
58+
| `string` | You don't need to enclose strings in `{% raw %}${{{% endraw %}` and `{% raw %}}}{% endraw %}`. However, if you do, you must use single quotes (`'`) around the string. To use a literal single quote, escape the literal single quote using an additional single quote (`''`). Wrapping with double quotes (`"`) will throw an error. |
5959

6060
#### Exemplo
6161

translations/pt-BR/content/actions/using-workflows/events-that-trigger-workflows.md

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -917,8 +917,6 @@ on:
917917
```yaml
918918
on:
919919
push:
920-
types:
921-
- opened
922920
branches:
923921
- 'releases/**'
924922
paths:
@@ -960,8 +958,6 @@ on:
960958
```yaml
961959
on:
962960
push:
963-
types:
964-
- opened
965961
branches:
966962
- 'releases/**'
967963
paths:
@@ -996,9 +992,9 @@ em:
996992

997993
### `versão`
998994

999-
| Carga de evento webhook | Tipos de atividade | `GITHUB_SHA` | `GITHUB_REF` |
1000-
| ----------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------- | ------------- |
1001-
| [`versão`](/developers/webhooks-and-events/webhooks/webhook-events-and-payloads/#release) | - `published` <br/>- `unpublished` <br/>- `created` <br/>- `edited` <br/>- `deleted` <br/>- `prereleased`<br/> - `released` | Último commit na versão com tag | Tag da versão |
995+
| Carga de evento webhook | Tipos de atividade | `GITHUB_SHA` | `GITHUB_REF` |
996+
| ----------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------- | ----------------------------------------------- |
997+
| [`versão`](/developers/webhooks-and-events/webhooks/webhook-events-and-payloads/#release) | - `published` <br/>- `unpublished` <br/>- `created` <br/>- `edited` <br/>- `deleted` <br/>- `prereleased`<br/> - `released` | Último commit na versão com tag | Tag ref of release `refs/tags/<tag_name>` |
1002998

1003999
{% note %}
10041000

translations/pt-BR/content/actions/using-workflows/workflow-syntax-for-github-actions.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -830,7 +830,7 @@ services:
830830
image: ghcr.io/owner/myservice1
831831
credentials:
832832
username: ${{ github.actor }}
833-
password: ${{ secrets.ghcr_token }}
833+
password: ${{ secrets.github_token }}
834834
myservice2:
835835
image: dockerhub_org/myservice2
836836
credentials:

translations/pt-BR/content/admin/enterprise-management/configuring-clustering/differences-between-clustering-and-high-availability-ha.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ Tanto a alta disponibilidade (High Availability, HA) quanto o cluster fornecem r
3535

3636
## Backups e recuperação de desastre
3737

38-
Nem o clustering nem a HA devem ser considerados como substitutos para as medidas regulares de backup. Para obter mais informações, consulte "[Configurar backups no appliance](/enterprise/admin/guides/installation/configuring-backups-on-your-appliance)".
38+
Neither HA nor Clustering should be considered a replacement for regular backups. Para obter mais informações, consulte "[Configurar backups no appliance](/enterprise/admin/guides/installation/configuring-backups-on-your-appliance)".
3939

4040
## Monitoramento
4141

0 commit comments

Comments
 (0)