Merge branch 'main' into check-links-improvement-redux

This commit is contained in:
Sarah Schneider 2020-12-09 13:28:53 -05:00 коммит произвёл GitHub
Родитель cf11e27fc8 b807035720
Коммит 9e6218e6ce
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
3 изменённых файлов: 17 добавлений и 6 удалений

4
.github/workflows/repo-sync-stalls.yml поставляемый
Просмотреть файл

@ -22,8 +22,8 @@ jobs:
github-token: ${{ secrets.DOCUBOT_FR_PROJECT_BOARD_WORKFLOWS_REPO_ORG_READ_SCOPES }}
script: |
let pulls;
const owner = context.payload.repository.owner.login
const repo = context.payload.repository.name
const owner = context.repo.owner
const repo = context.repo.repo
try {
pulls = await github.pulls.list({
owner: owner,

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

@ -63,7 +63,7 @@ curl -H 'Authorization: token my-oauth-token' https://api.github.com/user/repos
#### Calls to OAuth Authorizations API
If you're making [OAuth Authorization API](/enterprise-server@2.22/rest/reference/oauth-authorizations) calls to manage your OAuth app's authorizations or to generate access tokens, similar to this example:
If you're making [OAuth Authorization API](/enterprise-server/rest/reference/oauth-authorizations) calls to manage your OAuth app's authorizations or to generate access tokens, similar to this example:
```bash
curl -u my_username:my_password -X POST "https://api.github.com/authorizations" -d '{"scopes":["public_repo"], "note":"my token", "client_id":"my_client_id", "client_secret":"my_client_secret"}'

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

@ -2,6 +2,7 @@ const externalRedirects = Object.keys(require('./redirects/external-sites'))
const pathUtils = require('./path-utils')
const assert = require('assert')
const nonEnterpriseDefaultVersion = require('./non-enterprise-default-version')
const supportedPlans = Object.values(require('./all-versions')).map(v => v.plan)
// Content authors write links like `/some/article/path`, but they need to be
// rewritten on the fly to match the current language and page version
@ -24,11 +25,21 @@ function getNewHref (link, languageCode, version) {
// e.g. `/contact` should not be replaced with `/en/contact`
if (externalRedirects.includes(href)) return
let newHref
// If the link has a hardcoded plan name in it (e.g., /enterprise-server/rest/reference/oauth-authorizations),
// only rewrite it with a language code
if (supportedPlans.includes(href.split('/')[1])) {
newHref = pathUtils.getPathWithLanguage(href, languageCode)
}
// If link is dotcom-only, just get the language code
// Otherwise, get the versioned path with language code
const newHref = link.hasClass('dotcom-only')
? pathUtils.getVersionedPathWithLanguage(href, nonEnterpriseDefaultVersion, languageCode)
: pathUtils.getVersionedPathWithLanguage(href, version, languageCode)
if (!newHref) {
newHref = link.hasClass('dotcom-only')
? pathUtils.getVersionedPathWithLanguage(href, nonEnterpriseDefaultVersion, languageCode)
: pathUtils.getVersionedPathWithLanguage(href, version, languageCode)
}
if (href !== newHref) link.attr('href', newHref)
}