1
0
mirror of synced 2025-12-30 12:02:01 -05:00

Merge branch 'main' into openapi-update-99ef206ced04a7bd819a0a9b6bc85bd70aa2a708b3f477ad934f412cba1fe3d0

This commit is contained in:
Sophie
2022-07-13 07:50:17 +02:00
committed by GitHub
471 changed files with 31751 additions and 244384 deletions

View File

@@ -1,6 +1,5 @@
#!/usr/bin/env node
import fs from 'fs'
import github from '@actions/github'
const OPTIONS = Object.fromEntries(
@@ -33,7 +32,6 @@ const {
BASE,
HEAD,
LANGUAGE,
BODY_FILE,
GITHUB_TOKEN,
} = OPTIONS
const [OWNER, REPO] = GITHUB_REPOSITORY.split('/')
@@ -121,7 +119,7 @@ async function main() {
title: TITLE,
base: BASE,
head: HEAD,
body: fs.readFileSync(BODY_FILE, 'utf8'),
body: `New translation batch for ${LANGUAGE}. You can see the log in [\`translations/log/${LANGUAGE}-resets.csv\`](https://github.com/${OWNER}/${REPO}/tree/${HEAD}/translations/log/${LANGUAGE}-resets.csv).`,
labels: ['translation-batch', `translation-batch-${LANGUAGE}`],
owner: OWNER,
repo: REPO,

View File

@@ -19,5 +19,5 @@ mkdir translations
# need these legacy redirects. Only the redirects from
# front-matter will be at play.
# These static redirects json files are notoriously large
echo '[]' > lib/redirects/static/archived-frontmatter-fallbacks.json
echo '[]' > lib/redirects/static/archived-frontmatter-valid-urls.json
echo '{}' > lib/redirects/static/archived-redirects-from-213-to-217.json

View File

@@ -30,26 +30,47 @@ jobs:
max-parallel: 1
matrix:
include:
# TODO: replace language_repos with actual repos once created
# - language: pt
# crowdin_language: pt-BR
# language_dir: translations/pt-BR
# language_repo: github/docs-translations-pt-br
- language: es
crowdin_language: es-ES
language_dir: translations/es-ES
language_repo: github/docs-localization-test-es-es
language_repo: github/docs-internal.es-es
# - language: cn
# crowdin_language: zh-CN
# language_dir: translations/zh-CN
# language_repo: github/docs-translations-zh-cn
- language: ja
crowdin_language: ja-JP
language_dir: translations/ja-JP
language_repo: github/docs-internal.ja-jp
# - language: ja
# crowdin_language: ja
# language_dir: translations/ja-JP
# language_repo: github/docs-translations-ja-jp
- language: pt
crowdin_language: pt-BR
language_dir: translations/pt-BR
language_repo: github/docs-internal.pt-br
- language: cn
crowdin_language: zh-CN
language_dir: translations/zh-CN
language_repo: github/docs-internal.zh-cn
# We'll be ready to add the following languages in a future effort.
# - language: ru
# crowdin_language: ru-RU
# language_dir: translations/ru-RU
# language_repo: github/docs-internal.ru-ru
# - language: ko
# crowdin_language: ko-KR
# language_dir: translations/ko-KR
# language_repo: github/docs-internal.ko-kr
# - language: fr
# crowdin_language: fr-FR
# language_dir: translations/fr-FR
# language_repo: github/docs-internal.fr-fr
# - language: de
# crowdin_language: de-DE
# language_dir: translations/de-DE
# language_repo: github/docs-internal.de-de
# TODO: replace the branch name
steps:

View File

@@ -129,7 +129,7 @@ You can also delete environments through the REST API. For more information, see
{% data reusables.actions.environment-deployment-event %}
You can access these objects through the REST API or GraphQL API. You can also subscribe to these webhook events. For more information, see "[Repositories](/rest/reference/repos#deployments)" (REST API), "[Objects]({% ifversion ghec %}/free-pro-team@latest{% endif %}/graphql/reference/objects#deployment)" (GraphQL API), or "[Webhook events and payloads](/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#deployment)."
You can access these objects through the REST API or GraphQL API. You can also subscribe to these webhook events. For more information, see "[Repositories](/rest/reference/repos#deployments)" (REST API), "[Objects](/graphql/reference/objects#deployment)" (GraphQL API), or "[Webhook events and payloads](/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#deployment)."
## Next steps

View File

@@ -158,7 +158,7 @@ Because user-level permissions are granted on an individual user basis, you can
## User-to-server requests
While most of your API interaction should occur using your server-to-server installation access tokens, certain endpoints allow you to perform actions via the API using a user access token. Your app can make the following requests using [GraphQL]({% ifversion ghec %}/free-pro-team@latest{% endif %}/graphql) or [REST](/rest) endpoints.
While most of your API interaction should occur using your server-to-server installation access tokens, certain endpoints allow you to perform actions via the API using a user access token. Your app can make the following requests using [GraphQL](/graphql) or [REST](/rest) endpoints.
### Supported endpoints

View File

@@ -82,4 +82,4 @@ The rate limits for user-to-server requests made by {% data variables.product.pr
## Further reading
- "[Rate limiting](/rest/overview/resources-in-the-rest-api#rate-limiting)" in the REST API documentation
- "[Resource limitations]({% ifversion ghec %}/free-pro-team@latest{% endif %}/graphql/overview/resource-limitations)" in the GraphQL API documentation
- "[Resource limitations](/graphql/overview/resource-limitations)" in the GraphQL API documentation

View File

@@ -46,13 +46,13 @@ These guidelines assume that you have a registered OAuth App{% ifversion fpt or
### Review the available API endpoints for GitHub Apps
While the majority of [REST API](/rest) endpoints and [GraphQL]({% ifversion ghec %}/free-pro-team@latest{% endif %}/graphql) queries are available to GitHub Apps today, we are still in the process of enabling some endpoints. Review the [available REST endpoints](/rest/overview/endpoints-available-for-github-apps) to ensure that the endpoints you need are compatible with GitHub Apps. Note that some of the API endpoints enabled for GitHub Apps allow the app to act on behalf of the user. See "[User-to-server requests](/apps/building-github-apps/identifying-and-authorizing-users-for-github-apps/#user-to-server-requests)" for a list of endpoints that allow a GitHub App to authenticate as a user.
While the majority of [REST API](/rest) endpoints and [GraphQL](/graphql) queries are available to GitHub Apps today, we are still in the process of enabling some endpoints. Review the [available REST endpoints](/rest/overview/endpoints-available-for-github-apps) to ensure that the endpoints you need are compatible with GitHub Apps. Note that some of the API endpoints enabled for GitHub Apps allow the app to act on behalf of the user. See "[User-to-server requests](/apps/building-github-apps/identifying-and-authorizing-users-for-github-apps/#user-to-server-requests)" for a list of endpoints that allow a GitHub App to authenticate as a user.
We recommend reviewing the list of API endpoints you need as early as possible. Please let Support know if there is an endpoint you require that is not yet enabled for {% data variables.product.prodname_github_apps %}.
### Design to stay within API rate limits
GitHub Apps use [sliding rules for rate limits](/apps/building-github-apps/understanding-rate-limits-for-github-apps/), which can increase based on the number of repositories and users in the organization. A GitHub App can also make use of [conditional requests](/rest/overview/resources-in-the-rest-api#conditional-requests) or consolidate requests by using the [GraphQL API]({% ifversion ghec %}/free-pro-team@latest{% endif %}/graphql).
GitHub Apps use [sliding rules for rate limits](/apps/building-github-apps/understanding-rate-limits-for-github-apps/), which can increase based on the number of repositories and users in the organization. A GitHub App can also make use of [conditional requests](/rest/overview/resources-in-the-rest-api#conditional-requests) or consolidate requests by using the [GraphQL API](/graphql).
### Register a new GitHub App

View File

@@ -52,7 +52,7 @@ To get an idea of what your Checks API CI server will do when you've completed t
## Prerequisites
Before you get started, you may want to familiarize yourself with [GitHub Apps](/apps/), [Webhooks](/webhooks), and the [Checks API](/rest/reference/checks), if you're not already. You'll find more APIs in the [REST API docs](/rest). The Checks API is also available to use in [GraphQL]({% ifversion ghec %}/free-pro-team@latest{% endif %}/graphql), but this quickstart focuses on REST. See the GraphQL [Checks Suite]({% ifversion ghec %}/free-pro-team@latest{% endif %}/graphql/reference/objects#checksuite) and [Check Run]({% ifversion ghec %}/free-pro-team@latest{% endif %}/graphql/reference/objects#checkrun) objects for more details.
Before you get started, you may want to familiarize yourself with [GitHub Apps](/apps/), [Webhooks](/webhooks), and the [Checks API](/rest/reference/checks), if you're not already. You'll find more APIs in the [REST API docs](/rest). The Checks API is also available to use in [GraphQL](/graphql), but this quickstart focuses on REST. See the GraphQL [Checks Suite](/graphql/reference/objects#checksuite) and [Check Run](/graphql/reference/objects#checkrun) objects for more details.
You'll use the [Ruby programming language](https://www.ruby-lang.org/en/), the [Smee](https://smee.io/) webhook payload delivery service, the [Octokit.rb Ruby library](http://octokit.github.io/octokit.rb/) for the GitHub REST API, and the [Sinatra web framework](http://sinatrarb.com/) to create your Checks API CI server app.

View File

@@ -118,7 +118,7 @@ curl -X "POST" "{% data variables.product.api_url_code %}/graphql" \
}'
```
For more information on `node_id`, see "[Using Global Node IDs]({% ifversion ghec %}/free-pro-team@latest{% endif %}/graphql/guides/using-global-node-ids)."
For more information on `node_id`, see "[Using Global Node IDs](/graphql/guides/using-global-node-ids)."
## Example using Probot and GitHub App Manifests

View File

@@ -14,7 +14,7 @@ topics:
- API
---
There are two stable versions of the GitHub API: the [REST API](/rest) and the [GraphQL API]({% ifversion ghec %}/free-pro-team@latest{% endif %}/graphql).
There are two stable versions of the GitHub API: the [REST API](/rest) and the [GraphQL API](/graphql).
## Deprecated versions

View File

@@ -131,7 +131,7 @@ Name | Type | Description
`html_url` | `string` | The HTML URL of the issue comment.
`issue_url` | `string` | The HTML URL of the issue.
`id` | `integer` | The unique identifier of the event.
`node_id` | `string` | The [Global Node ID]({% ifversion ghec %}/free-pro-team@latest{% endif %}/graphql/guides/using-global-node-ids) of the event.
`node_id` | `string` | The [Global Node ID](/graphql/guides/using-global-node-ids) of the event.
`user` | `object` | The person who commented on the issue.
`created_at` | `string` | The timestamp indicating when the comment was added.
`updated_at` | `string` | The timestamp indicating when the comment was updated or created, if the comment is never updated.
@@ -157,7 +157,7 @@ A commit was added to the pull request's `HEAD` branch.
Name | Type | Description
-----|------|--------------
`sha` | `string` | The SHA of the commit in the pull request.
`node_id` | `string` | The [Global Node ID]({% ifversion ghec %}/free-pro-team@latest{% endif %}/graphql/guides/using-global-node-ids) of the event.
`node_id` | `string` | The [Global Node ID](/graphql/guides/using-global-node-ids) of the event.
`url` | `string` | The REST API URL to retrieve the commit.
`html_url` | `string` | The HTML URL of the commit.
`author` | `object` | The person who authored the commit.
@@ -594,7 +594,7 @@ The pull request was reviewed.
Name | Type | Description
-----|------|--------------
`id` | `integer` | The unique identifier of the event.
`node_id` | `string` | The [Global Node ID]({% ifversion ghec %}/free-pro-team@latest{% endif %}/graphql/guides/using-global-node-ids) of the event.
`node_id` | `string` | The [Global Node ID](/graphql/guides/using-global-node-ids) of the event.
`user` | `object` | The person who commented on the issue.
`body` | `string` | The review summary text.
`commit_id` | `string` | The SHA of the latest commit in the pull request at the time of the review.

View File

@@ -399,7 +399,7 @@ Key | Type | Description
{% data reusables.webhooks.discussions-webhooks-beta %}
Activity related to a discussion. For more information, see the "[Using the GraphQL API for discussions]({% ifversion ghec %}/free-pro-team@latest{% endif %}/graphql/guides/using-the-graphql-api-for-discussions)."
Activity related to a discussion. For more information, see the "[Using the GraphQL API for discussions](/graphql/guides/using-the-graphql-api-for-discussions)."
### Availability
- Repository webhooks
@@ -424,7 +424,7 @@ Key | Type | Description
{% data reusables.webhooks.discussions-webhooks-beta %}
Activity related to a comment in a discussion. For more information, see "[Using the GraphQL API for discussions]({% ifversion ghec %}/free-pro-team@latest{% endif %}/graphql/guides/using-the-graphql-api-for-discussions)."
Activity related to a comment in a discussion. For more information, see "[Using the GraphQL API for discussions](/graphql/guides/using-the-graphql-api-for-discussions)."
### Availability
@@ -437,7 +437,7 @@ Activity related to a comment in a discussion. For more information, see "[Using
Key | Type | Description
----|------|-------------
`action` |`string` | The action performed. Can be `created`, `edited`, or `deleted`.
`comment` | `object` | The [`discussion comment`]({% ifversion ghec %}/free-pro-team@latest{% endif %}/graphql/guides/using-the-graphql-api-for-discussions#discussioncomment) resource.
`comment` | `object` | The [`discussion comment`](/graphql/guides/using-the-graphql-api-for-discussions#discussioncomment) resource.
{% data reusables.webhooks.discussion_desc %}
{% data reusables.webhooks.repo_desc_graphql %}
{% data reusables.webhooks.org_desc_graphql %}

View File

@@ -3,6 +3,7 @@ title: Using the GraphQL API for Discussions
intro: 'Learn how to use the {% data variables.product.prodname_discussions %} GraphQL API.'
versions:
fpt: '*'
ghec: '*'
shortTitle: Use GraphQL for Discussions
---

View File

@@ -52,13 +52,13 @@ gh api graphql -f query='
}' -f organization=$my_org -F number=$my_num
```
For more information, see "[Forming calls with GraphQL]({% ifversion ghec%}/free-pro-team@latest{% endif %}/graphql/guides/forming-calls-with-graphql#working-with-variables)."
For more information, see "[Forming calls with GraphQL](/graphql/guides/forming-calls-with-graphql#working-with-variables)."
{% endcli %}
## Finding information about projects
Use queries to get data about projects. For more information, see "[About queries]({% ifversion ghec%}/free-pro-team@latest{% endif %}/graphql/guides/forming-calls-with-graphql#about-queries)."
Use queries to get data about projects. For more information, see "[About queries](/graphql/guides/forming-calls-with-graphql#about-queries)."
### Finding the node ID of an organization project
@@ -430,7 +430,7 @@ A project may contain items that a user does not have permission to view. In thi
## Updating projects
Use mutations to update projects. For more information, see "[About mutations]({% ifversion ghec %}/free-pro-team@latest{% endif %}/graphql/guides/forming-calls-with-graphql#about-mutations)."
Use mutations to update projects. For more information, see "[About mutations](/graphql/guides/forming-calls-with-graphql#about-mutations)."
{% note %}
@@ -594,7 +594,15 @@ gh api graphql -f query='
{% note %}
**Note:** You cannot use `updateProjectV2ItemFieldValue` to change `Assignees`, `Labels`, `Milestone`, or `Repository` because these fields are properties of pull requests and issues, not of project items. Instead, you must use the [addAssigneesToAssignable]({% ifversion ghec%}/free-pro-team@latest{% endif %}/graphql/reference/mutations#addassigneestoassignable), [removeAssigneesFromAssignable]({% ifversion ghec%}/free-pro-team@latest{% endif %}/graphql/reference/mutations#removeassigneesfromassignable), [addLabelsToLabelable]({% ifversion ghec%}/free-pro-team@latest{% endif %}/graphql/reference/mutations#addlabelstolabelable), [removeLabelsFromLabelable]({% ifversion ghec%}/free-pro-team@latest{% endif %}/graphql/reference/mutations#removelabelsfromlabelable), [updateIssue]({% ifversion ghec%}/free-pro-team@latest{% endif %}/graphql/reference/mutations#updateissue), [updatePullRequest]({% ifversion ghec%}/free-pro-team@latest{% endif %}/graphql/reference/mutations#updatepullrequest), or [transferIssue]({% ifversion ghec%}/free-pro-team@latest{% endif %}/graphql/reference/mutations#transferissue) mutations.
**Note:** You cannot use `updateProjectV2ItemFieldValue` to change `Assignees`, `Labels`, `Milestone`, or `Repository` because these fields are properties of pull requests and issues, not of project items. Instead, you may use the following mutations:
- [addAssigneesToAssignable](/graphql/reference/mutations#addassigneestoassignable)
- [removeAssigneesFromAssignable](/graphql/reference/mutations#removeassigneesfromassignable)
- [addLabelsToLabelable](/graphql/reference/mutations#addlabelstolabelable)
- [removeLabelsFromLabelable](/graphql/reference/mutations#removelabelsfromlabelable)
- [updateIssue](/graphql/reference/mutations#updateissue)
- [updatePullRequest](/graphql/reference/mutations#updatepullrequest)
- [transferIssue](/graphql/reference/mutations#transferissue)
{% endnote %}

View File

@@ -164,7 +164,7 @@ Note that you can't retrieve Git events using the GraphQL API. To retrieve Git e
The GraphQL response can include data for up to 90 to 120 days.
For example, you can make a GraphQL request to see all the new organization members added to your organization. For more information, see the "[GraphQL API Audit Log]({% ifversion ghec%}/free-pro-team@latest{% endif %}/graphql/reference/interfaces#auditentry/)."
For example, you can make a GraphQL request to see all the new organization members added to your organization. For more information, see the "[GraphQL API Audit Log](/graphql/reference/interfaces#auditentry/)."
{% ifversion ghec %}

View File

@@ -105,9 +105,9 @@ curl -X POST \
HOSTNAME/graphql
```
To find all of the private packages you have published to {% data variables.product.prodname_registry %}, along with the version IDs for the packages, you can use the `packages` connection through the `repository` object. You will need a token with the `read:packages` and `repo` scopes. For more information, see the [`packages`]({% ifversion ghec %}/free-pro-team@latest{% endif %}/graphql/reference/objects#repository) connection or the [`PackageOwner`]({% ifversion ghec %}/free-pro-team@latest{% endif %}/graphql/reference/interfaces#packageowner) interface.
To find all of the private packages you have published to {% data variables.product.prodname_registry %}, along with the version IDs for the packages, you can use the `packages` connection through the `repository` object. You will need a token with the `read:packages` and `repo` scopes. For more information, see the [`packages`](/graphql/reference/objects#repository) connection or the [`PackageOwner`](/graphql/reference/interfaces#packageowner) interface.
For more information about the `deletePackageVersion` mutation, see "[`deletePackageVersion`]({% ifversion ghec %}/free-pro-team@latest{% endif %}/graphql/reference/mutations#deletepackageversion)."
For more information about the `deletePackageVersion` mutation, see "[`deletePackageVersion`](/graphql/reference/mutations#deletepackageversion)."
You cannot directly delete an entire package using GraphQL, but if you delete every version of a package, the package will no longer show on {% data variables.product.product_name %}.

View File

@@ -112,7 +112,7 @@ You can delete a private or public package in the {% data variables.product.prod
You can delete a version of a package in the {% data variables.product.product_name %} user interface or using the GraphQL API.
{% endif %}
When you use the GraphQL API to query and delete private packages, you must use the same token you use to authenticate to {% data variables.product.prodname_registry %}. For more information, see "[Deleting and restoring a package](/packages/learn-github-packages/deleting-and-restoring-a-package)" and "[Forming calls with GraphQL]({% ifversion ghec %}/free-pro-team@latest{% endif %}/graphql/guides/forming-calls-with-graphql)."
When you use the GraphQL API to query and delete private packages, you must use the same token you use to authenticate to {% data variables.product.prodname_registry %}. For more information, see "[Deleting and restoring a package](/packages/learn-github-packages/deleting-and-restoring-a-package)" and "[Forming calls with GraphQL](/graphql/guides/forming-calls-with-graphql)."
You can configure webhooks to subscribe to package-related events, such as when a package is published or updated. For more information, see the "[`package` webhook event](/webhooks/event-payloads/#package)."

View File

@@ -184,7 +184,7 @@ $ curl {% ifversion fpt or ghae or ghec %}
## GraphQL global node IDs
See the guide on "[Using Global Node IDs]({% ifversion ghec%}/free-pro-team@latest{% endif %}/graphql/guides/using-global-node-ids)" for detailed information about how to find `node_id`s via the REST API and use them in GraphQL operations.
See the guide on "[Using Global Node IDs](/graphql/guides/using-global-node-ids)" for detailed information about how to find `node_id`s via the REST API and use them in GraphQL operations.
## Client errors

View File

@@ -19,7 +19,7 @@ The REST API overview documentation describes the [rate limit rules](/rest/overv
### Understanding your rate limit status
The Search API has a [custom rate limit](/rest/reference/search#rate-limit), separate from the rate limit governing the rest of the REST API. The GraphQL API also has a [custom rate limit]({% ifversion ghec%}/free-pro-team@latest{% endif %}/graphql/overview/resource-limitations#rate-limit) that is separate from and calculated differently than rate limits in the REST API.
The Search API has a [custom rate limit](/rest/reference/search#rate-limit), separate from the rate limit governing the rest of the REST API. The GraphQL API also has a [custom rate limit](/graphql/overview/resource-limitations#rate-limit) that is separate from and calculated differently than rate limits in the REST API.
For these reasons, the Rate Limit API response categorizes your rate limit. Under `resources`, you'll see four
objects:
@@ -28,7 +28,7 @@ objects:
* The `search` object provides your rate limit status for the [Search API](/rest/reference/search).
* The `graphql` object provides your rate limit status for the [GraphQL API]({% ifversion ghec%}/free-pro-team@latest{% endif %}/graphql).
* The `graphql` object provides your rate limit status for the [GraphQL API](/graphql).
* The `integration_manifest` object provides your rate limit status for the [GitHub App Manifest code conversion](/apps/building-github-apps/creating-github-apps-from-a-manifest/#3-you-exchange-the-temporary-code-to-retrieve-the-app-configuration) endpoint.

View File

@@ -11,6 +11,6 @@ topics:
shortTitle: Sponsors GraphQL API
---
To get started with the GraphQL API, see "[Introduction to GraphQL]({% ifversion ghec %}/free-pro-team@latest{% endif %}/graphql/guides/introduction-to-graphql)."
To get started with the GraphQL API, see "[Introduction to GraphQL](/graphql/guides/introduction-to-graphql)."
You can find the details about the Sponsors GraphQL API in the reference docs. For more information, see "[GraphQL reference]({% ifversion ghec %}/free-pro-team@latest{% endif %}/graphql/reference)." We recommend using the GraphQL explorer to build your GraphQL calls. For more information, see "[Using the explorer]({% ifversion ghec %}/free-pro-team@latest{% endif %}/graphql/guides/using-the-explorer)."
You can find the details about the Sponsors GraphQL API in the reference docs. For more information, see "[GraphQL reference](/graphql/reference)." We recommend using the GraphQL explorer to build your GraphQL calls. For more information, see "[Using the explorer](/graphql/guides/using-the-explorer)."

View File

@@ -1,7 +1,7 @@
Name | Type | Description
-----|------|--------------
`id` | `integer` | The unique identifier of the event.
`node_id` | `string` | The [Global Node ID]({% ifversion ghec %}/free-pro-team@latest{% endif %}/graphql/guides/using-global-node-ids) of the event.
`node_id` | `string` | The [Global Node ID](/graphql/guides/using-global-node-ids) of the event.
`url`| `string` | The REST API URL for fetching the event.
`actor` | `object`| The person who generated the event.
`event` | `string` | Identifies the actual type of event that occurred.

View File

@@ -1 +1 @@
You can use {% data variables.product.prodname_dotcom %}'s API to import a project board. For more information, see "[importProject]({% ifversion ghec%}/free-pro-team@latest{% endif %}/graphql/reference/mutations#importproject/)."
You can use {% data variables.product.prodname_dotcom %}'s API to import a project board. For more information, see "[importProject](/graphql/reference/mutations#importproject/)."

View File

@@ -1 +1 @@
`discussion` | `object` | The [`discussion`]({% ifversion ghec %}/free-pro-team@latest{% endif %}/graphql/guides/using-the-graphql-api-for-discussions#discussion) resource.
`discussion` | `object` | The [`discussion`](/graphql/guides/using-the-graphql-api-for-discussions#discussion) resource.

View File

@@ -1 +1 @@
`organization` | `object` | Webhook payloads contain the [`organization`]({% ifversion ghec %}/free-pro-team@latest{% endif %}/graphql/reference/objects#organization) object when the webhook is configured for an organization or the event occurs from activity in a repository owned by an organization.
`organization` | `object` | Webhook payloads contain the [`organization`](/graphql/reference/objects#organization) object when the webhook is configured for an organization or the event occurs from activity in a repository owned by an organization.

View File

@@ -1 +1 @@
`repository` | `object` | The [`repository`]({% ifversion ghec %}/free-pro-team@latest{% endif %}/graphql/reference/objects#repository) where the event occurred.
`repository` | `object` | The [`repository`](/graphql/reference/objects#repository) where the event occurred.

View File

@@ -50,13 +50,20 @@ As a workaround for these lost redirects, we have two files in `lib/redirects/st
This file contains keys equal to old routes and values equal to new routes (aka snapshots of permalinks at the time) for versions 2.13 to 2.17. (The old routes were generated via `lib/redirects/get-old-paths-from-permalink.js`.)
* `archived-frontmatter-fallbacks.json`
* `archived-frontmatter-valid-urls.json`
This file contains an array of arrays, where the child arrays are a group of all frontmatter redirects for each content file. This is essentially list of all the historical paths for the articles in old versions. The problem is, we don't know which historical paths correspond to which versions.
This file is an object of VALID_URL to VALID_REDIRECT_SOURCES.
E.g. `"/enterprise/2.13/foo": ["/enterprise/2.13/bar", "/enterprise/2.13/buzz"]`
It was originally based on a previous file called `archived-frontmatter-fallbacks.json`
which had a record of each possible redirect candidate that we should bother
redirecting too.
Now, this new file has been created by accurately comparing it to the actual
content inside the `github/help-docs-archived-enterprise-versions` repo for the
version range of 2.13 to 2.17. So every key in `archived-frontmatter-valid-urls.json`
corresponds to a file that would work.
Here's how the `middleware/archived-enterprise-versions.js` fallback works: if someone tries to access an article that was updated via a now-lost frontmatter redirect (for example, an article at the path `/en/enterprise/2.15/user/articles/viewing-contributions-on-your-profile-page`), the middleware will first look for a redirect in `archived-redirects-from-213-to-217.json`. If it does not find one, it will look for a child array in `archived-frontmatter-fallbacks.json` that contains the requested path. If it finds a relevant array, it will try accessing all the other paths in the array until it finds one that returns a 200. For this example, it would successfully reach `/en/enterprise/2.15/user/articles/viewing-contributions-on-your-profile` (no `-page`).
This is admittedly an inefficient brute-force approach. But requests for archived docs <2.18 are getting less and less common as organizations upgrade their Enterprise instances, and all the expensive calculation happens in the middleware on page request, not on server warmup, so at least it's a relatively isolated process.
Here's how the `middleware/archived-enterprise-versions.js` fallback works: if someone tries to access an article that was updated via a now-lost frontmatter redirect (for example, an article at the path `/en/enterprise/2.15/user/articles/viewing-contributions-on-your-profile-page`), the middleware will first look for a redirect in `archived-redirects-from-213-to-217.json`. If it does not find one, it will look for it in `archived-frontmatter-valid-urls.json` that contains the requested path. If it finds it, it will redirect to it to because that file knows exactly which URLs are valid in
`help-docs-archived-enterprise-versions`.
## Tests

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:747d97c4468cafeb04b3c0feda96a45c2dc290449fa6023b1af6f5dbc15b02d3
size 766323
oid sha256:f63efba22e2c9df58ff52bae92a771bde61e0a1011c3252c8e4db42e547291bb
size 766380

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:ba22dd6dc9ea55ca8e83f9acbc3c40c03107c6928d5efbb2abd1156559eacb0c
size 1599729
oid sha256:b035f2c22b9b52a0d4e0b17cbd51f1fcd9d608f6bc122a74d1974a0cf4d66c55
size 1599434

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:2b8488ba78bfa1d6f5b938ce7cf1a34c2c523a5cd60d0623392269f693e23a5a
size 1039304
oid sha256:43a6d1476fb162ad90673394bbbef68ad1c5032c861a3c66ecda930757eb8cb6
size 1039582

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:43de48c3c441e38a834022512bd0b46cc6f513aa57a1f4232747a4bdae762ce7
size 4177847
oid sha256:0cb3cc5cac4ee9f3301ecebdc889814b2fe614da54b2831050a815eaedc4305d
size 4178329

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:73c3f4096f8fe869b00aafdeeda224d1be50d928ce35875bff09633db11eaa9a
size 705569
oid sha256:9d62d2008af2023de3acff8de5150b25937ef0f8e158df978ab5b90f0927f8f6
size 705541

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:ecbf3e153ff318df7cb91b17959b9e6a22300ba6f56bc335574d82721f691a10
size 3065836
oid sha256:2192a165baef84d82b2db4486cfb55397e50c7a5b8bd8103f75a83b320b2a11b
size 3065328

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:f46fec912d42e414c0600ce18af9077c1c1fcb2a714f2f64b94b1dbf84bd5356
size 777851
oid sha256:b7c00928f488f487b64ffbb948fe2df2d6450111eae5538be68774581dc75fbb
size 776771

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:758919ff5834f7dd0b3b68328005f616b7fdec9e3065cfb6d36e789d49e1f984
size 4269569
oid sha256:f7d9fdc21e1d15ac88cad83ea1450bef407043c7df1ae38dff095f8fc0430a71
size 4260960

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:d3ffd8d667dead77d09286897d2c00880ef4d6a16ff8cf5c0eae0c909f01f1eb
size 695235
oid sha256:04828731d7b00ed197603c29c637150a46d50ec9648db95b02fe3482aee654f3
size 695250

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:3bafb7732f3537bd085191468ffd67b17ab5055b10e5d371221f33437c68ee9f
size 2961294
oid sha256:4a782cf9b608d8c06a8830a7e966845bd457bf105e38fc2eb885136c7cf58751
size 2961880

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:2a86ebe68cfcb9c5b309416b7c51bf22b3f16b225e2d98fb1f3fabd463a5655d
size 789709
oid sha256:e0254a0ad8df550f4412dfbd5a841dd9586531cecc54e1de9469fdcebea916c0
size 789884

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:5a9b3e527893bb7e7c5bfed0ba0918e8cbd7fcab39bb8d14ddb64437cda299c0
size 1640011
oid sha256:8b8ace685c2722ce4319205c8b5edb7237ed5ae4a81ca234dc5ef22921250862
size 1640289

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:82b548931e5db5ff549dd0a84261357bc767cdf444355ebd688b752d8ef2d32b
size 1074195
oid sha256:3dda0f22fe6728339565a9fd8b500ad09a46ef0f7b695bbb454f2e90c8d069a2
size 1074175

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:6e35ce22b6e8244406c25d36c170bd106df774621833f248e63f891a7b8ff673
size 4272589
oid sha256:9a563fcda7710781179f8bbf343e3e053d7a02778ea95f9947aa3bebaca0cb3f
size 4273815

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:2f61cd9061c1e320eaf25cb506ba57bfd48695fade537451e9ccdebdb9dc7559
size 725310
oid sha256:518c9b2d8029efabadeed0ffe334031ff7f4b424c1576f1d963ce70877e50e46
size 725301

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:07f299b8c0043eb62bd498abe327d505a33dededd728c6590566d5f781eece2d
size 3146047
oid sha256:1bf59eafaeba79ae84e82c653f1b992d66a1ff280c0d86680c59a51ab2665f3d
size 3145594

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:36cfcb910307f8c1eee24be4c000c35cb4d6dd2042949594df67df8cf7f02451
size 801157
oid sha256:2474cddb47cf11378e4c9ef7a3eb516360a9366f015198b776ef54c93ed817ba
size 800148

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:6cc41ee16777ac16177f4f9fa2a160faea1a7c3f21a4a8dc2cbf93f68c959e4b
size 4389958
oid sha256:48b8ae28e79f6a07fbdae5f2ed3b1b383707526a5347fe0d54623eaff1b539bb
size 4383166

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:a1ddf3673de57790e68f4ef01501784f5dab961b8cdab157c3825bf1169413fd
size 714641
oid sha256:ed75abb173171bd59f0a0eec74140f5036f02277a58e4e28a2e9b0cd0a1cd7ec
size 714738

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:df1d1df5278542e182dcfd19389b54dae6c0433f7e315ea9a52574ffa67b393f
size 3038271
oid sha256:e8cdc2af8bb42c0712d640c5890086fb5b4c22b44144823beb3e78b007005516
size 3038481

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:2da3c5be9a0fe573420a790b9845b15dc9b18cf3eb3d9275d0a062da8a5a10a4
size 791987
oid sha256:2a26abf3f4a66be89f84f8e521958388928f1d39ddca3a938a2845e681606d3e
size 791936

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:ab3b7a3a0e1bf1ee26fbaba3f442e0803dd0f548a53cc796ec50fdbad0bae3e1
size 1651405
oid sha256:c05638daa9eee1d34c6faa0cdad80d39d3137eaa24e047695fa3e78d679533c2
size 1651535

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:14758dee437860efceb8a7fc26d66b6a10ec2ef2ed7a1f3ae020bed208dd9113
size 1082931
oid sha256:a89fad517f574cb01c592b0ae1855e5abe743e2ddc75b7f7ff27d6f45a972c26
size 1083229

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:6d1a86e15850fd1ef5b56ef36120d3b98915ebbe8c0cd2b4743354ef0942524f
size 4312657
oid sha256:78aeebaff457aad34ca1071aa2cc9a046af0cdf6088dbe394d68583db6061105
size 4313145

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:f9f3d13c4d9889452d8efc6d8c716ff79957758253b447204607da4607e6d9ac
size 729033
oid sha256:bebd0f91a85683fed848092097b9f3b689670296417357bbebc7015597dfbf91
size 728847

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:476368d2a77223de579ce814ffa5aaa9f2f2fbf7ea92f6c92630b77df0ac7e95
size 3164893
oid sha256:7c7ec37969e0292d0d79d525bf34bd5c4fc9b7ae3600c0c2d5a55798a74cac37
size 3164715

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:9229ffebee9d9241a380c025b7e106d2e2bad2ae241823f77bc8849df924d76b
size 804329
oid sha256:33d311522391ea3b0ee1061ee0e6bde1eecd20bbe6a86a2917b1105f42a8a2e7
size 803734

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:1ea5a85b98fcc4f8145e83fe9dab43765de99e7f45feebe4534092c92ab56e6b
size 4417762
oid sha256:57364c46471442cb4ff10b1039f4becdffb0ac6a9bbdf85ef4639bdcdd51c965
size 4412078

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:4e62a8b4d510c172241389aa43dd4ccc4f372ee93fff2f1178ae13e3ac2b1d17
size 717901
oid sha256:2f7a5c84166e4b931805a1ae33608c047a8431c325b0720e8149c09816f60d74
size 718011

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:f045f6a0897d8dedac596c3a1cfbb39c98558a30684ca035123675ea75121360
size 3057415
oid sha256:e93a39046bc59887d7db5478ebf4bb31cd1fe7571124e61f11d5c2aade370c32
size 3057462

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:06d5726fba6e0ec1da46f7790c19acc31cdaa34acf4f4e77352f2b13ae7715c5
size 820877
oid sha256:f10c344b943bb537e05537628ee08a88808ace15823ab8865095cce145dc5e33
size 820897

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:22d3195c95ebed9494e504aad48c51af9a4f38486c9cc5559e75509c07afc10d
size 1714584
oid sha256:ea36caeedb78e28db4d5cf5ac7e764df9b0e4b355999176d6cf4592516f4253e
size 1714739

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:7cf99d28509951406260eb876c0e6858ac223704290e435fb84cba97720a2004
size 1121977
oid sha256:58431521ada0a10eddbb34ec82110149160004d7fc666ad8bc2a9dd6d3f54613
size 1122050

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:5bd4d5be5b0192f41e4e42cd9257f9f7c296ef8d5920abbc2180efe7d9033517
size 4473475
oid sha256:bfdfce7353fc57079a8a85622e72b43df5476a030ed6d8e14feac9a70e74fe44
size 4475049

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:cbb853acee1839f5841ee598f511958a3381b9be9a359f35f2d98ef894443663
size 751763
oid sha256:9dcea9721eacfd74caccef03485fc7b2fb574368927aa4b55174b56ff2198b07
size 751730

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:a7fe9c48f9d877c444d14c28e088eba36b55425d176d1e3691e6b886459d4828
size 3279028
oid sha256:1e4815f8424460b1b8d84e30ea3105d547d1f348422b8b73567ea15329923c78
size 3278993

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:a65a9b9e377d95368f1fb88218db0719798c29799bf56a4820cc7281b2d7593f
size 830804
oid sha256:fb9f9a6f3cee1879eb32dc5dd3f82af63090b15c7ce72df3bb7c48dfa94e052d
size 830894

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:2a2802c130e433ac49498696fbeedd87fc981f12a766f93ca6fca417075742b8
size 4580737
oid sha256:7c5fe8e31859d8078790f6f6d1cfdd6c8baf4121ccdfb0f7fc6eb5349af9ebe2
size 4576899

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:97c8059317c18a11070a65a669496c54ec464ae56d0730e88887534407e8aa4e
size 740291
oid sha256:900a714f2eb7c204f849cd2fa07e1b4bc0d56f2a91d8b5bb8a82e9705873ac6c
size 740128

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:a96d9d75effebf157ce313f2add7673e0b5e9f1d9103ac09ac0170fb228eda1a
size 3163798
oid sha256:b2693d62c6121acc9982de17757e91e1726f9cb08121bc7dc8d351562d94d56e
size 3164041

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:5b00bdec7265d68292263e27c4d0249f8aefad216c63204476dddb015ba0dd96
size 1001089
oid sha256:8da3767a07d1ea320f484da520a6dd96b05648a91a3c6585605a7b5ec074b4a4
size 1001138

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:1860427f34452a4d946729e251e19a10389a640e5248af7e7b971038079de0a9
size 1753287
oid sha256:3786d84da15296392f8af7ec98b211cb74f4847d3536b0625449e244d001bcf5
size 1752500

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:0df027ec3a55b292124a76285e2ee4296b39e97f2827bd723a3260a744c77262
size 1376797
oid sha256:906cf77c78f9b087d01b429021eb9506b9359a0b892b7329755e001da98627b1
size 1376469

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:10ba583f0ed0bb2f14ba030a1c9e5a33b4539041b46604bf437257e7a5e8bd5d
size 5246358
oid sha256:e420cbc9a927b7f2f5c6313cece0db1d0f0219ad255d9666b6a8c9070e114c43
size 5246975

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:4be1758ad5971affb47d998f4c1b1f57e129ae16f409c6472b81fb4cdb9135a2
size 900501
oid sha256:8bc0719a6aaa71da2ab1471985f55c290ddb528ce1e997e0be17a884bcd3f88f
size 900560

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:5553512e7d2cb8c704270d1a6ba376d24a9e936dfe4a9a9635091e8d7328a9c7
size 3762841
oid sha256:3faafc051aa1804f04b2100a3f45b81cb92b2ced729977a90ff47a010bb296f0
size 3762826

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:37db263e55496b8996373b30afecd0da24b748b347552f9b70d51410bc139447
size 1004970
oid sha256:04c66f6f16a210e54416329a35eb7ff224557ca2cdf0e51e4902a150d83d5322
size 1005163

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:3284f7128705f51bd539c31bbadb9e4e087cc516e760d840049273ebd5e4a4d4
size 5351361
oid sha256:a758c289eed45739ac189c76c7552fdd6a1c9df695a4918c31f0e8dd80a81bc0
size 5352774

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:61e20b5108d427bdf10eb7bc7d26869dd112e01e8fa0588e9a9bb47d064915ee
size 889839
oid sha256:95dd264fcf206642ba0c94e0e5759f25afed90cf042cfbaab0c7d654d6c0c4ba
size 889860

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:3f117ed255a158bcd1cf33309def45849dbd24167fb4046c1bae99d3ced98f72
size 3656425
oid sha256:b2edc479331657d190d499ce401e10b64aab3ce59a88ab3ee2ca7966a80d029a
size 3657227

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:396840edfbc1b1655bc1e320e094dc31d3491f67b8784ebfc393c57acca13f3a
size 626297
oid sha256:db48ee7997821af50715f1295357673f6cebdfed2fb698592a57d39bc620757a
size 626309

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:126c04362e8a9f4c3071c6c922da26151ba80b1e2b11bc9a3d82825dea1965c5
size 1263831
oid sha256:c9867c83bc7d257c35bd957a0f1b9ceb994181078e6f95117588f220dfad1391
size 1263717

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:3e23daefeb65fe45bfa9d2589aec8e0b69f5ee6dcca302bdffde8adfde3d3912
size 871587
oid sha256:a4cb1c937d0a17a77945ed0ced662adefdd9dddd3d0d7e82865eac13fa957306
size 871430

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:aed00c8418d6bab9eb8b89d60da75b2e32bddccf2fcc2304d987effeb2271788
size 3427164
oid sha256:0ff2c11b95184cba421276ce29cf08b352beb38c65819e54f8582a9c8d62304d
size 3427123

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:b9e3e356fb04540099043272be5cbafa693a2684d272bc63e79880b7832d675b
size 583295
oid sha256:9a3dd05940ef583ce209ccaf65445a78c06b11a6dfe1fc5e6fa631e85a8ac235
size 583086

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:ebc7199474e6acc9c5f49e54209158e77d48d706807caf5cd188f10e82672b32
size 2461271
oid sha256:ed8ca55a5f129574f5682a945cdcdd160ccf9efdca80c9024a92688498a7edce
size 2461183

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:025a0383de73f3651c14cb8c1cc340765f2ab6fa95b974c370494f293eabcadc
size 639273
oid sha256:866eba1f0bc0f526730e498a60cf6cded8317035ce86ffa51a5eaf4769a634d0
size 638503

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:5f98720130fbd1af171733d27245c6119d080f4092e15174d5d51f272554d582
size 3392228
oid sha256:a3541b93af60b7f854f8241669bc360f07c14b8f7a1a1bc8956c447a07f1c185
size 3385675

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:25abe8926bb37e94770df9a43498140b5d1935cae79c2a32661f4af8bc3e588a
size 575154
oid sha256:dd3c2347989ed8898fb4ba29ba63e56d644051b67e094ae3ae4591c005b386ce
size 575109

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:e1ca4ea197baee830170b99fcfd62fae3453eb828d3ac41699eb2038ea51cf76
size 2355509
oid sha256:c795fc8bf1e9cefa211cbd5adb1190dea2d2deffd96e1b1a62e454b9e02f1ddb
size 2355118

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:3beb96e3121ebd3596d7c13512c0c688365a5a6733fdc8e37ca5fc99ac0ef409
size 967214
oid sha256:f90c1e85898ec8003e30e00ec3d10fdada618cb5da1d4747ca388982dfe60d02
size 967359

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:2af2a3192bc4dc8659bd8b402551e918d78c8d6499753c591f6f40c47442c81f
size 1870802
oid sha256:019507a9d7817162ae562b3412e3e0cb76cb04a0c9bc217ceb57ca44b8197f4e
size 1871088

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:782080bf976340e50fa3081734cebfcfa1491d48a042d9838dc1d6e6035793db
size 1307809
oid sha256:c09d0bc8806cc7ba03c493034374f11397542346a94a95ab1efe98357ab45369
size 1310637

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:45491b7d71a6457be0a8e7f13eba548298415cf380945b546e7b241c33947d21
size 5237231
oid sha256:930c7b7f1254c832cf1959969dc876cf30aa712bd1363667ff8b20b55892aa51
size 5248189

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:e8516f3f81925de91033fad75b5385aa9be62a4b634b90ebc75dd6adeeee336b
size 890621
oid sha256:c7b657496bcf3e93c3d297805b72661e67be0913b36b73e8c5482068999d52ce
size 890759

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:baf9d2fe8a2d8336f5f85127022dc0a6c211cd1935a2f2d01301be74345be1ba
size 3874267
oid sha256:09c5fa59ef36655058ca6b4f171043ae56898c785513f72eb7f2caad65ec8575
size 3874279

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:ccf6d89b708291b382db3f6fe8c6ce83f9115a4c52bac0c6015492f0d1dad2bb
size 974324
oid sha256:d24b30b2a22c675b8136fa4f20be61a923811530a1ec2cc6036e5ea9e947ad56
size 976214

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:a2071b408b24d4e492914f503e1be0a1c350222b26bf21d19b1b52ab75eba629
size 5406379
oid sha256:9a4e762c1c91e0fca63ae7f324b0649a437babd44c9de3b55afb16170fed2a2e
size 5414055

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:3887f9ffe3fa2c273c9e16edb006e0d378e92e0a911f3e8faac458c8703baa12
size 879747
oid sha256:fb7ef5bba36506cc7ea11fc2e5b7efaffd458517e96b22b20200542db3fd1294
size 879776

View File

@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:4ca9017ad17fbc48874dfaf1c22f8660fd4b9ede0e9f80abc99f01f535b249ba
size 3754659
oid sha256:96da310f8cc86577381270be28e2ccd9214c5b0eaf842945943a620cb678d74b
size 3754632

View File

@@ -32,8 +32,8 @@ function splitByLanguage(uri) {
const archivedRedirects = readCompressedJsonFileFallbackLazily(
'./lib/redirects/static/archived-redirects-from-213-to-217.json'
)
const archivedFrontmatterFallbacks = readCompressedJsonFileFallbackLazily(
'./lib/redirects/static/archived-frontmatter-fallbacks.json'
const archivedFrontmatterValidURLS = readCompressedJsonFileFallbackLazily(
'./lib/redirects/static/archived-frontmatter-valid-urls.json'
)
const cacheControl = cacheControlFactory(60 * 60 * 24 * 365)
@@ -219,22 +219,18 @@ export default async function archivedEnterpriseVersions(req, res, next) {
return res.send(r.body)
}
for (const fallbackRedirect of getFallbackRedirects(req, requestedVersion) || []) {
const statsTags = [`path:${req.path}`, `fallback:${fallbackRedirect}`]
const doGet = () =>
got(getProxyPath(fallbackRedirect, requestedVersion), {
throwHttpErrors: false,
retry: retryConfiguration,
timeout: timeoutConfiguration,
})
const r = await statsd.asyncTimer(doGet, 'archive_enterprise_proxy_fallback', [
...statsdTags,
`fallback:${fallbackRedirect}`,
])()
if (r.statusCode === 200) {
cacheAggressively(res)
// from 2.13 to 2.17, we lost access to frontmatter redirects during the archival process
// this workaround finds potentially relevant frontmatter redirects in currently supported pages
if (
versionSatisfiesRange(requestedVersion, `>=${firstVersionDeprecatedOnNewSite}`) &&
versionSatisfiesRange(requestedVersion, `<=${lastVersionWithoutArchivedRedirectsFile}`)
) {
const statsTags = [`path:${req.path}`]
const fallbackRedirect = getFallbackRedirect(req)
if (fallbackRedirect) {
statsTags.push(`fallback:${fallbackRedirect}`)
statsd.increment('middleware.trying_fallback_redirect_success', 1, statsTags)
cacheAggressively(res)
return res.redirect(redirectCode, fallbackRedirect)
}
statsd.increment('middleware.trying_fallback_redirect_failure', 1, statsTags)
@@ -254,15 +250,56 @@ function getProxyPath(reqPath, requestedVersion) {
return `https://github.github.com/help-docs-archived-enterprise-versions${proxyPath}`
}
// from 2.13 to 2.17, we lost access to frontmatter redirects during the archival process
// this workaround finds potentially relevant frontmatter redirects in currently supported pages
function getFallbackRedirects(req, requestedVersion) {
if (versionSatisfiesRange(requestedVersion, `<${firstVersionDeprecatedOnNewSite}`)) return
if (versionSatisfiesRange(requestedVersion, `>${lastVersionWithoutArchivedRedirectsFile}`)) return
// Module-level global cache object.
// Get's populated lazily inside getFallbackRedirect().
const fallbackRedirectLookups = new Map()
// `archivedFrontmatterFallbacks` is a callable because it's a lazy function
// and memoized so calling it is cheap.
return archivedFrontmatterFallbacks().find((arrayOfFallbacks) =>
arrayOfFallbacks.includes(req.path)
)
function getFallbackRedirect(req) {
// The file `lib/redirects/static/archived-frontmatter-valid-urls.json` which
// we depend on here, is structured like this:
//
// {
// "/enterprise/2.13/foo/bar": [
// "/enterprise/2.13/other/old/thing",
// "/enterprise/2.13/more/redirectable/url",
// "/enterprise/2.13/etc/etc"
// ],
// ...
//
// The keys are valid URLs that it can redirect to. I.e. these are
// URLs that we definitely know are valid and will be found
// in https://github.com/github/help-docs-archived-enterprise-versions
// The array values are possible URLs we deem acceptable redirect
// sources.
// But to avoid an unnecessary, O(n), loop every time, we turn this
// structure around to become:
//
// {
// "/enterprise/2.13/other/old/thing": "/enterprise/2.13/foo/bar",
// "/enterprise/2.13/more/redirectable/url": "/enterprise/2.13/foo/bar",
// "/enterprise/2.13/etc/etc": "/enterprise/2.13/foo/bar",
// ...
//
// Now potential lookups are fast.
if (!fallbackRedirectLookups.size) {
for (const [destination, sources] of Object.entries(archivedFrontmatterValidURLS())) {
for (const source of sources) {
fallbackRedirectLookups.set(source, destination)
}
}
}
// But before we proceed, remember that the
// file lib/redirects/static/archived-frontmatter-valid-urls.json never
// contains a language prefix.
// E.g. only `/enterprise/2.13/foo/bar` but the requested URL can be
// `/en/enterprise/2.13/foo/bar`, `/pt/enterprise/2.13/foo/bar`,
// or just `/enterprise/2.13/foo/bar`.
// Whatever it is, pop the language prefix, operate, and put it back
// again. In the end, it always has to have a language prefix.
const [language, withoutLanguage] = splitPathByLanguage(req.path)
const fallback = fallbackRedirectLookups.get(withoutLanguage)
if (fallback) {
return `/${language}${fallback}`
}
}

View File

@@ -66,8 +66,13 @@ import trailingSlashes from './trailing-slashes.js'
import fastlyBehavior from './fastly-behavior.js'
const { DEPLOYMENT_ENV, NODE_ENV } = process.env
const isAzureDeployment = DEPLOYMENT_ENV === 'azure'
const isTest = NODE_ENV === 'test' || process.env.GITHUB_ACTIONS === 'true'
// By default, logging each request (with morgan), is on. And by default
// it's off if you're in a production environment or running automated tests.
// But if you set the env var, that takes precedence.
const ENABLE_DEV_LOGGING = JSON.parse(
process.env.ENABLE_DEV_LOGGING || !(DEPLOYMENT_ENV === 'azure' || isTest)
)
const ENABLE_FASTLY_TESTING = JSON.parse(process.env.ENABLE_FASTLY_TESTING || 'false')
@@ -108,8 +113,7 @@ export default function (app) {
}
// *** Request logging ***
// Not enabled in Azure deployment because the request information is logged via another layer of the stack
if (!isAzureDeployment) {
if (ENABLE_DEV_LOGGING) {
app.use(morgan('dev'))
}

Some files were not shown because too many files have changed in this diff Show More