Merge branch 'main' into Ruth-ikegah/issue#158
This commit is contained in:
@@ -294,6 +294,15 @@
|
||||
"contributions": [
|
||||
"doc"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "tjenkinson",
|
||||
"name": "Tom Jenkinson",
|
||||
"avatar_url": "https://avatars0.githubusercontent.com/u/3259993?v=4",
|
||||
"profile": "https://tjenkinson.me",
|
||||
"contributions": [
|
||||
"code"
|
||||
]
|
||||
}
|
||||
],
|
||||
"contributorsPerLine": 7,
|
||||
|
||||
6
.github/allowed-actions.js
vendored
6
.github/allowed-actions.js
vendored
@@ -8,6 +8,7 @@ module.exports = [
|
||||
'actions/cache@v2',
|
||||
'actions/checkout@v2',
|
||||
'actions/github-script@0.9.0',
|
||||
'actions/github-script@v2.0.0',
|
||||
'actions/github-script@v2',
|
||||
'actions/github-script@v3',
|
||||
'actions/labeler@v2',
|
||||
@@ -25,8 +26,11 @@ module.exports = [
|
||||
'pascalgn/automerge-action@135f0bdb927d9807b5446f7ca9ecc2c51de03c4a',
|
||||
'peter-evans/create-issue-from-file@v2',
|
||||
'peter-evans/create-pull-request@v2',
|
||||
'rachmari/actions-add-new-issue-to-column@v1.1.1',
|
||||
'rachmari/labeler@v1.0.4',
|
||||
'repo-sync/github-sync@v2',
|
||||
'repo-sync/pull-request@v2',
|
||||
'rtCamp/action-slack-notify@master',
|
||||
'rtCamp/action-slack-notify@v2.1.0'
|
||||
'rtCamp/action-slack-notify@v2.1.0',
|
||||
'tjenkinson/gh-action-auto-merge-dependency-updates@cee2ac0'
|
||||
]
|
||||
14
.github/workflows/automerge-dependencies.yml
vendored
Normal file
14
.github/workflows/automerge-dependencies.yml
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
name: Auto Merge Dependency Updates
|
||||
|
||||
on:
|
||||
- pull_request
|
||||
- pull_request_review
|
||||
|
||||
jobs:
|
||||
run:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: tjenkinson/gh-action-auto-merge-dependency-updates@cee2ac0
|
||||
with:
|
||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
allowed-actors: dependabot[bot]
|
||||
8
.github/workflows/merged-notification.yml
vendored
8
.github/workflows/merged-notification.yml
vendored
@@ -13,11 +13,7 @@ jobs:
|
||||
github.issues.createComment({
|
||||
...context.repo,
|
||||
issue_number: context.payload.pull_request.number,
|
||||
body: `Thanks very much for contributing! Your pull request has been merged 🎉 You should see your changes appear on the site in approximately 24 hours. To add your ✨ contribution to the README.md, create a new comment in this PR with:
|
||||
body: `Thanks very much for contributing! Your pull request has been merged 🎉 You should see your changes appear on the site in approximately 24 hours.
|
||||
|
||||
\`\`\`
|
||||
@all-contributors please add @${context.payload.pull_request.user.login} for docs
|
||||
\`\`\`
|
||||
|
||||
If you want to, you can use the [emoji key](https://allcontributors.org/docs/en/emoji-key) to replace docs with a different contribution type.`
|
||||
If you haven't already, you can add yourself to [the list of contributors](https://github.com/github/docs#contributors-) by creating a new comment in this PR using [these instructions](https://allcontributors.org/docs/en/bot/usage#commands). Thanks again! :sparkles:`
|
||||
})
|
||||
|
||||
1
.github/workflows/test-windows.yml
vendored
1
.github/workflows/test-windows.yml
vendored
@@ -11,7 +11,6 @@ env:
|
||||
|
||||
jobs:
|
||||
lint:
|
||||
if: github.repository == 'github/docs-internal'
|
||||
runs-on: windows-latest
|
||||
steps:
|
||||
- name: Check out repo
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
## GitHub Docs <!-- omit in toc -->
|
||||
|
||||
This repository contains the documentation website code and Markdown source files for docs.github.com.
|
||||
This repository contains the documentation website code and Markdown source files for [docs.github.com](https://docs.github.com).
|
||||
|
||||
GitHub's Docs team works on pre-production content in a private repo that regularly syncs with this public repo.
|
||||
|
||||
@@ -113,6 +113,7 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="center"><a href="https://github.com/BenJam"><img src="https://avatars2.githubusercontent.com/u/158833?v=4" width="64px;" alt=""/><br /><sub><b>Benjamin Nickolls</b></sub></a><br /><a href="https://github.com/github/docs/commits?author=BenJam" title="Documentation">📖</a></td>
|
||||
<td align="center"><a href="https://tjenkinson.me"><img src="https://avatars0.githubusercontent.com/u/3259993?v=4" width="64px;" alt=""/><br /><sub><b>Tom Jenkinson</b></sub></a><br /><a href="https://github.com/github/docs/commits?author=tjenkinson" title="Code">💻</a></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
|
||||
@@ -84,24 +84,24 @@ The `github` context contains information about the workflow run and the event t
|
||||
| Property name | Type | Description |
|
||||
|---------------|------|-------------|
|
||||
| `github` | `object` | The top-level context available during any job or step in a workflow. |
|
||||
| `github.event` | `object` | The full event webhook payload. For more information, see "[Events that trigger workflows](/articles/events-that-trigger-workflows/)." You can access individual properties of the event using this context. |
|
||||
| `github.event_path` | `string` | The path to the full event webhook payload on the runner. |
|
||||
| `github.workflow` | `string` | The name of the workflow. If the workflow file doesn't specify a `name`, the value of this property is the full path of the workflow file in the repository. |
|
||||
| `github.job` | `string` | The [`job_id`](/actions/reference/workflow-syntax-for-github-actions#jobsjob_id) of the current job. |
|
||||
| `github.run_id` | `string` | {% data reusables.github-actions.run_id_description %} |
|
||||
| `github.run_number` | `string` | {% data reusables.github-actions.run_number_description %} |
|
||||
| `github.action` | `string` | The name of the action currently running. {% data variables.product.prodname_dotcom %} removes special characters or uses the name `run` when the current step runs a script. If you use the same action more than once in the same job, the name will include a suffix with the sequence number. For example, the first script you run will have the name `run1`, and the second script will be named `run2`. Similarly, the second invocation of `actions/checkout` will be `actionscheckout2`. |
|
||||
| `github.action_path` | `string` | The path where your action is located. You can use this path to easily access files located in the same repository as your action. This attribute is only supported in composite run steps actions. |
|
||||
| `github.actor` | `string` | The login of the user that initiated the workflow run. |
|
||||
| `github.base_ref` | `string` | The `base_ref` or target branch of the pull request in a workflow run. This property is only available when the event that triggers a workflow run is a `pull_request`. |
|
||||
| `github.event` | `object` | The full event webhook payload. For more information, see "[Events that trigger workflows](/articles/events-that-trigger-workflows/)." You can access individual properties of the event using this context. |
|
||||
| `github.event_name` | `string` | The name of the event that triggered the workflow run. |
|
||||
| `github.event_path` | `string` | The path to the full event webhook payload on the runner. |
|
||||
| `github.head_ref` | `string` | The `head_ref` or source branch of the pull request in a workflow run. This property is only available when the event that triggers a workflow run is a `pull_request`. |
|
||||
| `github.job` | `string` | The [`job_id`](/actions/reference/workflow-syntax-for-github-actions#jobsjob_id) of the current job. |
|
||||
| `github.ref` | `string` | The branch or tag ref that triggered the workflow run. |
|
||||
| `github.repository` | `string` | The owner and repository name. For example, `Codertocat/Hello-World`. |
|
||||
| `github.repository_owner` | `string` | The repository owner's name. For example, `Codertocat`. |
|
||||
| `github.event_name` | `string` | The name of the event that triggered the workflow run. |
|
||||
| `github.run_id` | `string` | {% data reusables.github-actions.run_id_description %} |
|
||||
| `github.run_number` | `string` | {% data reusables.github-actions.run_number_description %} |
|
||||
| `github.sha` | `string` | The commit SHA that triggered the workflow run. |
|
||||
| `github.ref` | `string` | The branch or tag ref that triggered the workflow run. |
|
||||
| `github.head_ref` | `string` | The `head_ref` or source branch of the pull request in a workflow run. This property is only available when the event that triggers a workflow run is a `pull_request`. |
|
||||
| `github.base_ref` | `string` | The `base_ref` or target branch of the pull request in a workflow run. This property is only available when the event that triggers a workflow run is a `pull_request`. |
|
||||
| `github.token` | `string` | A token to authenticate on behalf of the GitHub App installed on your repository. This is functionally equivalent to the `GITHUB_TOKEN` secret. For more information, see "[Authenticating with the GITHUB_TOKEN](/actions/automating-your-workflow-with-github-actions/authenticating-with-the-github_token)." |
|
||||
| `github.workflow` | `string` | The name of the workflow. If the workflow file doesn't specify a `name`, the value of this property is the full path of the workflow file in the repository. |
|
||||
| `github.workspace` | `string` | The default working directory for steps and the default location of your repository when using the [`checkout`](https://github.com/actions/checkout) action. |
|
||||
| `github.action` | `string` | The name of the action currently running. {% data variables.product.prodname_dotcom %} removes special characters or uses the name `run` when the current step runs a script. If you use the same action more than once in the same job, the name will include a suffix with the sequence number. For example, the first script you run will have the name `run1`, and the second script will be named `run2`. Similarly, the second invocation of `actions/checkout` will be `actionscheckout2`. |
|
||||
| `github.action_path` | `string` | The path where your action is located. You can use this path to easily access files located in the same repository as your action. This attribute is only supported in composite run steps actions.
|
||||
|
||||
#### **`env` context**
|
||||
|
||||
@@ -124,14 +124,14 @@ The `job` context contains information about the currently running job.
|
||||
| Property name | Type | Description |
|
||||
|---------------|------|-------------|
|
||||
| `job` | `object` | This context changes for each job in a workflow run. You can access this context from any step in a job. |
|
||||
| `job.status` | `string` | The current status of the job. Possible values are `success`, `failure`, or `cancelled`. |
|
||||
| `job.container` | `object` | Information about the job's container. For more information about containers, see "[Workflow syntax for {% data variables.product.prodname_actions %}](/articles/workflow-syntax-for-github-actions#jobsjob_idcontainer)." |
|
||||
| `job.container.network` | `string` | The id of the container network. The runner creates the network used by all containers in a job. |
|
||||
| `job.container.id` | `string` | The id of the container. |
|
||||
| `job.container.network` | `string` | The id of the container network. The runner creates the network used by all containers in a job. |
|
||||
| `job.services` | `object` | The service containers created for a job. For more information about service containers, see "[Workflow syntax for {% data variables.product.prodname_actions %}](/articles/workflow-syntax-for-github-actions#jobsjob_idservices)." |
|
||||
| `job.services.<service id>.id` | `string` | The id of the service container. |
|
||||
| `job.services.<service id>.ports` | `object` | The exposed ports of the service container. |
|
||||
| `job.services.<service id>.network` | `string` | The id of the service container network. The runner creates the network used by all containers in a job. |
|
||||
| `job.services.<service id>.ports` | `object` | The exposed ports of the service container. |
|
||||
| `job.status` | `string` | The current status of the job. Possible values are `success`, `failure`, or `cancelled`. |
|
||||
|
||||
#### **`steps` context**
|
||||
|
||||
@@ -141,9 +141,9 @@ The `steps` context contains information about the steps in the current job that
|
||||
|---------------|------|-------------|
|
||||
| `steps` | `object` | This context changes for each step in a job. You can access this context from any step in a job. |
|
||||
| `steps.<step id>.outputs` | `object` | The set of outputs defined for the step. For more information, see "[Metadata syntax for {% data variables.product.prodname_actions %}](/articles/metadata-syntax-for-github-actions#outputs)." |
|
||||
| `steps.<step id>.outputs.<output name>` | `string` | The value of a specific output. |
|
||||
| `steps.<step id>.outcome` | `string` | The result of a completed step before [`continue-on-error`](/actions/reference/workflow-syntax-for-github-actions#jobsjob_idstepscontinue-on-error) is applied. Possible values are `success`, `failure`, `cancelled`, or `skipped`. When a `continue-on-error` step fails, the `outcome` is `failure`, but the final `conclusion` is `success`. |
|
||||
| `steps.<step id>.conclusion` | `string` | The result of a completed step after [`continue-on-error`](/actions/reference/workflow-syntax-for-github-actions#jobsjob_idstepscontinue-on-error) is applied. Possible values are `success`, `failure`, `cancelled`, or `skipped`. When a `continue-on-error` step fails, the `outcome` is `failure`, but the final `conclusion` is `success`. |
|
||||
| `steps.<step id>.outcome` | `string` | The result of a completed step before [`continue-on-error`](/actions/reference/workflow-syntax-for-github-actions#jobsjob_idstepscontinue-on-error) is applied. Possible values are `success`, `failure`, `cancelled`, or `skipped`. When a `continue-on-error` step fails, the `outcome` is `failure`, but the final `conclusion` is `success`. |
|
||||
| `steps.<step id>.outputs.<output name>` | `string` | The value of a specific output. |
|
||||
|
||||
#### **`runner` context**
|
||||
|
||||
@@ -162,9 +162,9 @@ The `needs` context contains outputs from all jobs that are defined as a depende
|
||||
| Property name | Type | Description |
|
||||
|---------------|------|-------------|
|
||||
| `needs.<job id>` | `object` | A single job that the current job depends on. |
|
||||
| `needs.<job id>.result` | `string` | The result of a job that the current job depends on. Possible values are `success`, `failure`, or `cancelled`. |
|
||||
| `needs.<job id>.outputs` | `object` | The set of outputs of a job that the current job depends on. |
|
||||
| `needs.<job id>.outputs.<output name>` | `string` | The value of a specific output for a job that the current job depends on. |
|
||||
| `needs.<job id>.result` | `string` | The result of a job that the current job depends on. Possible values are `success`, `failure`, or `cancelled`. |
|
||||
|
||||
#### Example printing context information to the log file
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@ We strongly recommend that actions use environment variables to access the files
|
||||
| `GITHUB_REPOSITORY` | The owner and repository name. For example, `octocat/Hello-World`. |
|
||||
| `GITHUB_EVENT_NAME` | The name of the webhook event that triggered the workflow. |
|
||||
| `GITHUB_EVENT_PATH` | The path of the file with the complete webhook event payload. For example, `/github/workflow/event.json`. |
|
||||
| `GITHUB_WORKSPACE` | The {% data variables.product.prodname_dotcom %} workspace directory path. The workspace directory contains a subdirectory with a copy of your repository if your workflow uses the [actions/checkout](https://github.com/actions/checkout) action. If you don't use the `actions/checkout` action, the directory will be empty. For example, `/home/runner/work/my-repo-name/my-repo-name`. |
|
||||
| `GITHUB_WORKSPACE` | The {% data variables.product.prodname_dotcom %} workspace directory path. The workspace directory is a copy of your repository if your workflow uses the [actions/checkout](https://github.com/actions/checkout) action. If you don't use the `actions/checkout` action, the directory will be empty. For example, `/home/runner/work/my-repo-name/my-repo-name`. |
|
||||
| `GITHUB_SHA` | The commit SHA that triggered the workflow. For example, `ffac537e6cbbf934b08745a378932722df287a53`. |
|
||||
| `GITHUB_REF` | The branch or tag ref that triggered the workflow. For example, `refs/heads/feature-branch-1`. If neither a branch or tag is available for the event type, the variable will not exist. |
|
||||
| `GITHUB_HEAD_REF` | Only set for forked repositories. The branch of the head repository.
|
||||
|
||||
@@ -35,9 +35,7 @@ You can filter email notifications you receive for pushes to a repository. For m
|
||||

|
||||
6. If you operate your own server, you can verify the integrity of emails via the **Secret** token. This token is sent with the email as the `Approved` header. If the `Approved` header matches the token you sent, you can trust that the email is from {% data variables.product.product_name %}.
|
||||

|
||||
7. Optionally, select **Send from author** to have emails delivered using the committer's email address. Otherwise, emails are sent from {% data variables.notifications.no_reply_address %}.
|
||||

|
||||
8. Click **Save settings**.
|
||||
7. Click **Save settings**.
|
||||

|
||||
|
||||
### Further reading
|
||||
|
||||
@@ -20,7 +20,7 @@ versions:
|
||||
|
||||
Once a repository is archived, you cannot add or remove collaborators or teams. Contributors with access to the repository can only fork or star your project.
|
||||
|
||||
When a repository is archived, its issues, pull requests, code, labels, milestones, projects, wiki, releases, commits, tags, branches, reactions, and comments become read-only. To make changes in an archived repository, you must unarchive the repository first.
|
||||
When a repository is archived, its issues, pull requests, code, labels, milestones, projects, wiki, releases, commits, tags, branches, reactions, code scanning alerts, and comments become read-only. To make changes in an archived repository, you must unarchive the repository first.
|
||||
|
||||
You can search for archived repositories. For more information, see "[Searching for repositories](/articles/searching-for-repositories/#search-based-on-whether-a-repository-is-archived)." You can also search for issues and pull requests within archived repositories. For more information, see "[Searching issues and pull requests](/articles/searching-issues-and-pull-requests/#search-based-on-whether-a-repository-is-archived)."
|
||||
|
||||
|
||||
@@ -39,9 +39,18 @@ chmod +x codeql-runner-macos
|
||||
sudo xattr -d com.apple.quarantine codeql-runner-macos
|
||||
```
|
||||
|
||||
On Windows, the `codeql-runner-win.exe` file usually requires no change to permissions.
|
||||
|
||||
### Adding the {% data variables.product.prodname_codeql_runner %} to your CI system
|
||||
|
||||
Once you have downloaded the {% data variables.product.prodname_codeql_runner %} and verified that it can be executed, you should make the runner available to each CI server that you intend to use for {% data variables.product.prodname_code_scanning %}. In addition to this, each CI server also needs:
|
||||
Once you have downloaded the {% data variables.product.prodname_codeql_runner %} and verified that it can be executed, you should make the runner available to each CI server that you intend to use for {% data variables.product.prodname_code_scanning %}. It is important to notice that each CI server that you intend to use for {% data variables.product.prodname_code_scanning %} needs to have the {% data variables.product.prodname_codeql_runner %}. You might configure each server to copy the runner from a central, internal location, or you could use the REST API to get the runner direct from GitHub, for example:
|
||||
|
||||
```shell
|
||||
wget https://github.com/github/codeql-action/releases/download/codeql-bundle-20200826/codeql-runner-linux
|
||||
chmod +x codeql-runner-linux
|
||||
```
|
||||
|
||||
In addition to this, each CI server also needs:
|
||||
|
||||
- A {% data variables.product.prodname_github_apps %} or personal access token for the {% data variables.product.prodname_codeql_runner %} to use. For private repositories the token must have the `repo` scope. For public the token needs only the `public_repo` and `repo:security_events` scopes. For information, see "[Building {% data variables.product.prodname_github_apps %}](/developers/apps/building-github-apps)" and "[Creating a personal access token](/github/authenticating-to-github/creating-a-personal-access-token)."
|
||||
- Access to the {% data variables.product.prodname_codeql %} bundle associated with this release of the {% data variables.product.prodname_codeql_runner %}. This package contains the {% data variables.product.prodname_codeql %} CLI, queries, and libraries needed for {% data variables.product.prodname_codeql %} analysis. For information, see "[{% data variables.product.prodname_codeql %} CLI](https://help.semmle.com/codeql/codeql-cli.html)."
|
||||
|
||||
@@ -77,15 +77,15 @@ We send security alerts to people with admin permissions in the affected reposit
|
||||
### Configuring notifications for {% if currentVersion == "free-pro-team@latest" or currentVersion ver_gt "enterprise-server@2.21" %}{% data variables.product.prodname_dependabot_alerts %}{% else %}security alerts{% endif %}
|
||||
|
||||
{% if currentVersion == "free-pro-team@latest" %}
|
||||
By default, you will receive {% data variables.product.prodname_dependabot_alerts %} by email, grouped by the specific vulnerability. You can also choose to receive {% data variables.product.prodname_dependabot_alerts %} in a weekly email summarizing alerts for up to 10 of your repositories, in your web notifications, or in the {% data variables.product.product_name %} user interface. For more information, see "[Configuring notifications](/github/managing-subscriptions-and-notifications-on-github/configuring-notifications#github-dependabot-alerts-options)."
|
||||
By default, you will receive {% data variables.product.prodname_dependabot_alerts %} by email, grouped by the specific vulnerability. You can also choose to receive {% data variables.product.prodname_dependabot_alerts %} in a weekly email summarizing alerts for up to 10 of your repositories, in your web notifications, or in the {% data variables.product.product_name %} user interface. For more information, see "[Configuring notifications](/github/managing-subscriptions-and-notifications-on-github/configuring-notifications#github-dependabot-alerts-notification-options)."
|
||||
{% endif %}
|
||||
|
||||
{% if currentVersion != "free-pro-team@latest" and currentVersion ver_gt "enterprise-server@2.21" %}
|
||||
By default, if your site administrator has configured email for notifications on your instance, you will receive {% data variables.product.prodname_dependabot_alerts %} by email. You can also choose to receive {% data variables.product.prodname_dependabot_alerts %} in a weekly email summarizing alerts for up to 10 of your repositories, in your web notifications, or in the {% data variables.product.product_name %} user interface. For more information, see "[Configuring notifications](/github/managing-subscriptions-and-notifications-on-github/configuring-notifications#github-dependabot-alerts-options)."
|
||||
By default, if your site administrator has configured email for notifications on your instance, you will receive {% data variables.product.prodname_dependabot_alerts %} by email. You can also choose to receive {% data variables.product.prodname_dependabot_alerts %} in a weekly email summarizing alerts for up to 10 of your repositories, in your web notifications, or in the {% data variables.product.product_name %} user interface. For more information, see "[Configuring notifications](/github/managing-subscriptions-and-notifications-on-github/configuring-notifications#github-dependabot-alerts-notification-options)."
|
||||
{% endif %}
|
||||
|
||||
{% if currentVersion != "free-pro-team@latest" and currentVersion == "enterprise-server@2.21" %}
|
||||
By default, if your site administrator has configured email for notifications on your instance, you will receive security alerts by email. You can also choose to receive security alerts in a weekly email summarizing alerts for up to 10 of your repositories, in your web notifications, or in the {% data variables.product.product_name %} user interface. For more information, see "[Configuring notifications](/github/managing-subscriptions-and-notifications-on-github/configuring-notifications#security-alert-options)."
|
||||
By default, if your site administrator has configured email for notifications on your instance, you will receive security alerts by email. You can also choose to receive security alerts in a weekly email summarizing alerts for up to 10 of your repositories, in your web notifications, or in the {% data variables.product.product_name %} user interface. For more information, see "[Configuring notifications](/github/managing-subscriptions-and-notifications-on-github/configuring-notifications#security-alert-notification-options)."
|
||||
{% endif %}
|
||||
|
||||
{% if currentVersion != "free-pro-team@latest" and currentVersion ver_lt "enterprise-server@2.21" %}
|
||||
|
||||
@@ -120,8 +120,8 @@ Email notifications from {% data variables.product.product_name %} contain the f
|
||||
3. On the notifications settings page, choose how you receive notifications when:
|
||||
- There are updates in repositories or team discussions you're watching or in a conversation you're participating in. For more information, see "[About participating and watching notifications](#about-participating-and-watching-notifications)."
|
||||
- You gain access to a new repository or you've joined a new team. For more information, see "[Automatic watching](#automatic-watching)."{% if currentVersion == "free-pro-team@latest" or currentVersion ver_gt "enterprise-server@2.21" %}
|
||||
- There are new {% data variables.product.prodname_dependabot_alerts %} in your repository. For more information, see "[{% data variables.product.prodname_dependabot_alerts %} options](#github-dependabot-alerts-options)." {% endif %}{% if currentVersion == "enterprise-server@2.21" %}
|
||||
- There are new security alerts in your repository. For more information, see "[Security alert options](#security-alert-options)." {% endif %} {% if currentVersion == "free-pro-team@latest" %}
|
||||
- There are new {% data variables.product.prodname_dependabot_alerts %} in your repository. For more information, see "[{% data variables.product.prodname_dependabot_alerts %} notification options](#github-dependabot-alerts-notification-options)." {% endif %}{% if currentVersion == "enterprise-server@2.21" %}
|
||||
- There are new security alerts in your repository. For more information, see "[Security alert notification options](#security-alert-notification-options)." {% endif %} {% if currentVersion == "free-pro-team@latest" %}
|
||||
- There are workflow runs updates on repositories set up with {% data variables.product.prodname_actions %}. For more information, see "[{% data variables.product.prodname_actions %} notification options](#github-actions-notification-options)."{% endif %}
|
||||
|
||||
### Automatic watching
|
||||
@@ -158,9 +158,9 @@ If you are a member of more than one organization, you can configure each one to
|
||||

|
||||
|
||||
{% if currentVersion == "free-pro-team@latest" or currentVersion ver_gt "enterprise-server@2.21" %}
|
||||
### {% data variables.product.prodname_dependabot_alerts %} options
|
||||
### {% data variables.product.prodname_dependabot_alerts %} notification options
|
||||
{% else %}
|
||||
### Security alert options
|
||||
### Security alert notification options
|
||||
{% endif %}
|
||||
|
||||
{% if currentVersion == "free-pro-team@latest" or currentVersion ver_gt "enterprise-server@2.21" %}Choose how you want to receive {% data variables.product.prodname_dependabot_alerts %} for repositories that you are watching. You can receive {% data variables.product.prodname_dependabot_alerts %} in your inbox, as a banner on {% data variables.product.product_name %}, on the command line, through email, or some combination of these options.
|
||||
@@ -177,6 +177,12 @@ If you want to receive security alerts by email, choose whether you want a weekl
|
||||

|
||||
{% endif %}
|
||||
|
||||
{% note %}
|
||||
|
||||
**Note:** You can filter your {% data variables.product.company_short %} inbox notifications by {% if currentVersion == "free-pro-team@latest" or currentVersion ver_gt "enterprise-server@2.21" %}{% data variables.product.prodname_dependabot_short %}{% else %} security{% endif %} alerts. For more information, see "[Managing notifications from your inbox](/github/managing-subscriptions-and-notifications-on-github/managing-notifications-from-your-inbox#supported-queries-for-custom-filters)."
|
||||
|
||||
{% endnote %}
|
||||
|
||||
{% if currentVersion == "free-pro-team@latest" or currentVersion ver_gt "enterprise-server@2.21" %}
|
||||
|
||||
### {% data variables.product.prodname_actions %} notification options
|
||||
|
||||
@@ -112,7 +112,7 @@ To filter notifications by why you've received an update, you can use the `reaso
|
||||
|
||||
#### Supported `is:` queries
|
||||
|
||||
To filter notifications for specific activity on {% data variables.product.product_name %}, you can use the `is` query. For example, to only see repository invitation updates, use `is:repository-invitation`.
|
||||
To filter notifications for specific activity on {% data variables.product.product_name %}, you can use the `is` query. For example, to only see repository invitation updates, use `is:repository-invitation`, and to only see {% if currentVersion == "free-pro-team@latest" or currentVersion ver_gt "enterprise-server@2.21" %}{% data variables.product.prodname_dependabot_short %}{% else %} security{% endif %} alerts, use `is:repository-vulnerability-alert`.
|
||||
|
||||
- `is:check-suite`
|
||||
- `is:commit`
|
||||
|
||||
@@ -11,16 +11,17 @@ versions:
|
||||
|
||||
{% tip %}
|
||||
|
||||
**Tip:** You can also apply a label in the Labels drop-down menu within an issue or pull request.
|
||||
**Tip:** You can apply up to a maximum of 100 labels to issues and pull requests.
|
||||
|
||||
{% endtip %}
|
||||
|
||||
{% data reusables.repositories.navigate-to-repo %}
|
||||
{% data reusables.repositories.sidebar-issue-pr %}
|
||||
{% data reusables.repositories.select-items-in-issue-or-pr-list %}
|
||||
4. In the upper-right corner, click **Label**, then start typing the name of an existing label. Click the label's name to associate it with the selected items.
|
||||
4. In the upper-right corner, click **Label**, then start typing the name of an existing label. Click the label's name to associate it with the selected items. You can also apply a label in the Labels drop-down menu within an issue or pull request.
|
||||

|
||||
|
||||
|
||||
### Further reading
|
||||
|
||||
- "[About labels](/articles/about-labels)"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: About searching on GitHub
|
||||
intro: 'Use our powerful search tools to find what you''re looking for among the many repositories, users, and lines of code on {% data variables.product.product_name %}.'
|
||||
intro: 'Our integrated search covers the many repositories, users, and lines of code on {% data variables.product.product_name %}.'
|
||||
redirect_from:
|
||||
- /articles/using-the-command-bar/
|
||||
- /articles/github-search-basics/
|
||||
@@ -24,6 +24,8 @@ You can search globally across all of {% data variables.product.product_name %},
|
||||
|
||||
- {% data reusables.search.required_login %}
|
||||
- {% data variables.product.prodname_pages %} sites are not searchable on {% data variables.product.product_name %}. However you can search the source content if it exists in the default branch of a repository, using code search. For more information, see "[Searching code](/articles/searching-code)." For more information about {% data variables.product.prodname_pages %}, see "[What is GitHub Pages?](/articles/what-is-github-pages/)"
|
||||
- Currently our search doesn't support exact matching.
|
||||
- Whenever you are searching in code files, only the first two results in each file will be returned.
|
||||
|
||||
{% endnote %}
|
||||
|
||||
|
||||
@@ -82,9 +82,9 @@ Since the number and names of cookies may change,the table below may be updated
|
||||
| Google Analytics** | `_gat` | This cookie is used by Google Analytics. | one minute |
|
||||
| Google Analytics** | `_gid` | This cookie is used by Google Analytics. | one day |
|
||||
|
||||
*The **expiration** dates for the cookies listed below generally apply on a rolling basis.
|
||||
_*_ The **expiration** dates for the cookies listed below generally apply on a rolling basis.
|
||||
|
||||
**We use <b>Google Analytics</b> as a third party analytics service to collect information about how our website performs and how our users, in general, navigate through and use GitHub. This helps us evaluate our users' use of GitHub, compile statistical reports on activity, and improve our content and website performance.
|
||||
_**_ We use **Google Analytics** as a third party analytics service to collect information about how our website performs and how our users, in general, navigate through and use GitHub. This helps us evaluate our users' use of GitHub, compile statistical reports on activity, and improve our content and website performance.
|
||||
|
||||
You can control your Google Analytics cookie preferences through our cookie preference link located at the footer of our website. In addition, Google provides further information about its own privacy practices and [offers a browser add-on to opt out of Google Analytics tracking](https://tools.google.com/dlpage/gaoptout).
|
||||
|
||||
|
||||
@@ -185,7 +185,7 @@ For more information, see:
|
||||
|
||||
### Managing packages
|
||||
|
||||
You can a delete a version of a private package on {% data variables.product.product_name %} or using the GraphQL API. 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 a package](/packages/publishing-and-managing-packages/deleting-a-package)" and "[Forming calls with GraphQL](/v4/guides/forming-calls/)."
|
||||
You can delete a version of a private package on {% data variables.product.product_name %} or using the GraphQL API. 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 a package](/packages/publishing-and-managing-packages/deleting-a-package)" and "[Forming calls with GraphQL](/v4/guides/forming-calls/)."
|
||||
|
||||
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)."
|
||||
|
||||
|
||||
@@ -120,12 +120,12 @@ publishing {
|
||||
|
||||
##### Example using Kotlin DSL for multiple packages in the same repository
|
||||
|
||||
```shell
|
||||
plugins {
|
||||
```shell
|
||||
plugins {
|
||||
`maven-publish` apply false
|
||||
}
|
||||
}
|
||||
|
||||
subprojects {
|
||||
subprojects {
|
||||
apply(plugin = "maven-publish")
|
||||
configure<PublishingExtension> {
|
||||
repositories {
|
||||
@@ -144,8 +144,8 @@ publishing {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
}
|
||||
```
|
||||
|
||||
#### Authenticating with the `GITHUB_TOKEN`
|
||||
|
||||
|
||||
@@ -59,7 +59,6 @@ $ curl -i {% data variables.product.api_url_pre %}/users/defunkt
|
||||
> Server: GitHub.com
|
||||
> Date: Sun, 11 Nov 2012 18:43:28 GMT
|
||||
> Content-Type: application/json; charset=utf-8
|
||||
> Connection: keep-alive
|
||||
> Status: 200 OK
|
||||
> ETag: "bfd85cbf23ac0b0c8a29bee02e7117c6"
|
||||
> X-RateLimit-Limit: 60
|
||||
|
||||
@@ -11,7 +11,7 @@ versions:
|
||||
|
||||
You must use an installation access token to access endpoints using your {% data variables.product.prodname_github_app %}. For more information, see "[Authenticating with {% data variables.product.prodname_github_apps %}](/apps/building-github-apps/authenticating-with-github-apps/#authenticating-as-an-installation)."
|
||||
|
||||
{% for thing in rest.operationsEnabledForApps[currentVersion] %}
|
||||
{% for thing in rest.operationsEnabledForGitHubApps[currentVersion] %}
|
||||
{% assign category = thing[0] %}
|
||||
{% assign operations = thing[1] %}
|
||||
{% if operations.size > 0 %}
|
||||
|
||||
@@ -36,7 +36,6 @@ $ curl -i {% data variables.product.api_url_pre %}/users/octocat/orgs
|
||||
> Server: nginx
|
||||
> Date: Fri, 12 Oct 2012 23:33:14 GMT
|
||||
> Content-Type: application/json; charset=utf-8
|
||||
> Connection: keep-alive
|
||||
> Status: 200 OK
|
||||
> ETag: "a00049ba79152d03380c34652f2cb612"
|
||||
> X-GitHub-Media-Type: github.v3
|
||||
|
||||
@@ -8,7 +8,7 @@ This site is powered by Node.js! :sparkles: :turtle: :rocket: :sparkles:
|
||||
|
||||
It runs on macOS, Windows, and Linux environments.
|
||||
|
||||
You'll need **Node.js v14** to run the site. If you're using [`nodenv`](https://github.com/nodenv/nodenv), read the [`nodenv` docs](#nodenv) for instructions on switching Node.js versions. If you're not using `nodenv`, the best way to install Node.js is to [download the LTS installer from nodejs.org](https://nodejs.org).
|
||||
You'll need Node.js version 12 or 14 to run the site. To install Node.js, [download the "LTS" installer from nodejs.org](https://nodejs.org). If you're using [`nodenv`](https://github.com/nodenv/nodenv), read the [`nodenv` docs](#nodenv) for instructions on switching Node.js versions.
|
||||
|
||||
Once you've installed Node.js (which includes the popular `npm` package manager), open Terminal and run the following:
|
||||
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
# Node Versions
|
||||
|
||||
The site currently runs on Node.js v14, the [Active LTS version](https://nodejs.org/en/about/releases/) from 2020-10-27 to 2021-10-26.
|
||||
In [development](contributing/development.md) enviroments this site will run on Node.js versions `12 - 14`.
|
||||
|
||||
In [staging and production](contributing/deployments.md) environments this site runs on Node.js 14, the [Active LTS version](https://nodejs.org/en/about/releases/) from 2020-10-27 to 2021-10-26).
|
||||
|
||||
When updating to a new Node.js version, consider the following files:
|
||||
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
<!-- Contact support banner -->
|
||||
<section class="mt-lg-9 py-7 no-print js-support-banner" style="background-color: #fafbfc;">
|
||||
<div class="mx-4">
|
||||
<h4 class="mb-3">
|
||||
<h4 class="mb-2">
|
||||
{% data ui.support.still_need_help %}
|
||||
</h4>
|
||||
{% if currentVersion contains 'enterprise' %}{% assign isEnterprise = true %}{% else %}{% assign isEnterprise = false %}{% endif %}
|
||||
<a id="ask-community" href="https://github.community" class="btn btn-outline">
|
||||
<a id="ask-community" href="https://github.community" class="btn btn-outline mr-4 mt-2">
|
||||
{% octicon "people" width="16" %}
|
||||
{% data ui.support.ask_community %}
|
||||
</a>
|
||||
<a id="contact-us" href="{% unless isEnterprise %}https://support.github.com/contact{% else %}https://enterprise.github.com/support{% endunless %}" class="btn btn-outline ml-4">
|
||||
<a id="contact-us" href="{% unless isEnterprise %}https://support.github.com/contact{% else %}https://enterprise.github.com/support{% endunless %}" class="btn btn-outline mt-2">
|
||||
{% octicon "comment-discussion" width="16" %}
|
||||
{% data ui.support.contact_support %}
|
||||
</a>
|
||||
|
||||
118
javascripts/events.js
Normal file
118
javascripts/events.js
Normal file
@@ -0,0 +1,118 @@
|
||||
/* eslint-disable camelcase */
|
||||
import { v4 as uuidv4 } from 'uuid'
|
||||
import Cookies from 'js-cookie'
|
||||
import getCsrf from './get-csrf'
|
||||
|
||||
const COOKIE_NAME = '_docs-events'
|
||||
|
||||
let cookieValue
|
||||
|
||||
export function getUserEventsId () {
|
||||
if (cookieValue) return cookieValue
|
||||
cookieValue = Cookies.get(COOKIE_NAME)
|
||||
if (cookieValue) return cookieValue
|
||||
cookieValue = uuidv4()
|
||||
Cookies.set(COOKIE_NAME, cookieValue, {
|
||||
secure: true,
|
||||
sameSite: 'strict',
|
||||
expires: 365
|
||||
})
|
||||
return cookieValue
|
||||
}
|
||||
|
||||
export async function sendEvent ({
|
||||
type,
|
||||
version = '1.0.0',
|
||||
page_render_duration,
|
||||
exit_page_id,
|
||||
exit_first_paint,
|
||||
exit_dom_interactive,
|
||||
exit_dom_complete,
|
||||
exit_visit_duration,
|
||||
exit_scroll_length,
|
||||
link_url,
|
||||
search_query,
|
||||
search_context,
|
||||
navigate_label,
|
||||
survey_vote,
|
||||
survey_comment,
|
||||
survey_email,
|
||||
experiment_name,
|
||||
experiment_variation,
|
||||
experiment_success
|
||||
}) {
|
||||
const response = await fetch('/events', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'CSRF-Token': getCsrf()
|
||||
},
|
||||
body: JSON.stringify({
|
||||
type, // One of page, exit, link, search, navigate, survey, experiment
|
||||
|
||||
context: {
|
||||
// Primitives
|
||||
event_id: uuidv4(),
|
||||
user: getUserEventsId(),
|
||||
version,
|
||||
created: new Date().toISOString(),
|
||||
|
||||
// Content information
|
||||
path: location.pathname,
|
||||
referrer: document.referrer,
|
||||
search: location.search,
|
||||
href: location.href,
|
||||
site_language: location.pathname.split('/')[1],
|
||||
|
||||
// Device information
|
||||
// os:
|
||||
// os_version:
|
||||
// browser:
|
||||
// browser_version:
|
||||
viewport_width: document.documentElement.clientWidth,
|
||||
viewport_height: document.documentElement.clientHeight,
|
||||
|
||||
// Location information
|
||||
timezone: new Date().getTimezoneOffset() / -60,
|
||||
user_language: navigator.language
|
||||
},
|
||||
|
||||
// Page event
|
||||
page_render_duration,
|
||||
|
||||
// Exit event
|
||||
exit_page_id,
|
||||
exit_first_paint,
|
||||
exit_dom_interactive,
|
||||
exit_dom_complete,
|
||||
exit_visit_duration,
|
||||
exit_scroll_length,
|
||||
|
||||
// Link event
|
||||
link_url,
|
||||
|
||||
// Search event
|
||||
search_query,
|
||||
search_context,
|
||||
|
||||
// Navigate event
|
||||
navigate_label,
|
||||
|
||||
// Survey event
|
||||
survey_vote,
|
||||
survey_comment,
|
||||
survey_email,
|
||||
|
||||
// Experiment event
|
||||
experiment_name,
|
||||
experiment_variation,
|
||||
experiment_success
|
||||
})
|
||||
})
|
||||
const data = response.ok ? await response.json() : {}
|
||||
return data
|
||||
}
|
||||
|
||||
export default async function initializeEvents () {
|
||||
await sendEvent({ type: 'page' })
|
||||
}
|
||||
@@ -14,8 +14,9 @@ import localization from './localization'
|
||||
import helpfulness from './helpfulness'
|
||||
import experiment from './experiment'
|
||||
import { fillCsrf } from './get-csrf'
|
||||
import initializeEvents from './events'
|
||||
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
document.addEventListener('DOMContentLoaded', async () => {
|
||||
displayPlatformSpecificContent()
|
||||
explorer()
|
||||
search()
|
||||
@@ -27,7 +28,8 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||
wrapCodeTerms()
|
||||
print()
|
||||
localization()
|
||||
fillCsrf()
|
||||
await fillCsrf() // this must complete before any POST calls
|
||||
helpfulness()
|
||||
experiment()
|
||||
initializeEvents()
|
||||
})
|
||||
|
||||
23
lib/hydro.js
23
lib/hydro.js
@@ -1,10 +1,21 @@
|
||||
const crypto = require('crypto')
|
||||
const fetch = require('node-fetch')
|
||||
|
||||
const SCHEMAS = {
|
||||
page: 'docs.v0.PageEvent',
|
||||
exit: 'docs.v0.ExitEvent',
|
||||
link: 'docs.v0.LinkEvent',
|
||||
search: 'docs.v0.SearchEvent',
|
||||
navigate: 'docs.v0.NavigateEvent',
|
||||
survey: 'docs.v0.SurveyEvent',
|
||||
experiment: 'docs.v0.ExperimentEvent'
|
||||
}
|
||||
|
||||
module.exports = class Hydro {
|
||||
constructor ({ secret, endpoint }) {
|
||||
constructor ({ secret, endpoint } = {}) {
|
||||
this.secret = secret || process.env.HYDRO_SECRET
|
||||
this.endpoint = endpoint || process.env.HYDRO_ENDPOINT
|
||||
this.schemas = SCHEMAS
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -32,7 +43,13 @@ module.exports = class Hydro {
|
||||
* @param {[{ schema: string, value: any }]} events
|
||||
*/
|
||||
async publishMany (events) {
|
||||
const body = JSON.stringify({ events })
|
||||
const body = JSON.stringify({
|
||||
events: events.map(({ schema, value }) => ({
|
||||
schema,
|
||||
value: JSON.stringify(value), // We must double-encode the value property
|
||||
cluster: 'potomac' // We only have ability to publish externally to potomac cluster
|
||||
}))
|
||||
})
|
||||
const token = this.generatePayloadHmac(body)
|
||||
|
||||
return fetch(this.endpoint, {
|
||||
@@ -41,7 +58,7 @@ module.exports = class Hydro {
|
||||
headers: {
|
||||
Authorization: `Hydro ${token}`,
|
||||
'Content-Type': 'application/json',
|
||||
'X-Hydro-App': 'docs'
|
||||
'X-Hydro-App': 'docs-production'
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
17
lib/rest.js
17
lib/rest.js
@@ -1,9 +1,8 @@
|
||||
const { chain, get, union, flatten, groupBy } = require('lodash')
|
||||
const { supported } = require('./enterprise-server-releases')
|
||||
const operations = require('@github/rest-api-operations')
|
||||
// TODO need to update this to the new versions in coordination with openAPI
|
||||
const { oldVersions } = require('./old-versions-utils')
|
||||
const allVersions = oldVersions
|
||||
const { getOldVersionFromNewVersion } = require('./old-versions-utils')
|
||||
const allVersions = Object.keys(require('./all-versions'))
|
||||
|
||||
// This list is generated for use in the tests,
|
||||
// so we can verify that the names of the markdown files
|
||||
@@ -18,16 +17,16 @@ const categories = union(dotcomCategories, enterpriseCategories)
|
||||
|
||||
// Attach convenience properties to each operation that can't easily be created in Liquid
|
||||
allVersions.forEach(currentVersion => {
|
||||
operations[currentVersion].forEach(operation => {
|
||||
operations[getOldVersionFromNewVersion(currentVersion)].forEach(operation => {
|
||||
operation.hasRequiredPreviews = get(operation, 'x-github.previews', []).some(preview => preview.required)
|
||||
})
|
||||
})
|
||||
|
||||
// This is a collection of operations that have `enabledForApps = true`
|
||||
// This is a collection of operations that have `enabledForGitHubApps = true`
|
||||
// It's grouped by resource title to make rendering easier
|
||||
const operationsEnabledForApps = allVersions.reduce((acc, currentVersion) => {
|
||||
acc[currentVersion] = chain(operations[currentVersion] || [])
|
||||
.filter(operation => operation['x-github'].enabledForApps)
|
||||
const operationsEnabledForGitHubApps = allVersions.reduce((acc, currentVersion) => {
|
||||
acc[currentVersion] = chain(operations[getOldVersionFromNewVersion(currentVersion)] || [])
|
||||
.filter(operation => operation['x-github'].enabledForGitHubApps)
|
||||
.orderBy('category')
|
||||
.value()
|
||||
acc[currentVersion] = groupBy(acc[currentVersion], 'category')
|
||||
@@ -37,5 +36,5 @@ const operationsEnabledForApps = allVersions.reduce((acc, currentVersion) => {
|
||||
module.exports = {
|
||||
categories,
|
||||
operations,
|
||||
operationsEnabledForApps
|
||||
operationsEnabledForGitHubApps
|
||||
}
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
const languages = require('./languages')
|
||||
|
||||
module.exports = {
|
||||
const context = {
|
||||
type: 'object',
|
||||
additionalProperties: false,
|
||||
required: [
|
||||
'event_id',
|
||||
'type',
|
||||
'user',
|
||||
'version',
|
||||
'created'
|
||||
'created',
|
||||
'path'
|
||||
],
|
||||
properties: {
|
||||
// Required of all events
|
||||
@@ -16,11 +17,6 @@ module.exports = {
|
||||
description: 'The unique identifier of the event.',
|
||||
format: 'uuid'
|
||||
},
|
||||
type: {
|
||||
type: 'string',
|
||||
description: 'The type of the event.',
|
||||
enum: ['page', 'exit', 'link', 'search', 'navigate', 'survey', 'experiment']
|
||||
},
|
||||
user: {
|
||||
type: 'string',
|
||||
description: 'The unique identifier of the current user performing the event. Please use randomly generated values or hashed values; we don\'t want to be able to look up in a database.',
|
||||
@@ -29,18 +25,13 @@ module.exports = {
|
||||
version: {
|
||||
type: 'string',
|
||||
description: 'The version of the event schema.',
|
||||
pattern: /^\d+(\.\d+)?(\.\d+)?$/
|
||||
pattern: '^\\d+(\\.\\d+)?(\\.\\d+)?$' // eslint-disable-line
|
||||
},
|
||||
created: {
|
||||
type: 'string',
|
||||
format: 'date-time',
|
||||
description: 'The time we created the event; please reference UTC.'
|
||||
},
|
||||
token: {
|
||||
type: 'string',
|
||||
description: 'A honeypot.',
|
||||
maxLength: 0
|
||||
},
|
||||
|
||||
// Content information
|
||||
path: {
|
||||
@@ -109,35 +100,41 @@ module.exports = {
|
||||
type: 'string',
|
||||
description: 'The browser value of `navigator.language`.'
|
||||
}
|
||||
},
|
||||
oneOf: [{
|
||||
// *** type: page ***
|
||||
}
|
||||
}
|
||||
|
||||
const pageSchema = {
|
||||
additionalProperties: false,
|
||||
required: [
|
||||
'path',
|
||||
'href'
|
||||
'type',
|
||||
'context'
|
||||
],
|
||||
properties: {
|
||||
context,
|
||||
type: {
|
||||
type: 'string',
|
||||
pattern: /^page$/
|
||||
pattern: '^page$'
|
||||
},
|
||||
page_render_duration: {
|
||||
type: {
|
||||
type: 'number',
|
||||
description: 'How long the server took to render the page content, in seconds.',
|
||||
minimum: 0.001
|
||||
}
|
||||
}
|
||||
}
|
||||
}, {
|
||||
// *** type: exit ***
|
||||
}
|
||||
|
||||
const exitSchema = {
|
||||
additionalProperties: false,
|
||||
required: [
|
||||
'type',
|
||||
'context',
|
||||
'exit_page_id'
|
||||
],
|
||||
properties: {
|
||||
context,
|
||||
type: {
|
||||
type: 'string',
|
||||
pattern: /^exit$/
|
||||
pattern: '^exit$'
|
||||
},
|
||||
exit_page_id: {
|
||||
type: 'string',
|
||||
@@ -172,15 +169,20 @@ module.exports = {
|
||||
description: 'The percentage of how far the user scrolled on the page.'
|
||||
}
|
||||
}
|
||||
}, {
|
||||
// *** type: link ***
|
||||
}
|
||||
|
||||
const linkSchema = {
|
||||
additionalProperties: false,
|
||||
required: [
|
||||
'type',
|
||||
'context',
|
||||
'link_url'
|
||||
],
|
||||
properties: {
|
||||
context,
|
||||
type: {
|
||||
type: 'string',
|
||||
pattern: /^link$/
|
||||
pattern: '^link$'
|
||||
},
|
||||
link_url: {
|
||||
type: 'string',
|
||||
@@ -188,15 +190,20 @@ module.exports = {
|
||||
description: 'The href of the anchor tag the user clicked, or the page or object they directed their browser to.'
|
||||
}
|
||||
}
|
||||
}, {
|
||||
// *** type: search ***
|
||||
}
|
||||
|
||||
const searchSchema = {
|
||||
additionalProperties: false,
|
||||
required: [
|
||||
'type',
|
||||
'context',
|
||||
'search_query'
|
||||
],
|
||||
properties: {
|
||||
context,
|
||||
type: {
|
||||
type: 'string',
|
||||
pattern: /^search$/
|
||||
pattern: '^search$'
|
||||
},
|
||||
search_query: {
|
||||
type: 'string',
|
||||
@@ -207,24 +214,44 @@ module.exports = {
|
||||
description: 'Any additional search context, such as component searched.'
|
||||
}
|
||||
}
|
||||
}, {
|
||||
// *** type: navigate ***
|
||||
}
|
||||
|
||||
const navigateSchema = {
|
||||
additionalProperties: false,
|
||||
required: [
|
||||
'type',
|
||||
'context'
|
||||
],
|
||||
properties: {
|
||||
context,
|
||||
type: {
|
||||
type: 'string',
|
||||
pattern: /^navigate$/
|
||||
pattern: '^navigate$'
|
||||
},
|
||||
navigate_label: {
|
||||
type: 'string',
|
||||
description: 'An identifier for where the user is navigating.'
|
||||
}
|
||||
}
|
||||
}, {
|
||||
// *** type: survey ***
|
||||
}
|
||||
|
||||
const surveySchema = {
|
||||
additionalProperties: false,
|
||||
required: [
|
||||
'type',
|
||||
'context',
|
||||
'survey_vote'
|
||||
],
|
||||
properties: {
|
||||
context,
|
||||
type: {
|
||||
type: 'string',
|
||||
pattern: /^survey$/
|
||||
pattern: '^survey$'
|
||||
},
|
||||
token: {
|
||||
type: 'string',
|
||||
description: 'A honeypot.',
|
||||
maxLength: 0
|
||||
},
|
||||
survey_vote: {
|
||||
type: 'boolean',
|
||||
@@ -240,16 +267,21 @@ module.exports = {
|
||||
description: 'The user\'s email address, if the user provided and consented.'
|
||||
}
|
||||
}
|
||||
}, {
|
||||
// *** type: experiment ***
|
||||
}
|
||||
|
||||
const experimentSchema = {
|
||||
additionalProperties: false,
|
||||
required: [
|
||||
'type',
|
||||
'context',
|
||||
'experiment_name',
|
||||
'experiment_variation'
|
||||
],
|
||||
properties: {
|
||||
context,
|
||||
type: {
|
||||
type: 'string',
|
||||
pattern: /^experiment$/
|
||||
pattern: '^experiment$'
|
||||
},
|
||||
experiment_name: {
|
||||
type: 'string',
|
||||
@@ -266,5 +298,16 @@ module.exports = {
|
||||
description: 'Whether or not the user successfully performed the test goal.'
|
||||
}
|
||||
}
|
||||
}]
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
oneOf: [
|
||||
pageSchema,
|
||||
exitSchema,
|
||||
linkSchema,
|
||||
searchSchema,
|
||||
navigateSchema,
|
||||
surveySchema,
|
||||
experimentSchema
|
||||
]
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ const Airtable = require('airtable')
|
||||
const { omit } = require('lodash')
|
||||
const Ajv = require('ajv')
|
||||
const schema = require('../lib/schema-event')
|
||||
const schemaHydro = require('../lib/schema-event-2')
|
||||
|
||||
const TABLE_NAMES = {
|
||||
HELPFULNESS: 'Helpfulness Survey',
|
||||
@@ -15,7 +16,7 @@ const ajv = new Ajv()
|
||||
|
||||
const router = express.Router()
|
||||
|
||||
router.post('/', async (req, res, next) => {
|
||||
async function airtablePost (req, res, next) {
|
||||
const { AIRTABLE_API_KEY, AIRTABLE_BASE_KEY } = process.env
|
||||
if (!AIRTABLE_API_KEY || !AIRTABLE_BASE_KEY) {
|
||||
return res.status(501).send({})
|
||||
@@ -36,6 +37,27 @@ router.post('/', async (req, res, next) => {
|
||||
console.error('unable to POST event', err)
|
||||
return res.status(err.statusCode).send(err)
|
||||
}
|
||||
}
|
||||
|
||||
router.post('/', async (req, res, next) => {
|
||||
// All-caps type is an "Airtable" event
|
||||
if (req.body.type === 'HELPFULNESS' || req.body.type === 'EXPERIMENT') {
|
||||
return airtablePost(req, res, next)
|
||||
}
|
||||
// Remove the condition above when we are no longer sending to Airtable
|
||||
if (!ajv.validate(schemaHydro, req.body)) {
|
||||
if (process.env.NODE_ENV === 'development') console.log(ajv.errorsText())
|
||||
return res.status(400).json({})
|
||||
}
|
||||
const fields = omit(req.body, OMIT_FIELDS)
|
||||
try {
|
||||
const hydroRes = await req.hydro.publish(req.hydro.schemas[req.body.type], fields)
|
||||
if (!hydroRes.ok) return res.status(500).json({})
|
||||
return res.status(201).json(fields)
|
||||
} catch (err) {
|
||||
if (process.env.NODE_ENV === 'development') console.log(err)
|
||||
return res.status(500).json({})
|
||||
}
|
||||
})
|
||||
|
||||
router.put('/:id', async (req, res, next) => {
|
||||
|
||||
@@ -24,6 +24,7 @@ module.exports = function (app) {
|
||||
app.use(require('./cors'))
|
||||
app.use(require('./csp'))
|
||||
app.use(require('helmet')())
|
||||
app.use(require('./req-utils'))
|
||||
app.use(require('./robots'))
|
||||
app.use(require('./cookie-parser'))
|
||||
app.use(require('./csrf'))
|
||||
|
||||
6
middleware/req-utils.js
Normal file
6
middleware/req-utils.js
Normal file
@@ -0,0 +1,6 @@
|
||||
const Hydro = require('../lib/hydro')
|
||||
|
||||
module.exports = (req, res, next) => {
|
||||
req.hydro = new Hydro()
|
||||
return next()
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
const request = require('supertest')
|
||||
const Airtable = require('airtable')
|
||||
const nock = require('nock')
|
||||
const app = require('../../server')
|
||||
|
||||
jest.mock('airtable')
|
||||
@@ -19,17 +20,33 @@ describe('POST /events', () => {
|
||||
beforeEach(async () => {
|
||||
process.env.AIRTABLE_API_KEY = '$AIRTABLE_API_KEY$'
|
||||
process.env.AIRTABLE_BASE_KEY = '$AIRTABLE_BASE_KEY$'
|
||||
process.env.HYDRO_SECRET = '$HYDRO_SECRET$'
|
||||
process.env.HYDRO_ENDPOINT = 'http://example.com/hydro'
|
||||
agent = request.agent(app)
|
||||
const csrfRes = await agent.get('/csrf')
|
||||
csrfToken = csrfRes.body.token
|
||||
nock('http://example.com')
|
||||
.post('/hydro')
|
||||
.reply(200, {})
|
||||
})
|
||||
|
||||
afterEach(() => {
|
||||
delete process.env.AIRTABLE_API_KEY
|
||||
delete process.env.AIRTABLE_BASE_KEY
|
||||
delete process.env.HYDRO_SECRET
|
||||
delete process.env.HYDRO_ENDPOINT
|
||||
csrfToken = ''
|
||||
})
|
||||
|
||||
async function checkEvent (data, code) {
|
||||
return agent
|
||||
.post('/events')
|
||||
.send(data)
|
||||
.set('Accept', 'application/json')
|
||||
.set('csrf-token', csrfToken)
|
||||
.expect(code)
|
||||
}
|
||||
|
||||
describe('HELPFULNESS', () => {
|
||||
const example = {
|
||||
type: 'HELPFULNESS',
|
||||
@@ -41,94 +58,43 @@ describe('POST /events', () => {
|
||||
}
|
||||
|
||||
it('should accept a valid object', () =>
|
||||
agent
|
||||
.post('/events')
|
||||
.send(example)
|
||||
.set('Accept', 'application/json')
|
||||
.set('csrf-token', csrfToken)
|
||||
.expect(201)
|
||||
checkEvent(example, 201)
|
||||
)
|
||||
|
||||
it('should reject extra properties', () =>
|
||||
agent
|
||||
.post('/events')
|
||||
.send({ ...example, toothpaste: false })
|
||||
.set('Accept', 'application/json')
|
||||
|
||||
.set('csrf-token', csrfToken)
|
||||
.expect(400)
|
||||
checkEvent({ ...example, toothpaste: false }, 400)
|
||||
)
|
||||
|
||||
it('should not accept if type is missing', () =>
|
||||
agent
|
||||
.post('/events')
|
||||
.send({ ...example, type: undefined })
|
||||
.set('Accept', 'application/json')
|
||||
.set('csrf-token', csrfToken)
|
||||
.expect(400)
|
||||
checkEvent({ ...example, type: undefined }, 400)
|
||||
)
|
||||
|
||||
it('should not accept if url is missing', () =>
|
||||
agent
|
||||
.post('/events')
|
||||
.send({ ...example, url: undefined })
|
||||
.set('Accept', 'application/json')
|
||||
.set('csrf-token', csrfToken)
|
||||
.expect(400)
|
||||
checkEvent({ ...example, url: undefined }, 400)
|
||||
)
|
||||
|
||||
it('should not accept if url is misformatted', () =>
|
||||
agent
|
||||
.post('/events')
|
||||
.send({ ...example, url: 'examplecom' })
|
||||
.set('Accept', 'application/json')
|
||||
.set('csrf-token', csrfToken)
|
||||
.expect(400)
|
||||
checkEvent({ ...example, url: 'examplecom' }, 400)
|
||||
)
|
||||
|
||||
it('should not accept if vote is missing', () =>
|
||||
agent
|
||||
.post('/events')
|
||||
.send({ ...example, vote: undefined })
|
||||
.set('Accept', 'application/json')
|
||||
.set('csrf-token', csrfToken)
|
||||
.expect(400)
|
||||
checkEvent({ ...example, vote: undefined }, 400)
|
||||
)
|
||||
|
||||
it('should not accept if vote is not boolean', () =>
|
||||
agent
|
||||
.post('/events')
|
||||
.send({ ...example, vote: 'true' })
|
||||
.set('Accept', 'application/json')
|
||||
.set('csrf-token', csrfToken)
|
||||
.expect(400)
|
||||
checkEvent({ ...example, vote: 'true' }, 400)
|
||||
)
|
||||
|
||||
it('should not accept if email is misformatted', () =>
|
||||
agent
|
||||
.post('/events')
|
||||
.send({ ...example, email: 'testexample.com' })
|
||||
.set('Accept', 'application/json')
|
||||
.set('csrf-token', csrfToken)
|
||||
.expect(400)
|
||||
checkEvent({ ...example, email: 'testexample.com' }, 400)
|
||||
)
|
||||
|
||||
it('should not accept if comment is not string', () =>
|
||||
agent
|
||||
.post('/events')
|
||||
.send({ ...example, comment: [] })
|
||||
.set('Accept', 'application/json')
|
||||
.set('csrf-token', csrfToken)
|
||||
.expect(400)
|
||||
checkEvent({ ...example, comment: [] }, 400)
|
||||
)
|
||||
|
||||
it('should not accept if category is not an option', () =>
|
||||
agent
|
||||
.post('/events')
|
||||
.send({ ...example, category: 'Fabulous' })
|
||||
.set('Accept', 'application/json')
|
||||
.set('csrf-token', csrfToken)
|
||||
.expect(400)
|
||||
checkEvent({ ...example, category: 'Fabulous' }, 400)
|
||||
)
|
||||
})
|
||||
|
||||
@@ -142,57 +108,401 @@ describe('POST /events', () => {
|
||||
}
|
||||
|
||||
it('should accept a valid object', () =>
|
||||
agent
|
||||
.post('/events')
|
||||
.send(example)
|
||||
.set('Accept', 'application/json')
|
||||
.set('csrf-token', csrfToken)
|
||||
.expect(201)
|
||||
checkEvent(example, 201)
|
||||
)
|
||||
|
||||
it('should reject extra fields', () =>
|
||||
agent
|
||||
.post('/events')
|
||||
.send({ ...example, toothpaste: false })
|
||||
.set('Accept', 'application/json')
|
||||
.set('csrf-token', csrfToken)
|
||||
.expect(400)
|
||||
checkEvent({ ...example, toothpaste: false }, 400)
|
||||
)
|
||||
|
||||
it('should require a long unique user-id', () =>
|
||||
agent
|
||||
.post('/events')
|
||||
.send({ ...example, 'user-id': 'short' })
|
||||
.set('Accept', 'application/json')
|
||||
.set('csrf-token', csrfToken)
|
||||
.expect(400)
|
||||
checkEvent({ ...example, 'user-id': 'short' }, 400)
|
||||
)
|
||||
|
||||
it('should require a test', () =>
|
||||
agent
|
||||
.post('/events')
|
||||
.send({ ...example, test: undefined })
|
||||
.set('Accept', 'application/json')
|
||||
.set('csrf-token', csrfToken)
|
||||
.expect(400)
|
||||
checkEvent({ ...example, test: undefined }, 400)
|
||||
)
|
||||
|
||||
it('should require a valid group', () =>
|
||||
agent
|
||||
.post('/events')
|
||||
.send({ ...example, group: 'revolution' })
|
||||
.set('Accept', 'application/json')
|
||||
.set('csrf-token', csrfToken)
|
||||
.expect(400)
|
||||
checkEvent({ ...example, group: 'revolution' }, 400)
|
||||
)
|
||||
|
||||
it('should default the success field', () =>
|
||||
agent
|
||||
.post('/events')
|
||||
.send({ ...example, success: undefined })
|
||||
.set('Accept', 'application/json')
|
||||
.set('csrf-token', csrfToken)
|
||||
.expect(201)
|
||||
checkEvent({ ...example, success: undefined }, 201)
|
||||
)
|
||||
})
|
||||
|
||||
const baseExample = {
|
||||
context: {
|
||||
// Primitives
|
||||
event_id: 'a35d7f88-3f48-4f36-ad89-5e3c8ebc3df7',
|
||||
user: '703d32a8-ed0f-45f9-8d78-a913d4dc6f19',
|
||||
version: '1.0.0',
|
||||
created: '2020-10-02T17:12:18.620Z',
|
||||
|
||||
// Content information
|
||||
path: '/github/docs/issues',
|
||||
referrer: 'https://github.com/github/docs',
|
||||
search: '?q=is%3Aissue+is%3Aopen+example+',
|
||||
href: 'https://github.com/github/docs/issues?q=is%3Aissue+is%3Aopen+example+',
|
||||
site_language: 'en',
|
||||
|
||||
// Device information
|
||||
os: 'linux',
|
||||
os_version: '18.04',
|
||||
browser: 'chrome',
|
||||
browser_version: '85.0.4183.121',
|
||||
viewport_width: 1418,
|
||||
viewport_height: 501,
|
||||
|
||||
// Location information
|
||||
timezone: -7,
|
||||
user_language: 'en-US'
|
||||
}
|
||||
}
|
||||
|
||||
describe('page', () => {
|
||||
const pageExample = { ...baseExample, type: 'page' }
|
||||
|
||||
it('should record a page event', () =>
|
||||
checkEvent(pageExample, 201)
|
||||
)
|
||||
|
||||
it('should require a type', () =>
|
||||
checkEvent(baseExample, 400)
|
||||
)
|
||||
|
||||
it('should require an event_id in uuid', () =>
|
||||
checkEvent({
|
||||
...pageExample,
|
||||
context: {
|
||||
...pageExample.context,
|
||||
event_id: 'asdfghjkl'
|
||||
}
|
||||
}, 400)
|
||||
)
|
||||
|
||||
it('should require a user in uuid', () =>
|
||||
checkEvent({
|
||||
...pageExample,
|
||||
context: {
|
||||
...pageExample.context,
|
||||
user: 'asdfghjkl'
|
||||
}
|
||||
}, 400)
|
||||
)
|
||||
|
||||
it('should require a version', () =>
|
||||
checkEvent({
|
||||
...pageExample,
|
||||
context: {
|
||||
...pageExample.context,
|
||||
version: undefined
|
||||
}
|
||||
}, 400)
|
||||
)
|
||||
|
||||
it('should require created timestamp', () =>
|
||||
checkEvent({
|
||||
...pageExample,
|
||||
context: {
|
||||
...pageExample.context,
|
||||
timestamp: 1234
|
||||
}
|
||||
}, 400)
|
||||
)
|
||||
|
||||
it('should not allow a honeypot token', () =>
|
||||
checkEvent({
|
||||
...pageExample,
|
||||
context: {
|
||||
...pageExample.context,
|
||||
token: 'zxcv'
|
||||
}
|
||||
}, 400)
|
||||
)
|
||||
|
||||
it('should path be uri-reference', () =>
|
||||
checkEvent({
|
||||
...pageExample,
|
||||
context: {
|
||||
...pageExample.context,
|
||||
path: ' '
|
||||
}
|
||||
}, 400)
|
||||
)
|
||||
|
||||
it('should referrer be uri-reference', () =>
|
||||
checkEvent({
|
||||
...pageExample,
|
||||
context: {
|
||||
...pageExample.context,
|
||||
referrer: ' '
|
||||
}
|
||||
}, 400)
|
||||
)
|
||||
|
||||
it('should search a string', () =>
|
||||
checkEvent({
|
||||
...pageExample,
|
||||
context: {
|
||||
...pageExample.context,
|
||||
search: 1234
|
||||
}
|
||||
}, 400)
|
||||
)
|
||||
|
||||
it('should href be uri', () =>
|
||||
checkEvent({
|
||||
...pageExample,
|
||||
context: {
|
||||
...pageExample.context,
|
||||
href: '/example'
|
||||
}
|
||||
}, 400)
|
||||
)
|
||||
|
||||
it('should site_language is a valid option', () =>
|
||||
checkEvent({
|
||||
...pageExample,
|
||||
context: {
|
||||
...pageExample.context,
|
||||
site_language: 'nl'
|
||||
}
|
||||
}, 400)
|
||||
)
|
||||
|
||||
it('should a valid os option', () =>
|
||||
checkEvent({
|
||||
...pageExample,
|
||||
context: {
|
||||
...pageExample.context,
|
||||
os: 'ubuntu'
|
||||
}
|
||||
}, 400)
|
||||
)
|
||||
|
||||
it('should os_version a string', () =>
|
||||
checkEvent({
|
||||
...pageExample,
|
||||
context: {
|
||||
...pageExample.context,
|
||||
os_version: 25
|
||||
}
|
||||
}, 400)
|
||||
)
|
||||
|
||||
it('should browser a valid option', () =>
|
||||
checkEvent({
|
||||
...pageExample,
|
||||
context: {
|
||||
...pageExample.context,
|
||||
browser: 'opera'
|
||||
}
|
||||
}, 400)
|
||||
)
|
||||
|
||||
it('should browser_version a string', () =>
|
||||
checkEvent({
|
||||
...pageExample,
|
||||
context: {
|
||||
...pageExample.context,
|
||||
browser_version: 25
|
||||
}
|
||||
}, 400)
|
||||
)
|
||||
|
||||
it('should viewport_width a number', () =>
|
||||
checkEvent({
|
||||
...pageExample,
|
||||
context: {
|
||||
...pageExample.context,
|
||||
viewport_width: -500
|
||||
}
|
||||
}, 400)
|
||||
)
|
||||
|
||||
it('should viewport_height a number', () =>
|
||||
checkEvent({
|
||||
...pageExample,
|
||||
context: {
|
||||
...pageExample.context,
|
||||
viewport_height: '53px'
|
||||
}
|
||||
}, 400)
|
||||
)
|
||||
|
||||
it('should timezone in number', () =>
|
||||
checkEvent({
|
||||
...pageExample,
|
||||
context: {
|
||||
...pageExample.context,
|
||||
timezone: 'GMT-0700'
|
||||
}
|
||||
}, 400)
|
||||
)
|
||||
|
||||
it('should user_language is a string', () =>
|
||||
checkEvent({
|
||||
...pageExample,
|
||||
context: {
|
||||
...pageExample.context,
|
||||
user_language: true
|
||||
}
|
||||
}, 400)
|
||||
)
|
||||
|
||||
it('should page_render_duration is a positive number', () =>
|
||||
checkEvent({
|
||||
...pageExample,
|
||||
page_render_duration: -0.5
|
||||
}, 400)
|
||||
)
|
||||
})
|
||||
|
||||
describe('exit', () => {
|
||||
const exitExample = {
|
||||
...baseExample,
|
||||
type: 'exit',
|
||||
exit_page_id: 'c93c2d16-8e07-43d5-bc3c-eacc999c184d',
|
||||
exit_first_paint: 0.1,
|
||||
exit_dom_interactive: 0.2,
|
||||
exit_dom_complete: 0.3,
|
||||
exit_visit_duration: 5,
|
||||
exit_scroll_length: 0.5
|
||||
}
|
||||
|
||||
it('should record an exit event', () =>
|
||||
checkEvent(exitExample, 201)
|
||||
)
|
||||
|
||||
it('should require exit_page_id', () =>
|
||||
checkEvent({ ...exitExample, exit_page_id: undefined }, 400)
|
||||
)
|
||||
|
||||
it('should require exit_page_id is a uuid', () =>
|
||||
checkEvent({ ...exitExample, exit_page_id: 'afjdskalj' }, 400)
|
||||
)
|
||||
|
||||
it('exit_first_paint is a number', () =>
|
||||
checkEvent({ ...exitExample, exit_first_paint: 'afjdkl' }, 400)
|
||||
)
|
||||
|
||||
it('exit_dom_interactive is a number', () =>
|
||||
checkEvent({ ...exitExample, exit_dom_interactive: '202' }, 400)
|
||||
)
|
||||
|
||||
it('exit_visit_duration is a number', () =>
|
||||
checkEvent({ ...exitExample, exit_visit_duration: '75' }, 400)
|
||||
)
|
||||
|
||||
it('exit_scroll_length is a number between 0 and 1', () =>
|
||||
checkEvent({ ...exitExample, exit_scroll_length: 1.1 }, 400)
|
||||
)
|
||||
})
|
||||
|
||||
describe('link', () => {
|
||||
const linkExample = {
|
||||
...baseExample,
|
||||
type: 'link',
|
||||
link_url: 'https://example.com'
|
||||
}
|
||||
|
||||
it('should send a link event', () =>
|
||||
checkEvent(linkExample, 201)
|
||||
)
|
||||
|
||||
it('link_url is a required uri formatted string', () =>
|
||||
checkEvent({ ...linkExample, link_url: 'foo' }, 400)
|
||||
)
|
||||
})
|
||||
|
||||
describe('search', () => {
|
||||
const searchExample = {
|
||||
...baseExample,
|
||||
type: 'search',
|
||||
search_query: 'github private instances',
|
||||
search_context: 'private'
|
||||
}
|
||||
|
||||
it('should record a search event', () =>
|
||||
checkEvent(searchExample, 201)
|
||||
)
|
||||
|
||||
it('search_query is required string', () =>
|
||||
checkEvent({ ...searchExample, search_query: undefined }, 400)
|
||||
)
|
||||
|
||||
it('search_context is optional string', () =>
|
||||
checkEvent({ ...searchExample, search_context: undefined }, 201)
|
||||
)
|
||||
})
|
||||
|
||||
describe('navigate', () => {
|
||||
const navigateExample = {
|
||||
...baseExample,
|
||||
type: 'navigate',
|
||||
navigate_label: 'drop down'
|
||||
}
|
||||
|
||||
it('should record a navigate event', () =>
|
||||
checkEvent(navigateExample, 201)
|
||||
)
|
||||
|
||||
it('navigate_label is optional string', () =>
|
||||
checkEvent({ ...navigateExample, navigate_label: undefined }, 201)
|
||||
)
|
||||
})
|
||||
|
||||
describe('survey', () => {
|
||||
const surveyExample = {
|
||||
...baseExample,
|
||||
type: 'survey',
|
||||
survey_vote: true,
|
||||
survey_comment: 'I love this site.',
|
||||
survey_email: 'daisy@example.com'
|
||||
}
|
||||
|
||||
it('should record a survey event', () =>
|
||||
checkEvent(surveyExample, 201)
|
||||
)
|
||||
|
||||
it('survey_vote is boolean', () =>
|
||||
checkEvent({ ...surveyExample, survey_vote: undefined }, 400)
|
||||
)
|
||||
|
||||
it('survey_comment is string', () => {
|
||||
checkEvent({ ...surveyExample, survey_comment: 1234 }, 400)
|
||||
})
|
||||
|
||||
it('survey_email is email', () => {
|
||||
checkEvent({ ...surveyExample, survey_email: 'daisy' }, 400)
|
||||
})
|
||||
})
|
||||
|
||||
describe('experiment', () => {
|
||||
const experimentExample = {
|
||||
...baseExample,
|
||||
type: 'experiment',
|
||||
experiment_name: 'change-button-copy',
|
||||
experiment_variation: 'treatment',
|
||||
experiment_success: true
|
||||
}
|
||||
|
||||
it('should record an experiment event', () =>
|
||||
checkEvent(experimentExample, 201)
|
||||
)
|
||||
|
||||
it('experiment_name is required string', () =>
|
||||
checkEvent({ ...experimentExample, experiment_name: undefined }, 400)
|
||||
)
|
||||
|
||||
it('experiment_variation is required string', () =>
|
||||
checkEvent({ ...experimentExample, experiment_variation: undefined }, 400)
|
||||
)
|
||||
|
||||
it('experiment_success is optional boolean', () =>
|
||||
checkEvent({ ...experimentExample, experiment_success: undefined }, 201)
|
||||
)
|
||||
})
|
||||
})
|
||||
|
||||
@@ -40,6 +40,12 @@ describe('REST references docs', () => {
|
||||
expect(operation.description).toContain('GitHub Enterprise')
|
||||
})
|
||||
|
||||
test('loads operations enabled for GitHub Apps', async () => {
|
||||
const operations = await getJSON('/en/free-pro-team@latest/rest/overview/endpoints-available-for-github-apps?json=rest.operationsEnabledForGitHubApps')
|
||||
expect(operations['free-pro-team@latest'].actions.length).toBeGreaterThan(0)
|
||||
expect(operations['enterprise-server@2.22'].actions.length).toBeGreaterThan(0)
|
||||
})
|
||||
|
||||
test('no wrongly detected AppleScript syntax highlighting in schema data', async () => {
|
||||
const { operations } = require('../../lib/rest')
|
||||
expect(JSON.stringify(operations).includes('hljs language-applescript')).toBe(false)
|
||||
|
||||
@@ -19,17 +19,23 @@ function actionsUsedInWorkflow (workflow) {
|
||||
.map(key => get(workflow, key))
|
||||
}
|
||||
|
||||
describe('GitHub Actions workflows', () => {
|
||||
test('only use allowed actions from ./github/allow-actions.json', async () => {
|
||||
const allUsedActions = chain(workflows)
|
||||
const allUsedActions = chain(workflows)
|
||||
.map(actionsUsedInWorkflow)
|
||||
.flatten()
|
||||
.uniq()
|
||||
.sort()
|
||||
.value()
|
||||
|
||||
expect(allowedActions.length).toBeGreaterThan(0)
|
||||
describe('GitHub Actions workflows', () => {
|
||||
test('all used actions are allowed in .github/allowed-actions.js', () => {
|
||||
expect(allUsedActions.length).toBeGreaterThan(0)
|
||||
expect(difference(allowedActions, allUsedActions)).toEqual([])
|
||||
const unusedActions = difference(allowedActions, allUsedActions)
|
||||
expect(unusedActions).toEqual([])
|
||||
})
|
||||
|
||||
test('all allowed actions by .github/allowed-actions.js are used by at least one workflow', () => {
|
||||
expect(allowedActions.length).toBeGreaterThan(0)
|
||||
const disallowedActions = difference(allUsedActions, allowedActions)
|
||||
expect(disallowedActions).toEqual([])
|
||||
})
|
||||
})
|
||||
|
||||
@@ -11,18 +11,22 @@ describe('hydro', () => {
|
||||
reqheaders: {
|
||||
Authorization: /^Hydro [\d\w]{64}$/,
|
||||
'Content-Type': 'application/json',
|
||||
'X-Hydro-App': 'docs'
|
||||
'X-Hydro-App': 'docs-production'
|
||||
}
|
||||
})
|
||||
// Respond with a 201 and store the body we sent
|
||||
.post('/').reply(201, (_, body) => { params = body })
|
||||
// Respond with a 200 and store the body we sent
|
||||
.post('/').reply(200, (_, body) => { params = body })
|
||||
})
|
||||
|
||||
describe('#publish', () => {
|
||||
it('publishes a single event to Hydro', async () => {
|
||||
await hydro.publish('event-name', { pizza: true })
|
||||
expect(params).toEqual({
|
||||
events: [{ schema: 'event-name', value: { pizza: true } }]
|
||||
events: [{
|
||||
schema: 'event-name',
|
||||
value: JSON.stringify({ pizza: true }),
|
||||
cluster: 'potomac'
|
||||
}]
|
||||
})
|
||||
})
|
||||
})
|
||||
@@ -35,10 +39,15 @@ describe('hydro', () => {
|
||||
])
|
||||
|
||||
expect(params).toEqual({
|
||||
events: [
|
||||
{ schema: 'event-name', value: { pizza: true } },
|
||||
{ schema: 'other-name', value: { salad: false } }
|
||||
]
|
||||
events: [{
|
||||
schema: 'event-name',
|
||||
value: JSON.stringify({ pizza: true }),
|
||||
cluster: 'potomac'
|
||||
}, {
|
||||
schema: 'other-name',
|
||||
value: JSON.stringify({ salad: false }),
|
||||
cluster: 'potomac'
|
||||
}]
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
@@ -1,279 +0,0 @@
|
||||
# Content
|
||||
|
||||
The `/content` directory is where all the site's (English) Markdown content lives!
|
||||
|
||||
See the [Markup Reference Guide](https://github.com/github/product-documentation/blob/master/doc-team-workflows/workflow-information-for-all-writers/markup-reference.md) in the `product-documentation` repo for more info about supported Markdown features.
|
||||
|
||||
See the top-level [README](../README.md) for general info about how the site works.
|
||||
|
||||
- [Frontmatter](#frontmatter)
|
||||
- [`hidden`](#hidden)
|
||||
- [`productVersions`](#productversions)
|
||||
- [`redirect_from`](#redirect_from)
|
||||
- [`title`](#title)
|
||||
- [`intro`](#intro)
|
||||
- [`layout`](#layout)
|
||||
- [`mapTopic`](#maptopic)
|
||||
- [Escaping single quotes](#escaping-single-quotes)
|
||||
- [Index Pages](#index-pages)
|
||||
- [Dotcom index page](#dotcom-index-page)
|
||||
- [Hidden Pages](#hidden-pages)
|
||||
- [Category Pages](#category-pages)
|
||||
- [Map Topic Pages](#map-topic-pages)
|
||||
- [Versioning](#versioning)
|
||||
- [Filenames](#filenames)
|
||||
- [Whitespace Control](#whitespace-control)
|
||||
- [Links and image paths](#links-and-image-paths)
|
||||
|
||||
## Frontmatter
|
||||
|
||||
[YAML Frontmatter](https://jekyllrb.com/docs/front-matter/) is an authoring convention popularized by Jekyll that provides a way to add metadata to pages. It is a block of key-value content that lives at the top of every Markdown file. The following frontmatter values have special meanings and requirements for this site:
|
||||
|
||||
### `hidden`
|
||||
|
||||
- Purpose: Indicates whether a page should be excluded from searches, crawlers, TOCs, etc. See [Hidden Pages](#hidden-pages) for more info.
|
||||
- Type: `Boolean`. Default is `false`.
|
||||
|
||||
### `productVersions`
|
||||
|
||||
- Purpose: Indicates the products and product versions to which a page applies. See [Versioning](#versioning) for more info.
|
||||
- Type: `Object`. Allowable keys are `dotcom` and `enterprise`
|
||||
- This frontmatter value is currently **required** for all pages.
|
||||
|
||||
Example that applies to GitHub.com and recent versions of GitHub Enterprise:
|
||||
|
||||
```yml
|
||||
title: About your personal dashboard
|
||||
productVersions:
|
||||
dotcom: '*'
|
||||
enterprise: '>=2.14'
|
||||
```
|
||||
|
||||
Example that applies to all supported versions of GitHub enterprise (but not GitHub.com):
|
||||
|
||||
```yml
|
||||
title: Downloading your license
|
||||
productVersions:
|
||||
enterprise: '*'
|
||||
```
|
||||
|
||||
Note: `dotcom` is an evergreen product without versions, so the `*` is used to denote all versions.
|
||||
|
||||
### `redirect_from`
|
||||
|
||||
- Purpose: List URLs that should redirect to this page.
|
||||
- Type: `Array` (for multiple redirects) or `String` (for just one)
|
||||
- 任意
|
||||
|
||||
Example with multiple redirects:
|
||||
|
||||
```yml
|
||||
title: Getting Started with GitHub Desktop
|
||||
redirect_from:
|
||||
- /articles/first-launch/
|
||||
- /articles/error-github-enterprise-version-is-too-old/
|
||||
- /articles/getting-started-with-github-for-windows/
|
||||
```
|
||||
|
||||
Example with a single redirect:
|
||||
|
||||
```yml
|
||||
title: Denying access to a previously approved OAuth App for your organization
|
||||
redirect_from: /articles/denying-access-to-a-previously-approved-application-for-your-organization/
|
||||
```
|
||||
|
||||
See [README#redirects](../README#redirects) for more info.
|
||||
|
||||
### `title`
|
||||
|
||||
- Purpose: Set a human-friendly title for use in the rendered page's `<title>` tag and an `h1` element at the top of the page.
|
||||
- Type: `String`
|
||||
- Optional. If omitted, the page `<title>` will still be set, albeit with a generic value like `GitHub.com` or `GitHub Entperprise`.
|
||||
|
||||
### `intro`
|
||||
|
||||
- Purpose: Sets the intro for the article.
|
||||
- Type: `String`
|
||||
- Optional.
|
||||
|
||||
### `layout`
|
||||
|
||||
- Purpose: Wrap the page in a custom HTML layout.
|
||||
- Type: `String` that matches the name of the layout file, without an extension. For a layout named `layouts/article.html`, the value would be `article`.
|
||||
- Optional. If omitted, `layouts/default.html` is used.
|
||||
|
||||
### `mapTopic`
|
||||
|
||||
- Purpose: Indicates whether a page is a map topic. See [Map Topic Pages](#map-topic-pages) for more info.
|
||||
- Type: `Boolean`. Default is `false`.
|
||||
- Optional.
|
||||
|
||||
### Escaping single quotes
|
||||
|
||||
If you see two single quotes in a row (`''`) in YML frontmatter where you might expect to see one (`'`), this is the YML-preferred way to escape a single quote. From [the YAML spec](https://yaml.org/spec/history/2001-12-10.html):
|
||||
|
||||
> In single quoted leaves, a single quote character needs to be escaped. This is done by repeating the character.
|
||||
|
||||
As an alternative, you can change the single quotes surrounding the frontmatter field to double quotes and leave interior single quotes unescaped.
|
||||
|
||||
## Index Pages
|
||||
|
||||
Index pages are written in Markdown, and are always named `index.md`. They exist as landing pages dedicated to specific GitHub products or topical groupings of articles. Each index page contains a Table of Contents (TOC) with links to articles.
|
||||
|
||||
Product indexes:
|
||||
|
||||
| Filename | URL Path | 目的 |
|
||||
| ---------------------------- | ------------------------------------------------------------- | -------------------------------------------- |
|
||||
| `/index.md` | [/](https://help.github.com/) | GitHub.com and GitHub Enterprise "User" Docs |
|
||||
| `/enterprise/index.md` | [/enterprise](https://help.github.com/enterprise) | GitHub Enterprise |
|
||||
| `/enterprise/admin/index.md` | [/enterprise/admin](https://help.github.com/enterprise/admin) | Enterprise Admin |
|
||||
| `/desktop/index.md` | [/desktop](https://help.github.com/desktop) | Desktop |
|
||||
|
||||
GitHub Enterprise Admin also has index pages:
|
||||
|
||||
| Filename | URL Path | 目的 |
|
||||
| ----------------------------------------------- | --------------------------------------------------------------------------------------------------- | ------------------ |
|
||||
| `/enterprise/admin/clustering/index.md` | [/enterprise/admin/clustering](https://help.github.com/enterprise/admin/clustering) | Clustering |
|
||||
| `/enterprise/admin/developer-workflow/index.md` | [/enterprise/admin/developer-workflow](https://help.github.com/enterprise/admin/developer-workflow) | Developer Workflow |
|
||||
| `/enterprise/admin/enterprise-support/index.md` | [/enterprise/admin/enterprise-support](https://help.github.com/enterprise/admin/enterprise-support) | Enterprise Support |
|
||||
| `/enterprise/admin/installation/index.md` | [/enterprise/admin/installation](https://help.github.com/enterprise/admin/installation) | Installation |
|
||||
| `/enterprise/admin/migrations/index.md` | [/enterprise/admin/migrations](https://help.github.com/enterprise/admin/migrations) | Migrations |
|
||||
| `/enterprise/admin/user-management/index.md` | [/enterprise/admin/user-management](https://help.github.com/enterprise/admin/user-management) | ユーザ管理 |
|
||||
|
||||
See <enterprise/admin/README.md> for details on how guides should be written.
|
||||
|
||||
Desktop guides also have index pages:
|
||||
|
||||
| Filename | URL Path | 目的 |
|
||||
| ---------------------------------------------- | ------------------------------------------------------------------------------------------------------------------- | ----------------------------------- |
|
||||
| `/desktop/contributing-to-projects` | [/desktop/contributing-to-projects](https://help.github.com/desktop/contributing-to-projects) | Contributing to Projects |
|
||||
| `/desktop/getting-started-with-github-desktop` | [/desktop/getting-started-with-github-desktop](https://help.github.com/desktop/getting-started-with-github-desktop) | Getting Started with GitHub Desktop |
|
||||
|
||||
**Note**: All links to GitHub Desktop Classic (such as `https://help.github.com/desktop-classic`) now redirect to https://desktop.github.com.
|
||||
|
||||
### Dotcom index page
|
||||
|
||||
The file `content/index.md` is rendered as a long TOC on the https://help.github.com homepage.
|
||||
|
||||
The formatting of this file must adhere to a specific structure in order for the site to render the page properly and create automatic links to articles:
|
||||
|
||||
| Content type | Formatting | サンプル |
|
||||
| ----------------------------- | ---------- | ------------------------------------ |
|
||||
| [Category](#category-pages) | `h2` | `## Bootcamp` |
|
||||
| [Map topic](#map-topic-pages) | `h3` | `### Managing user account settings` |
|
||||
| Article | List item | `- Set up git` |
|
||||
|
||||
See [Whitespace Control](#whitespace-control) for info on using Liquid conditionals within TOC lists.
|
||||
|
||||
## Hidden Pages
|
||||
|
||||
Hidden pages are publicly accessible but excluded from the search index, and they're not linked to by any other pages.
|
||||
|
||||
In development, you can view a list of all hidden pages by visiting [localhost:4000/hidden](http://localhost:4000/hidden). Note, however, that this page is not available in production.
|
||||
|
||||
To make a page hidden, add `hidden: true` to its YAML frontmatter.
|
||||
|
||||
## Category Pages
|
||||
|
||||
Category pages are only found in Dotcom docs (e.g., https://help.github.com/categories/bootcamp). The content displayed on these pages is autogenerated from the category's parent [index page](#dotcom-index-pages), where the name of the category is an `h2`.
|
||||
|
||||
Every category in the index page must have a corresponding placeholder file in `content/dotcom/categories` ending in `.md`. You can add redirects to the placeholder files.
|
||||
|
||||
## Map Topic Pages
|
||||
|
||||
Map topics are found in Dotcom, Enterprise Admin, and Desktop docs. The content displayed on these pages is autogenerated from each map topic's parent [index page](#index-pages). Map topic files live alongside article files.
|
||||
|
||||
To make a page a map topic, add `mapTopic: true` to its YAML frontmatter and leave the rest of the file empty.
|
||||
|
||||
## Versioning
|
||||
|
||||
Versioning for any content file lives in **two** places:
|
||||
|
||||
- The file's [`productVersions`](#productversions) frontmatter.
|
||||
- Liquid conditionals in the file's parent [index page](#index-pages).
|
||||
|
||||
For example, an article with this frontmatter:
|
||||
|
||||
```yml
|
||||
title: About your personal dashboard
|
||||
productVersions:
|
||||
dotcom: '*'
|
||||
enterprise: '>=2.14'
|
||||
```
|
||||
|
||||
should be referenced in the parent index page like this:
|
||||
{%- if page.version == 'dotcom' or page.version ver_gt "2.13" %}
|
||||
- About your personal dashboard
|
||||
{%- endif %}
|
||||
## Filenames
|
||||
|
||||
The site automatically creates links to articles in index pages. For example, this block in `content/index.md`:
|
||||
|
||||
## Bootcamp
|
||||
|
||||
- Set up git
|
||||
- Create a repo
|
||||
- Fork a repo
|
||||
- Be social
|
||||
|
||||
|
||||
renders with links to each article.
|
||||
|
||||
If you're adding a new article, make sure the filename is a [kebab-cased](https://en.wikipedia.org/wiki/Letter_case#Special_case_styles) version of the title you use in both the article and the parent index. This can get tricky when a title has punctuation (such as "GitHub's Billing Plans"). If you're not sure what the filename should be based on the title, you can find out by adding the title to the TOC. 例:
|
||||
|
||||
## Bootcamp
|
||||
|
||||
- Set up git
|
||||
- Create a repo
|
||||
- Fork a repo
|
||||
- Be social
|
||||
- I'm a new article
|
||||
|
||||
|
||||
Then just run the site locally and see what the link is. In this example, the filename would be: `im-a-new-article`
|
||||
|
||||
## Whitespace Control
|
||||
|
||||
When using Liquid conditionals in lists or tables, you can use [whitespace control](https://shopify.github.io/liquid/basics/whitespace/) characters to prevent the addition of newlines that would break the list or table rendering.
|
||||
|
||||
Just add a hyphen on either the left, right, or both sides to indicate that there should be no newline on that side. For example, this statement removes a newline on the left side:
|
||||
{%- if page.version == 'dotcom' %}
|
||||
These characters are especially important in [index pages](#index-pages) comprised of list items.
|
||||
|
||||
## Links and image paths
|
||||
|
||||
Any local links (like those starting with `/articles/`) and image paths (starting with `/assets`) that you include in content and data files will undergo some transformations on the server side to match the current page's language and Enterprise version (if applicable). The handling for these transformations lives in [`lib/rewrite-local-links`](lib/rewrite-local-links.js) and [`lib/rewrite-asset-paths-to-s3`](lib/rewrite-asset-paths-to-s3.js).
|
||||
|
||||
For example, if you include the following link in a content file:
|
||||
|
||||
/articles/creating-a-saved-reply
|
||||
|
||||
|
||||
When viewed on Dotcom, the link gets rendered with the language code:
|
||||
|
||||
/en/articles/creating-a-saved-reply
|
||||
|
||||
|
||||
and when viewed on GHE, the version is included as well:
|
||||
|
||||
/en/enterprise/2.16/user/articles/creating-a-saved-reply
|
||||
|
||||
|
||||
The transformation is a little simpler for image paths. If you include the following image path in a content file:
|
||||
|
||||
/assets/images/help/profile/follow-user-button.png
|
||||
|
||||
|
||||
when viewed on GHE, the path gets rewritten to include S3:
|
||||
|
||||
https://github-images.s3.amazonaws.com/enterprise/2.16/assets/images/help/profile/follow-user-button.png
|
||||
|
||||
|
||||
### Preventing transformations
|
||||
|
||||
Sometimes you want to link to a Dotcom-only article in Enterprise content and you don't want the link to be Enterprise-ified. To prevent the transformation, write the link using HTML and add a class of `dotcom-only`. 例:
|
||||
|
||||
<a href="/articles/github-terms-of-service/" class="dotcom-only">GitHub's Terms of Service</a>
|
||||
|
||||
|
||||
Sometimes the canonical home of content moves outside the help site. None of the links included in [`lib/external-redirects.json`](lib/external-redirects.json) get rewritten. See the top-level [README](../README.md#external-redirects) for more info about this type of redirect.
|
||||
@@ -1,279 +0,0 @@
|
||||
# Content
|
||||
|
||||
The `/content` directory is where all the site's (English) Markdown content lives!
|
||||
|
||||
See the [Markup Reference Guide](https://github.com/github/product-documentation/blob/master/doc-team-workflows/workflow-information-for-all-writers/markup-reference.md) in the `product-documentation` repo for more info about supported Markdown features.
|
||||
|
||||
See the top-level [README](../README.md) for general info about how the site works.
|
||||
|
||||
- [Frontmatter](#frontmatter)
|
||||
- [`hidden`](#hidden)
|
||||
- [`productVersions`](#productversions)
|
||||
- [`redirect_from`](#redirect_from)
|
||||
- [`title`](#title)
|
||||
- [`intro`](#intro)
|
||||
- [`layout`](#layout)
|
||||
- [`mapTopic`](#maptopic)
|
||||
- [Escaping single quotes](#escaping-single-quotes)
|
||||
- [Index Pages](#index-pages)
|
||||
- [Dotcom index page](#dotcom-index-page)
|
||||
- [Hidden Pages](#hidden-pages)
|
||||
- [Category Pages](#category-pages)
|
||||
- [Map Topic Pages](#map-topic-pages)
|
||||
- [Versioning](#versioning)
|
||||
- [Filenames](#filenames)
|
||||
- [Whitespace Control](#whitespace-control)
|
||||
- [Links and image paths](#links-and-image-paths)
|
||||
|
||||
## Frontmatter
|
||||
|
||||
[YAML Frontmatter](https://jekyllrb.com/docs/front-matter/) is an authoring convention popularized by Jekyll that provides a way to add metadata to pages. It is a block of key-value content that lives at the top of every Markdown file. The following frontmatter values have special meanings and requirements for this site:
|
||||
|
||||
### `hidden`
|
||||
|
||||
- Purpose: Indicates whether a page should be excluded from searches, crawlers, TOCs, etc. See [Hidden Pages](#hidden-pages) for more info.
|
||||
- Type: `Boolean`. Default is `false`.
|
||||
|
||||
### `productVersions`
|
||||
|
||||
- Purpose: Indicates the products and product versions to which a page applies. See [Versioning](#versioning) for more info.
|
||||
- Type: `Object`. Allowable keys are `dotcom` and `enterprise`
|
||||
- This frontmatter value is currently **required** for all pages.
|
||||
|
||||
Example that applies to GitHub.com and recent versions of GitHub Enterprise:
|
||||
|
||||
```yml
|
||||
title: About your personal dashboard
|
||||
productVersions:
|
||||
dotcom: '*'
|
||||
enterprise: '>=2.14'
|
||||
```
|
||||
|
||||
Example that applies to all supported versions of GitHub enterprise (but not GitHub.com):
|
||||
|
||||
```yml
|
||||
title: Downloading your license
|
||||
productVersions:
|
||||
enterprise: '*'
|
||||
```
|
||||
|
||||
Note: `dotcom` is an evergreen product without versions, so the `*` is used to denote all versions.
|
||||
|
||||
### `redirect_from`
|
||||
|
||||
- Purpose: List URLs that should redirect to this page.
|
||||
- Type: `Array` (for multiple redirects) or `String` (for just one)
|
||||
- Optional
|
||||
|
||||
Example with multiple redirects:
|
||||
|
||||
```yml
|
||||
title: Getting Started with GitHub Desktop
|
||||
redirect_from:
|
||||
- /articles/first-launch/
|
||||
- /articles/error-github-enterprise-version-is-too-old/
|
||||
- /articles/getting-started-with-github-for-windows/
|
||||
```
|
||||
|
||||
Example with a single redirect:
|
||||
|
||||
```yml
|
||||
title: Denying access to a previously approved OAuth App for your organization
|
||||
redirect_from: /articles/denying-access-to-a-previously-approved-application-for-your-organization/
|
||||
```
|
||||
|
||||
See [README#redirects](../README#redirects) for more info.
|
||||
|
||||
### `title`
|
||||
|
||||
- Purpose: Set a human-friendly title for use in the rendered page's `<title>` tag and an `h1` element at the top of the page.
|
||||
- Type: `String`
|
||||
- Optional. If omitted, the page `<title>` will still be set, albeit with a generic value like `GitHub.com` or `GitHub Entperprise`.
|
||||
|
||||
### `intro`
|
||||
|
||||
- Purpose: Sets the intro for the article.
|
||||
- Type: `String`
|
||||
- Optional.
|
||||
|
||||
### `layout`
|
||||
|
||||
- Purpose: Wrap the page in a custom HTML layout.
|
||||
- Type: `String` that matches the name of the layout file, without an extension. For a layout named `layouts/article.html`, the value would be `article`.
|
||||
- Optional. If omitted, `layouts/default.html` is used.
|
||||
|
||||
### `mapTopic`
|
||||
|
||||
- Purpose: Indicates whether a page is a map topic. See [Map Topic Pages](#map-topic-pages) for more info.
|
||||
- Type: `Boolean`. Default is `false`.
|
||||
- Optional.
|
||||
|
||||
### Escaping single quotes
|
||||
|
||||
If you see two single quotes in a row (`''`) in YML frontmatter where you might expect to see one (`'`), this is the YML-preferred way to escape a single quote. From [the YAML spec](https://yaml.org/spec/history/2001-12-10.html):
|
||||
|
||||
> In single quoted leaves, a single quote character needs to be escaped. This is done by repeating the character.
|
||||
|
||||
As an alternative, you can change the single quotes surrounding the frontmatter field to double quotes and leave interior single quotes unescaped.
|
||||
|
||||
## Index Pages
|
||||
|
||||
Index pages are written in Markdown, and are always named `index.md`. They exist as landing pages dedicated to specific GitHub products or topical groupings of articles. Each index page contains a Table of Contents (TOC) with links to articles.
|
||||
|
||||
Product indexes:
|
||||
|
||||
| Filename | URL Path | Purpose |
|
||||
| ---------------------------- | ------------------------------------------------------------- | -------------------------------------------- |
|
||||
| `/index.md` | [/](https://help.github.com/) | GitHub.com and GitHub Enterprise "User" Docs |
|
||||
| `/enterprise/index.md` | [/enterprise](https://help.github.com/enterprise) | GitHub Enterprise |
|
||||
| `/enterprise/admin/index.md` | [/enterprise/admin](https://help.github.com/enterprise/admin) | Enterprise Admin |
|
||||
| `/desktop/index.md` | [/desktop](https://help.github.com/desktop) | Desktop |
|
||||
|
||||
GitHub Enterprise Admin also has index pages:
|
||||
|
||||
| Filename | URL Path | Purpose |
|
||||
| ----------------------------------------------- | --------------------------------------------------------------------------------------------------- | ------------------ |
|
||||
| `/enterprise/admin/clustering/index.md` | [/enterprise/admin/clustering](https://help.github.com/enterprise/admin/clustering) | Clustering |
|
||||
| `/enterprise/admin/developer-workflow/index.md` | [/enterprise/admin/developer-workflow](https://help.github.com/enterprise/admin/developer-workflow) | Developer Workflow |
|
||||
| `/enterprise/admin/enterprise-support/index.md` | [/enterprise/admin/enterprise-support](https://help.github.com/enterprise/admin/enterprise-support) | Enterprise Support |
|
||||
| `/enterprise/admin/installation/index.md` | [/enterprise/admin/installation](https://help.github.com/enterprise/admin/installation) | Installation |
|
||||
| `/enterprise/admin/migrations/index.md` | [/enterprise/admin/migrations](https://help.github.com/enterprise/admin/migrations) | Migrations |
|
||||
| `/enterprise/admin/user-management/index.md` | [/enterprise/admin/user-management](https://help.github.com/enterprise/admin/user-management) | User Management |
|
||||
|
||||
See <enterprise/admin/README.md> for details on how guides should be written.
|
||||
|
||||
Desktop guides also have index pages:
|
||||
|
||||
| Filename | URL Path | Purpose |
|
||||
| ---------------------------------------------- | ------------------------------------------------------------------------------------------------------------------- | ----------------------------------- |
|
||||
| `/desktop/contributing-to-projects` | [/desktop/contributing-to-projects](https://help.github.com/desktop/contributing-to-projects) | Contributing to Projects |
|
||||
| `/desktop/getting-started-with-github-desktop` | [/desktop/getting-started-with-github-desktop](https://help.github.com/desktop/getting-started-with-github-desktop) | Getting Started with GitHub Desktop |
|
||||
|
||||
**Note**: All links to GitHub Desktop Classic (such as `https://help.github.com/desktop-classic`) now redirect to https://desktop.github.com.
|
||||
|
||||
### Dotcom index page
|
||||
|
||||
The file `content/index.md` is rendered as a long TOC on the https://help.github.com homepage.
|
||||
|
||||
The formatting of this file must adhere to a specific structure in order for the site to render the page properly and create automatic links to articles:
|
||||
|
||||
| Content type | Formatting | Example |
|
||||
| ----------------------------- | ---------- | ------------------------------------ |
|
||||
| [Category](#category-pages) | `h2` | `## Bootcamp` |
|
||||
| [Map topic](#map-topic-pages) | `h3` | `### Managing user account settings` |
|
||||
| Article | List item | `- Set up git` |
|
||||
|
||||
See [Whitespace Control](#whitespace-control) for info on using Liquid conditionals within TOC lists.
|
||||
|
||||
## Hidden Pages
|
||||
|
||||
Hidden pages are publicly accessible but excluded from the search index, and they're not linked to by any other pages.
|
||||
|
||||
In development, you can view a list of all hidden pages by visiting [localhost:4000/hidden](http://localhost:4000/hidden). Note, however, that this page is not available in production.
|
||||
|
||||
To make a page hidden, add `hidden: true` to its YAML frontmatter.
|
||||
|
||||
## Category Pages
|
||||
|
||||
Category pages are only found in Dotcom docs (e.g., https://help.github.com/categories/bootcamp). The content displayed on these pages is autogenerated from the category's parent [index page](#dotcom-index-pages), where the name of the category is an `h2`.
|
||||
|
||||
Every category in the index page must have a corresponding placeholder file in `content/dotcom/categories` ending in `.md`. You can add redirects to the placeholder files.
|
||||
|
||||
## Map Topic Pages
|
||||
|
||||
Map topics are found in Dotcom, Enterprise Admin, and Desktop docs. The content displayed on these pages is autogenerated from each map topic's parent [index page](#index-pages). Map topic files live alongside article files.
|
||||
|
||||
To make a page a map topic, add `mapTopic: true` to its YAML frontmatter and leave the rest of the file empty.
|
||||
|
||||
## Versioning
|
||||
|
||||
Versioning for any content file lives in **two** places:
|
||||
|
||||
- The file's [`productVersions`](#productversions) frontmatter.
|
||||
- Liquid conditionals in the file's parent [index page](#index-pages).
|
||||
|
||||
For example, an article with this frontmatter:
|
||||
|
||||
```yml
|
||||
title: About your personal dashboard
|
||||
productVersions:
|
||||
dotcom: '*'
|
||||
enterprise: '>=2.14'
|
||||
```
|
||||
|
||||
should be referenced in the parent index page like this:
|
||||
{%- if page.version == 'dotcom' or page.version ver_gt "2.13" %}
|
||||
- About your personal dashboard
|
||||
{%- endif %}
|
||||
## Filenames
|
||||
|
||||
The site automatically creates links to articles in index pages. For example, this block in `content/index.md`:
|
||||
|
||||
## Bootcamp
|
||||
|
||||
- Set up git
|
||||
- Create a repo
|
||||
- Fork a repo
|
||||
- Be social
|
||||
|
||||
|
||||
renders with links to each article.
|
||||
|
||||
If you're adding a new article, make sure the filename is a [kebab-cased](https://en.wikipedia.org/wiki/Letter_case#Special_case_styles) version of the title you use in both the article and the parent index. This can get tricky when a title has punctuation (such as "GitHub's Billing Plans"). If you're not sure what the filename should be based on the title, you can find out by adding the title to the TOC. For example:
|
||||
|
||||
## Bootcamp
|
||||
|
||||
- Set up git
|
||||
- Create a repo
|
||||
- Fork a repo
|
||||
- Be social
|
||||
- I'm a new article
|
||||
|
||||
|
||||
Then just run the site locally and see what the link is. In this example, the filename would be: `im-a-new-article`
|
||||
|
||||
## Whitespace Control
|
||||
|
||||
When using Liquid conditionals in lists or tables, you can use [whitespace control](https://shopify.github.io/liquid/basics/whitespace/) characters to prevent the addition of newlines that would break the list or table rendering.
|
||||
|
||||
Just add a hyphen on either the left, right, or both sides to indicate that there should be no newline on that side. For example, this statement removes a newline on the left side:
|
||||
{%- if page.version == 'dotcom' %}
|
||||
These characters are especially important in [index pages](#index-pages) comprised of list items.
|
||||
|
||||
## Links and image paths
|
||||
|
||||
Any local links (like those starting with `/articles/`) and image paths (starting with `/assets`) that you include in content and data files will undergo some transformations on the server side to match the current page's language and Enterprise version (if applicable). The handling for these transformations lives in [`lib/rewrite-local-links`](lib/rewrite-local-links.js) and [`lib/rewrite-asset-paths-to-s3`](lib/rewrite-asset-paths-to-s3.js).
|
||||
|
||||
For example, if you include the following link in a content file:
|
||||
|
||||
/articles/creating-a-saved-reply
|
||||
|
||||
|
||||
When viewed on Dotcom, the link gets rendered with the language code:
|
||||
|
||||
/en/articles/creating-a-saved-reply
|
||||
|
||||
|
||||
and when viewed on GHE, the version is included as well:
|
||||
|
||||
/en/enterprise/2.16/user/articles/creating-a-saved-reply
|
||||
|
||||
|
||||
The transformation is a little simpler for image paths. If you include the following image path in a content file:
|
||||
|
||||
/assets/images/help/profile/follow-user-button.png
|
||||
|
||||
|
||||
when viewed on GHE, the path gets rewritten to include S3:
|
||||
|
||||
https://github-images.s3.amazonaws.com/enterprise/2.16/assets/images/help/profile/follow-user-button.png
|
||||
|
||||
|
||||
### Preventing transformations
|
||||
|
||||
Sometimes you want to link to a Dotcom-only article in Enterprise content and you don't want the link to be Enterprise-ified. To prevent the transformation, write the link using HTML and add a class of `dotcom-only`. For example:
|
||||
|
||||
<a href="/articles/github-terms-of-service/" class="dotcom-only">GitHub's Terms of Service</a>
|
||||
|
||||
|
||||
Sometimes the canonical home of content moves outside the help site. None of the links included in [`lib/external-redirects.json`](lib/external-redirects.json) get rewritten. See the top-level [README](../README.md#external-redirects) for more info about this type of redirect.
|
||||
Reference in New Issue
Block a user