Branch was updated using the 'autoupdate branch' Actions workflow.

This commit is contained in:
Octomerger Bot 2020-10-15 11:12:25 -07:00 коммит произвёл GitHub
Родитель 6eac0053c0 126d46fbeb
Коммит ed990c105b
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
5 изменённых файлов: 83 добавлений и 7 удалений

2
.github/workflows/browser-test.yml поставляемый
Просмотреть файл

@ -17,7 +17,7 @@ jobs:
with:
cancel_others: 'false'
github_token: ${{ github.token }}
paths: '["assets/**", "content/**", "data/**", "includes/**", "javascripts/**", "jest-puppeteer.config.js", "jest.config.js", "layouts/**", "lib/**", "middleware/**", "package-lock.json", "package.json", "server.js", "translations/**", "webpack.config.js"]'
paths: '[".github/workflows/browser-test.yml","assets/**", "content/**", "data/**", "includes/**", "javascripts/**", "jest-puppeteer.config.js", "jest.config.js", "layouts/**", "lib/**", "middleware/**", "package-lock.json", "package.json", "server.js", "translations/**", "webpack.config.js"]'
build:
needs: see_if_should_skip
runs-on: ubuntu-latest

5
.github/workflows/crowdin.yml поставляемый
Просмотреть файл

@ -4,9 +4,8 @@ name: Crowdin Sync
on:
workflow_dispatch:
push:
branches:
- main
schedule:
- cron: "33 2 * * *" # every day at 2:33 UTC at least until automerge is working
jobs:
sync_with_crowdin:

2
.github/workflows/test.yml поставляемый
Просмотреть файл

@ -27,7 +27,7 @@ jobs:
with:
cancel_others: 'false'
github_token: ${{ github.token }}
paths_ignore: '[".all-contributorsrc", ".env.example", ".gitattributes", ".vscode/**", "app.json", "assets/**", "CODE_OF_CONDUCT.md", "CONTRIBUTING.md", "contributing/**", "crowdin-actions-config.yml", "crowdin.yml", "docs", "javascripts/**", "jest-puppeteer.config.js", "LICENSE-CODE", "LICENSE", "nodemon.json", "ownership.yaml", "README.md", "script/**", "stylesheets/**"]'
paths: '[".github/workflows/test.yml",".node-version", ".npmrc", "app.json", "content/**", "data/**","lib/**", "Dockerfile", "feature-flags.json", "Gemfile", "Gemfile.lock", "middleware/**", "node_modules/**","package.json", "package-lock.json", "server.js", "tests/**", "translations/**", "Procfile", "webpack.config.js"]'
lint:
needs: see_if_should_skip
runs-on: ubuntu-latest

Просмотреть файл

@ -50,6 +50,22 @@ module.exports = async function precompileRedirects (pages) {
const developerRouteWithLanguage = `/en${developerRoute}`
allRedirects[developerRouteWithLanguage] = newPath
// TODO until we update all the old /v3 and /v4 links, we need to support redirects
// from the old /enterprise/<number>/v3 format to the new /enterprise-server@<number/rest format
// AS WELL AS /enterprise-server@<number/v3 to /enterprise-server@<number/rest.
// This is because the new format gets created dynamically even when the links point to /v3 or /v4.
// EXAMPLES:
// /en/enterprise/2.20/v3/pulls/comments -> /en/enterprise-server@2.20/rest/reference/pulls#comments
// /en/enterprise-server@2.20/v3/pulls/comments -> /en/enterprise-server@2.20/rest/reference/pulls#comments
// NOTE: after we update all the /v3 and /v4 links, we can yank the following block
if (developerRoute.includes('/enterprise/')) {
const developerRouteWithNewFormat = developerRoute.replace(/\/enterprise\/(\d.\d\d)\//, '/enterprise-server@$1/')
const developerRouteWithNewFormatWithLanguage = `/en${developerRouteWithNewFormat}`
allRedirects[developerRouteWithNewFormat] = newPath
allRedirects[developerRouteWithNewFormatWithLanguage] = newPath
}
// TODO ENDYANK
// although we only support developer Enterprise paths up to 2.21, we make
// an exception to always redirect versionless paths to the latest version
if (developerRoute.includes('/2.21/')) {
@ -58,18 +74,32 @@ module.exports = async function precompileRedirects (pages) {
const developerRouteWithLanguageWithoutVersion = `/en${developerRouteWithoutVersion}`
allRedirects[developerRouteWithoutVersion] = newPathOnLatestVersion
allRedirects[developerRouteWithLanguageWithoutVersion] = newPathOnLatestVersion
// TODO after we update all the /v3 and /v4 links, we can yank the following
const developerRouteWithoutVersionWithNewFormat = developerRouteWithoutVersion
.replace('/enterprise/', 'enterprise-server')
const developerRouteWithoutVersionWithNewFormatWithLanguage = `/en${developerRouteWithoutVersionWithNewFormat}`
allRedirects[developerRouteWithoutVersionWithNewFormat] = newPathOnLatestVersion
allRedirects[developerRouteWithoutVersionWithNewFormatWithLanguage] = newPathOnLatestVersion
// TODO ENDYANK
}
// TODO: TEMPORARILY support explicit 2.22 redirects (created on page render by lib/rewrite-local-links)
// we should eventually yank this block because 2.22 never existed on developer site
// the better solution is to change `/v3` and `/v4` links in content to `/rest` and `/graphql`
// after we update `/v3` and `/v4` links everywhere to `/rest` and `/graphql`, we can
// yank this entire block because 2.22 never existed on developer site
if (developerRoute.includes('/2.21/')) {
const newPath222 = newPath.replace('@2.21/', '@2.22/')
const developerRoute222 = developerRoute.replace('/2.21/', '/2.22/')
const developerRouteWithLanguage222 = `/en${developerRoute222}`
allRedirects[developerRoute222] = newPath222
allRedirects[developerRouteWithLanguage222] = newPath222
const developerRouteWithNewFormat222 = developerRoute222
.replace('/enterprise/2.22/', '/enterprise-server@2.22/')
const developerRouteWithNewFormatWithLanguage222 = `/en${developerRouteWithNewFormat222}`
allRedirects[developerRouteWithNewFormat222] = newPath222
allRedirects[developerRouteWithNewFormatWithLanguage222] = newPath222
}
// TODO ENDYANK
// given a developer route like `/enterprise/2.19/v3/activity`,
// add a veriation like `/enterprise/2.19/user/v3/activity`;

Просмотреть файл

@ -1,6 +1,7 @@
const { eachOfLimit } = require('async')
const enterpriseServerReleases = require('../../lib/enterprise-server-releases')
const { get } = require('../helpers')
const { getEnterpriseVersionNumber } = require('../../lib/patterns')
const nonEnterpriseDefaultVersion = require('../../lib/non-enterprise-default-version')
const restRedirectFixtures = require('../fixtures/rest-redirects')
const graphqlRedirectFixtures = require('../fixtures/graphql-redirects')
@ -125,6 +126,29 @@ describe('developer redirects', () => {
)
})
// TODO temprarily ensure we redirect old links using the new enterprise format
// for currently supported enterprise releases only
// EXAMPLE: /en/enterprise-server@2.20/v3/pulls/comments -> /en/enterprise-server@2.20/rest/reference/pulls#comments
// We can remove test after we update all the old `/v3` links to point to `/rest`
test('temporary rest reference enterprise redirects', async () => {
await eachOfLimit(
restRedirectFixtures,
MAX_CONCURRENT_REQUESTS,
async (newPath, oldPath) => {
const releaseNumber = oldPath.match(getEnterpriseVersionNumber)
if (!releaseNumber) return
if (!enterpriseServerReleases.supported.includes(releaseNumber[1])) return
oldPath = oldPath
.replace(/\/enterprise\/(\d.\d\d)\//, '/enterprise-server@$1/')
.replace('/user/', '/')
const res = await get(oldPath)
expect(res.statusCode, `${oldPath} did not redirect to ${newPath}`).toBe(301)
expect(res.headers.location).toBe(newPath)
}
)
})
// this fixtures file includes /v4 and /enterprise/v4 paths
test('graphql reference redirects', async () => {
await eachOfLimit(
@ -140,5 +164,28 @@ describe('developer redirects', () => {
}
)
})
// TODO temprarily ensure we redirect old links using the new enterprise format
// for currently supported enterprise releases only
// EXAMPLE: /en/enterprise-server@2.20/v4/interface/actor -> /en/enterprise-server@2.20/graphql/reference/interfaces#actor
// We can remove test after we update all the old `/v4` links to point to `/graphql`
test('temporary rest reference enterprise redirects', async () => {
await eachOfLimit(
graphqlRedirectFixtures,
MAX_CONCURRENT_REQUESTS,
async (newPath, oldPath) => {
const releaseNumber = oldPath.match(getEnterpriseVersionNumber)
if (!releaseNumber) return
if (!enterpriseServerReleases.supported.includes(releaseNumber[1])) return
oldPath = oldPath
.replace(/\/enterprise\/(\d.\d\d)\//, '/enterprise-server@$1/')
.replace('/user/', '/')
const res = await get(oldPath)
expect(res.statusCode, `${oldPath} did not redirect to ${newPath}`).toBe(301)
expect(res.headers.location).toBe(newPath)
}
)
})
})
})