Merge branch 'main' into patch-1
This commit is contained in:
@@ -294,6 +294,24 @@
|
||||
"contributions": [
|
||||
"doc"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "jeffmcaffer",
|
||||
"name": "Jeff McAffer",
|
||||
"avatar_url": "https://avatars2.githubusercontent.com/u/10070956?v=4",
|
||||
"profile": "https://mcaffer.com",
|
||||
"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,
|
||||
|
||||
8
.github/allowed-actions.js
vendored
8
.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]
|
||||
10
.github/workflows/merged-notification.yml
vendored
10
.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:
|
||||
|
||||
\`\`\`
|
||||
@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.`
|
||||
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.
|
||||
|
||||
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
|
||||
|
||||
@@ -32,7 +32,7 @@ Fork using the command line:
|
||||
### Make your update:
|
||||
Make your changes to the file(s) you'd like to update. Here are some tips and tricks for [using the docs codebase](#working-in-the-githubdocs-repository).
|
||||
- Are you making changes to the application code? You'll need **Node.js v14** to run the site locally. See [contributing/development.md](contributing/development.md).
|
||||
- Are you contributing to markdown? We use [GitHub Markdown](contributing/content-markup-reference).
|
||||
- Are you contributing to markdown? We use [GitHub Markdown](contributing/content-markup-reference.md).
|
||||
|
||||
### Open a pull request
|
||||
When you're done making changes and you'd like to propose them for review, use the [pull request template](#pull-request-template) to open your PR (pull request).
|
||||
@@ -63,8 +63,6 @@ Now that you're a part of the GitHub Docs community, you can keep participating
|
||||
- [Starting with an issue](#starting-with-an-issue)
|
||||
- [Labels](#labels)
|
||||
- [Opening a pull request](#opening-a-pull-request)
|
||||
- [Fork using GitHub Desktop](#fork-using-github-desktop)
|
||||
- [Fork using the command line](#fork-using-the-command-line)
|
||||
- [Working in the github/docs repository](#working-in-the-githubdocs-repository)
|
||||
- [Resolving merge conflicts](#resolving-merge-conflicts)
|
||||
- [In the GitHub user interface](#in-the-github-user-interface)
|
||||
@@ -156,7 +154,7 @@ You should always review your own PR first.
|
||||
For content changes, make sure that you:
|
||||
- [ ] Confirm that the changes address every part of the content strategy plan from your issue (if there are differences, explain them).
|
||||
- [ ] Review the content for technical accuracy.
|
||||
- [ ] Review the entire pull request using the [localization checklist](contribution/localization-checklist.md).
|
||||
- [ ] Review the entire pull request using the [localization checklist](contributing/localization-checklist.md).
|
||||
- [ ] Copy-edit the changes for grammar, spelling, and adherence to the style guide.
|
||||
- [ ] Check new or updated Liquid statements to confirm that versioning is correct.
|
||||
- [ ] Check that all of your changes render correctly in staging. Remember, that lists and tables can be tricky.
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -26,6 +26,10 @@ As you're using the GitHub Docs, you may find something in an article that you'd
|
||||
|
||||
If you've found a problem, you can open an issue using a [template](https://github.com/github/docs/issues/new/choose).
|
||||
|
||||
#### Solve an issue
|
||||
|
||||
If you have a solution to one of the open issues, you will need to fork the repository and submit a PR using the [template](https://github.com/github/docs/blob/main/CONTRIBUTING.md#pull-request-template) that is visible automatically in the pull request body. For more details about this process, please check out [Getting Started with Contributing](/CONTRIBUTING.md).
|
||||
|
||||
#### Join us in discussions
|
||||
|
||||
We use GitHub Discussions to talk about all sorts of topics related to documentation and this site. For example: if you'd like help troubleshooting a PR, have a great new idea, or want to share something amazing you've learned in our docs, join us in [discussions](https://github.com/github/docs/discussions).
|
||||
@@ -113,6 +117,8 @@ 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://mcaffer.com"><img src="https://avatars2.githubusercontent.com/u/10070956?v=4" width="64px;" alt=""/><br /><sub><b>Jeff McAffer</b></sub></a><br /><a href="https://github.com/github/docs/commits?author=jeffmcaffer" 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>
|
||||
|
||||
|
||||
@@ -18,7 +18,9 @@ versions:
|
||||
|
||||
### About workflow artifacts
|
||||
|
||||
Artifacts allow you to persist data after a job has completed, and share that data with another job in the same workflow. An artifact is a file or collection of files produced during a workflow run. For example, you can use artifacts to save your build and test output after a workflow run has ended. For pushes and pull requests, {% data variables.product.product_name %} stores artifacts for 90 days. The retention period for a pull request restarts each time someone pushes a new commit to the pull request.
|
||||
Artifacts allow you to persist data after a job has completed, and share that data with another job in the same workflow. An artifact is a file or collection of files produced during a workflow run. For example, you can use artifacts to save your build and test output after a workflow run has ended.
|
||||
|
||||
{% data reusables.github-actions.artifact-log-retention-statement %} The retention period for a pull request restarts each time someone pushes a new commit to the pull request.
|
||||
|
||||
These are some of the common artifacts that you can upload:
|
||||
|
||||
@@ -48,6 +50,119 @@ To share data between jobs:
|
||||
|
||||
The steps of a job share the same environment on the runner machine, but run in their own individual processes. To pass data between steps in a job, you can use inputs and outputs. For more information about inputs and outputs, see "[Metadata syntax for {% data variables.product.prodname_actions %}](/articles/metadata-syntax-for-github-actions)."
|
||||
|
||||
### Uploading build and test artifacts
|
||||
|
||||
You can create a continuous integration (CI) workflow to build and test your code. For more information about using {% data variables.product.prodname_actions %} to perform CI, see "[About continuous integration](/articles/about-continuous-integration)."
|
||||
|
||||
The output of building and testing your code often produces files you can use to debug test failures and production code that you can deploy. You can configure a workflow to build and test the code pushed to your repository and report a success or failure status. You can upload the build and test output to use for deployments, debugging failed tests or crashes, and viewing test suite coverage.
|
||||
|
||||
You can use the `upload-artifact` action to upload artifacts. When uploading an artifact, you can specify a single file or directory, or multiple files or directories. You can also exclude certain files or directories, and use wildcard patterns. We recommend that you provide a name for an artifact, but if no name is provided then `artifact` will be used as the default name. For more information on syntax, see the {% if currentVersion == "free-pro-team@latest" %}[actions/upload-artifact](https://github.com/actions/upload-artifact) action{% else %} `actions/upload-artifact` action on {% data variables.product.product_location %}{% endif %}.
|
||||
|
||||
#### Example
|
||||
|
||||
For example, your repository or a web application might contain SASS and TypeScript files that you must convert to CSS and JavaScript. Assuming your build configuration outputs the compiled files in the `dist` directory, you would deploy the files in the `dist` directory to your web application server if all tests completed successfully.
|
||||
|
||||
```
|
||||
|-- hello-world (repository)
|
||||
| └── dist
|
||||
| └── tests
|
||||
| └── src
|
||||
| └── sass/app.scss
|
||||
| └── app.ts
|
||||
| └── output
|
||||
| └── test
|
||||
|
|
||||
```
|
||||
|
||||
This example shows you how to create a workflow for a Node.js project that `builds` the code in the `src` directory and runs the tests in the `tests` directory. You can assume that running `npm test` produces a code coverage report named `code-coverage.html` stored in the `output/test/` directory.
|
||||
|
||||
The workflow uploads the production artifacts in the `dist` directory, but excludes any markdown files. It also and uploads the `code-coverage.html` report as another artifact.
|
||||
|
||||
```yaml
|
||||
name: Node CI
|
||||
|
||||
on: [push]
|
||||
|
||||
jobs:
|
||||
build_and_test:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v2
|
||||
- name: npm install, build, and test
|
||||
run: |
|
||||
npm install
|
||||
npm run build --if-present
|
||||
npm test
|
||||
- name: Archive production artifacts
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: dist-without-markdown
|
||||
path: |
|
||||
dist
|
||||
!dist/**/*.md
|
||||
- name: Archive code coverage results
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: code-coverage-report
|
||||
path: output/test/code-coverage.html
|
||||
```
|
||||
|
||||

|
||||
|
||||
{% if currentVersion == "free-pro-team@latest" or currentVersion ver_gt "enterprise-server@2.22" %}
|
||||
### Configuring a custom artifact retention period
|
||||
|
||||
You can define a custom retention period for individual artifacts created by a workflow. When using a workflow to create a new artifact, you can use `retention-days` with the `upload-artifact` action. This example demonstrates how to set a custom retention period of 5 days for the artifact named `my-artifact`:
|
||||
|
||||
```
|
||||
- name: 'Upload Artifact'
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: my-artifact
|
||||
path: my_file.txt
|
||||
retention-days: 5
|
||||
```
|
||||
|
||||
The `retention-days` value cannot exceed the retention limit set by the repository, organization, or enterprise.
|
||||
{% endif %}
|
||||
|
||||
### Downloading or deleting artifacts
|
||||
|
||||
During a workflow run, you can use the [`download-artifact`](https://github.com/actions/download-artifact)action to download artifacts that were previously uploaded in the same workflow run.
|
||||
|
||||
After a workflow run has been completed, you can download or delete artifacts on {% data variables.product.prodname_dotcom %} or using the REST API. For more information, see "[Downloading workflow artifacts](/actions/managing-workflow-runs/downloading-workflow-artifacts)," "[Removing workflow artifacts](/actions/managing-workflow-runs/removing-workflow-artifacts)," and the "[Artifacts REST API](/v3/actions/artifacts/)."
|
||||
|
||||
#### Downloading artifacts during a workflow run
|
||||
|
||||
The [`actions/download-artifact`](https://github.com/actions/download-artifact) action can be used to download previously uploaded artifacts during a workflow run.
|
||||
|
||||
{% note %}
|
||||
|
||||
**Note:** You can only download artifacts in a workflow that were uploaded during the same workflow run.
|
||||
|
||||
{% endnote %}
|
||||
|
||||
Specify an artifact's name to download an individual artifact. If you uploaded an artifact without specifying a name, the default name is `artifact`.
|
||||
|
||||
```yaml
|
||||
- name: Download a single artifact
|
||||
uses: actions/download-artifact@v2
|
||||
with:
|
||||
name: my-artifact
|
||||
```
|
||||
|
||||
You can also download all artifacts in a workflow run by not specifying a name. This can be useful if you are working with lots of artifacts.
|
||||
|
||||
```yaml
|
||||
- name: Download all workflow run artifacts
|
||||
uses: actions/download-artifact@v2
|
||||
```
|
||||
|
||||
If you download all a workflow run's artifacts, a directory for each artifact is created using its name.
|
||||
|
||||
For more information on syntax, see the {% if currentVersion == "free-pro-team@latest" %}[actions/download-artifact](https://github.com/actions/download-artifact) action{% else %} `actions/download-artifact` action on {% data variables.product.product_location %}{% endif %}.
|
||||
|
||||
### Passing data between jobs in a workflow
|
||||
|
||||
You can use the `upload-artifact` and `download-artifact` actions to share data between jobs in a workflow. This example workflow illustrates how to pass data between jobs in the same workflow. For more information, see the {% if currentVersion == "free-pro-team@latest" %}[actions/upload-artifact](https://github.com/actions/upload-artifact) and [download-artifact](https://github.com/actions/download-artifact) actions{% else %} `actions/upload-artifact` and `download-artifact` actions on {% data variables.product.product_location %}{% endif %}.
|
||||
@@ -125,125 +240,6 @@ jobs:
|
||||
|
||||

|
||||
|
||||
### Sharing data between workflow runs
|
||||
|
||||
After a workflow ends, you can download a compressed file of the uploaded artifacts on {% data variables.product.product_name %} by finding the workflow run in the **Actions** tab. You can also use the {% data variables.product.prodname_dotcom %} REST API to download artifacts. For more information, see "[Artifacts](/v3/actions/artifacts/)."
|
||||
|
||||
If you need to access artifacts from a previous workflow run, you can use the {% data variables.product.product_name %} REST API to retrieve artifacts. For more information, see "[Get an artifact](/rest/reference/actions#artifacts)."
|
||||
|
||||
### Uploading build and test artifacts
|
||||
|
||||
You can create a continuous integration (CI) workflow to build and test your code. For more information about using {% data variables.product.prodname_actions %} to perform CI, see "[About continuous integration](/articles/about-continuous-integration)."
|
||||
|
||||
The output of building and testing your code often produces files you can use to debug test failures and production code that you can deploy. You can configure a workflow to build and test the code pushed to your repository and report a success or failure status. You can upload the build and test output to use for deployments, debugging failed tests or crashes, and viewing test suite coverage.
|
||||
|
||||
You can use the `upload-artifact` action to upload artifacts. When uploading an artifact, you can specify a single file or directory, or multiple files or directories. You can also exclude certain files or directories, and use wildcard patterns. We recommend that you provide a name for an artifact, but if no name is provided then `artifact` will be used as the default name. For more information on syntax, see the {% if currentVersion == "free-pro-team@latest" %}[actions/upload-artifact](https://github.com/actions/upload-artifact) action{% else %} `actions/upload-artifact` action on {% data variables.product.product_location %}{% endif %}.
|
||||
|
||||
#### Example
|
||||
|
||||
For example, your repository or a web application might contain SASS and TypeScript files that you must convert to CSS and JavaScript. Assuming your build configuration outputs the compiled files in the `dist` directory, you would deploy the files in the `dist` directory to your web application server if all tests completed successfully.
|
||||
|
||||
```
|
||||
|-- hello-world (repository)
|
||||
| └── dist
|
||||
| └── tests
|
||||
| └── src
|
||||
| └── sass/app.scss
|
||||
| └── app.ts
|
||||
| └── output
|
||||
| └── test
|
||||
|
|
||||
```
|
||||
|
||||
This example shows you how to create a workflow for a Node.js project that `builds` the code in the `src` directory and runs the tests in the `tests` directory. You can assume that running `npm test` produces a code coverage report named `code-coverage.html` stored in the `output/test/` directory.
|
||||
|
||||
The workflow uploads the production artifacts in the `dist` directory, but excludes any markdown files. It also and uploads the `code-coverage.html` report as another artifact.
|
||||
|
||||
```yaml
|
||||
name: Node CI
|
||||
|
||||
on: [push]
|
||||
|
||||
jobs:
|
||||
build_and_test:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v2
|
||||
- name: npm install, build, and test
|
||||
run: |
|
||||
npm install
|
||||
npm run build --if-present
|
||||
npm test
|
||||
- name: Archive production artifacts
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: dist-without-markdown
|
||||
path: |
|
||||
dist
|
||||
!dist/**/*.md
|
||||
- name: Archive code coverage results
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: code-coverage-report
|
||||
path: output/test/code-coverage.html
|
||||
```
|
||||
|
||||

|
||||
|
||||
### Downloading or deleting artifacts
|
||||
|
||||
During a workflow run, you can download artifacts that were previously uploaded in the same workflow run. After a workflow run has been completed, you can download or delete artifacts on GitHub using the workflow run history.
|
||||
|
||||
#### Downloading artifacts during a workflow run
|
||||
|
||||
The [actions/download-artifact](https://github.com/actions/download-artifact) action can be used to download previously uploaded artifacts during a workflow run.
|
||||
|
||||
{% note %}
|
||||
|
||||
**Note:** You can only download artifacts in a workflow that were uploaded during the same workflow run.
|
||||
|
||||
{% endnote %}
|
||||
|
||||
Specify an artifact's name to download an individual artifact. If you uploaded an artifact without specifying a name, the default name is `artifact`.
|
||||
|
||||
```yaml
|
||||
- name: Download a single artifact
|
||||
uses: actions/download-artifact@v2
|
||||
with:
|
||||
name: my-artifact
|
||||
```
|
||||
|
||||
You can also download all artifacts in a workflow run by not specifying a name. This can be useful if you are working with lots of artifacts.
|
||||
|
||||
```yaml
|
||||
- name: Download all workflow run artifacts
|
||||
uses: actions/download-artifact@v2
|
||||
```
|
||||
|
||||
If you download all a workflow run's artifacts, a directory for each artifact is created using its name.
|
||||
|
||||
For more information on syntax, see the {% if currentVersion == "free-pro-team@latest" %}[actions/download-artifact](https://github.com/actions/download-artifact) action{% else %} `actions/download-artifact` action on {% data variables.product.product_location %}{% endif %}.
|
||||
|
||||
#### Downloading and deleting artifacts after a workflow run is complete
|
||||
|
||||
Artifacts automatically expire after 90 days, but you can always reclaim used {% data variables.product.prodname_actions %} storage by deleting artifacts before they expire on {% data variables.product.product_name %}.
|
||||
|
||||
{% warning %}
|
||||
|
||||
**Warning:** Once you delete an artifact, it can not be restored.
|
||||
|
||||
{% endwarning %}
|
||||
|
||||
{% data reusables.repositories.navigate-to-repo %}
|
||||
{% data reusables.repositories.actions-tab %}
|
||||
{% data reusables.repositories.navigate-to-workflow %}
|
||||
{% data reusables.repositories.view-run %}
|
||||
1. To download artifacts, use the **Artifacts** drop-down menu, and select the artifact you want to download.
|
||||

|
||||
1. To delete artifacts, use the **Artifacts** drop-down menu, and click {% octicon "trashcan" aria-label="The trashcan icon" %}.
|
||||

|
||||
|
||||
{% if currentVersion == "free-pro-team@latest" %}
|
||||
|
||||
### Further reading
|
||||
|
||||
@@ -20,6 +20,7 @@ If your workflows use sensitive data, such as passwords or certificates, you can
|
||||
|
||||
This example action demonstrates how to reference an existing secret as an environment variable, and send it as a parameter to an example command.
|
||||
|
||||
{% raw %}
|
||||
```yaml
|
||||
jobs:
|
||||
example-job:
|
||||
@@ -30,6 +31,7 @@ jobs:
|
||||
run: |
|
||||
example-command "$SUPER_SECRET"
|
||||
```
|
||||
{% endraw %}
|
||||
|
||||
For more information, see "[Creating and storing encrypted secrets](/actions/configuring-and-managing-workflows/creating-and-storing-encrypted-secrets)."
|
||||
|
||||
@@ -62,6 +64,7 @@ For more information, see [`jobs.<job_id>.needs`](/actions/reference/workflow-sy
|
||||
|
||||
You can use a build matrix if you want your workflow to run tests across multiple combinations of operating systems, platforms, and languages. The build matrix is created using the `strategy` keyword, which receives the build options as an array. For example, this build matrix will run the job multiple times, using different versions of Node.js:
|
||||
|
||||
{% raw %}
|
||||
```yaml
|
||||
jobs:
|
||||
build:
|
||||
@@ -74,6 +77,7 @@ jobs:
|
||||
with:
|
||||
node-version: ${{ matrix.node }}
|
||||
```
|
||||
{% endraw %}
|
||||
|
||||
For more information, see [`jobs.<job_id>.strategy.matrix`](/actions/reference/workflow-syntax-for-github-actions#jobsjob_idstrategymatrix).
|
||||
|
||||
@@ -83,6 +87,7 @@ For more information, see [`jobs.<job_id>.strategy.matrix`](/actions/reference/w
|
||||
|
||||
This example demonstrates how to cache the ` ~/.npm` directory:
|
||||
|
||||
{% raw %}
|
||||
```yaml
|
||||
jobs:
|
||||
example-job:
|
||||
@@ -97,6 +102,7 @@ jobs:
|
||||
restore-keys: |
|
||||
${{ runner.os }}-build-${{ env.cache-name }}-
|
||||
```
|
||||
{% endraw %}
|
||||
|
||||
For more information, see "[Caching dependencies to speed up workflows](/actions/configuring-and-managing-workflows/caching-dependencies-to-speed-up-workflows)."
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: Downloading workflow artifacts
|
||||
intro: You can download artifacts that were archived during a workflow run. Artifacts automatically expire after 90 days.
|
||||
intro: You can download archived artifacts before they automatically expire.
|
||||
product: '{% data reusables.gated-features.actions %}'
|
||||
versions:
|
||||
free-pro-team: '*'
|
||||
@@ -10,6 +10,9 @@ versions:
|
||||
{% data reusables.actions.enterprise-beta %}
|
||||
{% data reusables.actions.enterprise-github-hosted-runners %}
|
||||
|
||||
{% if currentVersion == "free-pro-team@latest" or currentVersion ver_gt "enterprise-server@2.22" %} By default, {% data variables.product.product_name %} stores build logs and artifacts for 90 days, and you can customize this retention period, depending on the type of repository. For more information, see "[Configuring the retention period for GitHub Actions artifacts and logs in your repository](/github/administering-a-repository/configuring-the-retention-period-for-github-actions-artifacts-and-logs-in-your-repository)."{% endif %}
|
||||
{% if currentVersion == "enterprise-server@2.22" %} {% data variables.product.product_name %} stores full build logs and artifacts for 90 days.{% endif %}
|
||||
|
||||
{% data reusables.repositories.permissions-statement-read %}
|
||||
|
||||
{% data reusables.repositories.navigate-to-repo %}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: Removing workflow artifacts
|
||||
intro: 'Artifacts automatically expire after 90 days, but you can always reclaim used {% data variables.product.prodname_actions %} storage by deleting artifacts before they expire on {% data variables.product.product_name %}.'
|
||||
intro: 'You can reclaim used {% data variables.product.prodname_actions %} storage by deleting artifacts before they expire on {% data variables.product.product_name %}.'
|
||||
product: '{% data reusables.gated-features.actions %}'
|
||||
versions:
|
||||
free-pro-team: '*'
|
||||
@@ -10,6 +10,8 @@ versions:
|
||||
{% data reusables.actions.enterprise-beta %}
|
||||
{% data reusables.actions.enterprise-github-hosted-runners %}
|
||||
|
||||
### Deleting an artifact
|
||||
|
||||
{% warning %}
|
||||
|
||||
**Warning:** Once you delete an artifact, it can not be restored.
|
||||
@@ -18,9 +20,23 @@ versions:
|
||||
|
||||
{% data reusables.repositories.permissions-statement-write %}
|
||||
|
||||
{% data reusables.github-actions.artifact-log-retention-statement %}
|
||||
|
||||
{% data reusables.repositories.navigate-to-repo %}
|
||||
{% data reusables.repositories.actions-tab %}
|
||||
{% data reusables.repositories.navigate-to-workflow %}
|
||||
{% data reusables.repositories.view-run %}
|
||||
1. Under **Artifacts**, click {% octicon "trashcan" aria-label="The trashcan icon" %} next to the artifact you want to remove.
|
||||

|
||||
|
||||
{% if currentVersion == "free-pro-team@latest" or currentVersion ver_gt "enterprise-server@2.22" %}
|
||||
### Setting the retention period for an artifact
|
||||
|
||||
Retention periods for artifacts and logs can be configured at the repository, organization, and enterprise level. For more information, see "[Usage limits, billing, and administration](/actions/reference/usage-limits-billing-and-administration#artifact-and-log-retention-policy)."
|
||||
|
||||
You can also define a custom retention period for individual artifacts using the `actions/upload-artifact` action in a workflow. For more information, see "[Storing workflow data as artifacts](/actions/guides/storing-workflow-data-as-artifacts#configuring-a-custom-artifact-retention-period)."
|
||||
|
||||
### Finding the expiration date of an artifact
|
||||
|
||||
You can use the API to confirm the date that an artifact is scheduled to be deleted. For more information, see the `expires_at` value returned by "[List artifacts for a repository](/rest/reference/actions#artifacts)."
|
||||
{% endif %}
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
title: Using workflow run logs
|
||||
intro: 'You can view, search, and download the logs for each job in a workflow run. {% data variables.product.product_name %} stores full build logs and artifacts for 90 days.'
|
||||
intro: 'You can view, search, and download the logs for each job in a workflow run.'
|
||||
product: '{% data reusables.gated-features.actions %}'
|
||||
versions:
|
||||
free-pro-team: '*'
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -53,6 +53,20 @@ Usage limits apply to self-hosted runners. For more information, see "[About sel
|
||||
In addition to the usage limits, you must ensure that you use {% data variables.product.prodname_actions %} within the [GitHub Terms of Service](/articles/github-terms-of-service/). For more information on {% data variables.product.prodname_actions %}-specific terms, see the [GitHub Additional Product Terms](/github/site-policy/github-additional-product-terms#a-actions-usage).
|
||||
{% endif %}
|
||||
|
||||
{% if currentVersion == "free-pro-team@latest" or currentVersion ver_gt "enterprise-server@2.22" %}
|
||||
### Artifact and log retention policy
|
||||
|
||||
You can configure the artifact and log retention period for your repository, organization, or enterprise account.
|
||||
|
||||
{% data reusables.actions.about-artifact-log-retention %}
|
||||
|
||||
For more information, see:
|
||||
|
||||
- [Configuring the retention period for {% data variables.product.prodname_actions %} for artifacts and logs in your repository](/github/administering-a-repository/configuring-the-retention-period-for-github-actions-artifacts-and-logs-in-your-repository)
|
||||
- [Configuring the retention period for {% data variables.product.prodname_actions %} for artifacts and logs in your organization](/github/setting-up-and-managing-organizations-and-teams/configuring-the-retention-period-for-github-actions-artifacts-and-logs-in-your-organization)
|
||||
- [Configuring the retention period for {% data variables.product.prodname_actions %} for artifacts and logs in your enterprise](/github/setting-up-and-managing-your-enterprise-account/configuring-the-retention-period-for-github-actions-artifacts-and-logs-in-your-enterprise-account)
|
||||
{% endif %}
|
||||
|
||||
### Disabling or limiting {% data variables.product.prodname_actions %} for your repository or organization
|
||||
|
||||
{% data reusables.github-actions.disabling-github-actions %}
|
||||
|
||||
@@ -234,7 +234,7 @@ During the execution of a workflow, the runner generates temporary files that ca
|
||||
|
||||
```
|
||||
steps:
|
||||
- run: echo "mypath" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8
|
||||
- run: echo "mypath" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
|
||||
```
|
||||
|
||||
{% endwarning %}
|
||||
|
||||
@@ -69,7 +69,7 @@ You can populate the runner tool cache by running a {% data variables.product.pr
|
||||
path: ${{runner.tool_cache}}/tool_cache.tar.gz
|
||||
```
|
||||
{% endraw %}
|
||||
1. Download the tool cache artifact from the workflow run. For instructions on downloading artifacts, see "[Persisting workflow data using artifacts](/actions/configuring-and-managing-workflows/persisting-workflow-data-using-artifacts#downloading-and-deleting-artifacts-after-a-workflow-run-is-complete)."
|
||||
1. Download the tool cache artifact from the workflow run. For instructions on downloading artifacts, see "[Downloading workflow artifacts](/actions/managing-workflow-runs/downloading-workflow-artifacts)."
|
||||
1. Transfer the tool cache artifact to your self hosted runner and extract it to the local tool cache directory. The default tool cache directory is `RUNNER_DIR/_work/_tool`. If the runner hasn't processed any jobs yet, you might need to create the `_work/_tool` directories.
|
||||
|
||||
After extracting the tool cache artifact uploaded in the above example, you should have a directory structure on your self-hosted runner that is similar to the following example:
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
---
|
||||
title: Configuring the retention period for GitHub Actions artifacts and logs in your repository
|
||||
intro: 'You can configure the retention period for {% data variables.product.prodname_actions %} artifacts and logs in your repository.'
|
||||
versions:
|
||||
free-pro-team: '*'
|
||||
enterprise-server: '>=2.23'
|
||||
---
|
||||
|
||||
{% data reusables.actions.about-artifact-log-retention %}
|
||||
|
||||
You can also define a custom retention period for a specific artifact created by a workflow. For more information, see "[Setting the retention period for an artifact](/actions/managing-workflow-runs/removing-workflow-artifacts#setting-the-retention-period-for-an-artifact)."
|
||||
|
||||
## Setting the retention period for a repository
|
||||
|
||||
{% data reusables.repositories.navigate-to-repo %}
|
||||
{% data reusables.repositories.sidebar-settings %}
|
||||
{% data reusables.repositories.settings-sidebar-actions %}
|
||||
{% data reusables.github-actions.change-retention-period-for-artifacts-logs %}
|
||||
@@ -27,6 +27,7 @@ versions:
|
||||
<!-- endif -->
|
||||
{% link_in_list /managing-the-forking-policy-for-your-repository %}
|
||||
<!-- if currentVersion != "free-pro-team@latest" -->
|
||||
{% link_in_list /configuring-the-retention-period-for-github-actions-artifacts-and-logs-in-your-repository %}
|
||||
{% link_in_list /disabling-or-limiting-github-actions-for-a-repository %}
|
||||
{% link_in_list /managing-git-lfs-objects-in-archives-of-your-repository %}
|
||||
{% link_in_list /enabling-anonymous-git-read-access-for-a-repository %}
|
||||
|
||||
@@ -13,13 +13,9 @@ versions:
|
||||
|
||||
You can change the most recent commit message using the `git commit --amend` command.
|
||||
|
||||
{% warning %}
|
||||
|
||||
In Git, the text of the commit message is part of the commit. Changing the commit message will change the commit ID--i.e., the SHA1 checksum that names the commit. Effectively, you are creating a new commit that replaces the old one.
|
||||
|
||||
{% endwarning %}
|
||||
|
||||
#### Commit has not been pushed online
|
||||
### Commit has not been pushed online
|
||||
|
||||
If the commit only exists in your local repository and has not been pushed to {% data variables.product.product_location %}, you can amend the commit message with the `git commit --amend` command.
|
||||
|
||||
@@ -39,7 +35,7 @@ You can change the default text editor for Git by changing the `core.editor` set
|
||||
|
||||
{% endtip %}
|
||||
|
||||
#### Amending older or multiple commit messages
|
||||
### Amending older or multiple commit messages
|
||||
|
||||
If you have already pushed the commit to {% data variables.product.product_location %}, you will have to force push a commit with an amended message.
|
||||
|
||||
@@ -49,7 +45,7 @@ We strongly discourage force pushing, since this changes the history of your rep
|
||||
|
||||
{% endwarning %}
|
||||
|
||||
**Amending the message of the most recently pushed commit**
|
||||
**Changing the message of the most recently pushed commit**
|
||||
|
||||
1. Follow the [steps above](/articles/changing-a-commit-message#commit-has-not-been-pushed-online) to amend the commit message.
|
||||
2. Use the `push --force` command to force push over the old commit.
|
||||
@@ -57,7 +53,7 @@ We strongly discourage force pushing, since this changes the history of your rep
|
||||
$ git push --force <em>example-branch</em>
|
||||
```
|
||||
|
||||
**Amending the message of older or multiple commit messages**
|
||||
**Changing the message of older or multiple commit messages**
|
||||
|
||||
If you need to amend the message for multiple commits or an older commit, you can use interactive rebase, then force push to change the commit history.
|
||||
|
||||
@@ -93,7 +89,6 @@ If you need to amend the message for multiple commits or an older commit, you ca
|
||||
#
|
||||
# Note that empty commits are commented out
|
||||
```
|
||||
|
||||
3. Replace `pick` with `reword` before each commit message you want to change.
|
||||
```shell
|
||||
pick e499d89 Delete CNAME
|
||||
@@ -102,10 +97,10 @@ If you need to amend the message for multiple commits or an older commit, you ca
|
||||
```
|
||||
4. Save and close the commit list file.
|
||||
5. In each resulting commit file, type the new commit message, save the file, and close it.
|
||||
6. Force-push the amended commits.
|
||||
```shell
|
||||
$ git push --force
|
||||
```
|
||||
6. When you're ready to push your changes to GitHub, use the push --force command to force push over the old commit.
|
||||
```shell
|
||||
$ git push --force <em>example-branch</em>
|
||||
```
|
||||
|
||||
For more information on interactive rebase, see "[Interactive mode](https://git-scm.com/docs/git-rebase#_interactive_mode)" in the Git manual.
|
||||
|
||||
|
||||
@@ -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`
|
||||
|
||||
@@ -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 %}
|
||||
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
---
|
||||
title: Configuring the retention period for GitHub Actions artifacts and logs in your organization
|
||||
intro: 'You can configure the retention period for {% data variables.product.prodname_actions %} artifacts and logs in your organization.'
|
||||
versions:
|
||||
free-pro-team: '*'
|
||||
enterprise-server: '>=2.23'
|
||||
---
|
||||
|
||||
{% data reusables.actions.about-artifact-log-retention %}
|
||||
|
||||
## Setting the retention period for an organization
|
||||
|
||||
{% data reusables.organizations.navigate-to-org %}
|
||||
{% data reusables.organizations.org_settings %}
|
||||
{% data reusables.organizations.settings-sidebar-actions %}
|
||||
{% data reusables.github-actions.change-retention-period-for-artifacts-logs %}
|
||||
@@ -100,6 +100,7 @@ versions:
|
||||
{% link_in_list /managing-the-forking-policy-for-your-organization %}
|
||||
<!-- if currentVersion == "free-pro-team@latest" -->
|
||||
{% link_in_list /disabling-or-limiting-github-actions-for-your-organization %}
|
||||
{% link_in_list /configuring-the-retention-period-for-github-actions-artifacts-and-logs-in-your-organization %}
|
||||
<!-- endif -->
|
||||
<!-- if currentVersion == "free-pro-team@latest" or currentVersion ver_gt "enterprise-server@2.15" -->
|
||||
{% link_in_list /setting-permissions-for-adding-outside-collaborators %}
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
---
|
||||
title: Configuring the retention period for GitHub Actions artifacts and logs in your enterprise account
|
||||
intro: 'Enterprise owners can configure the retention period for {% data variables.product.prodname_actions %} artifacts and logs in an enterprise account.'
|
||||
product: '{% data reusables.gated-features.enterprise-accounts %}'
|
||||
miniTocMaxHeadingLevel: 4
|
||||
versions:
|
||||
free-pro-team: '*'
|
||||
enterprise-server: '>=2.23'
|
||||
---
|
||||
|
||||
{% data reusables.actions.about-artifact-log-retention %}
|
||||
|
||||
## Setting the retention period for an enterprise
|
||||
|
||||
{% data reusables.enterprise_site_admin_settings.access-settings %}
|
||||
{% data reusables.enterprise_site_admin_settings.business %}
|
||||
{% data reusables.enterprise-accounts.policies-tab %}
|
||||
{% data reusables.enterprise-accounts.actions-tab %}
|
||||
{% data reusables.github-actions.change-retention-period-for-artifacts-logs %}
|
||||
@@ -33,3 +33,4 @@ versions:
|
||||
{% link_in_list /configuring-saml-single-sign-on-and-scim-for-your-enterprise-account-using-okta %}
|
||||
{% link_in_list /enforcing-a-policy-on-dependency-insights-in-your-enterprise-account %}
|
||||
{% link_in_list /enforcing-github-actions-policies-in-your-enterprise-account %}
|
||||
{% link_in_list /configuring-the-retention-period-for-github-actions-artifacts-and-logs-in-your-enterprise-account %}
|
||||
|
||||
@@ -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,32 +120,32 @@ publishing {
|
||||
|
||||
##### Example using Kotlin DSL for multiple packages in the same repository
|
||||
|
||||
```shell
|
||||
plugins {
|
||||
`maven-publish` apply false
|
||||
}
|
||||
|
||||
subprojects {
|
||||
apply(plugin = "maven-publish")
|
||||
configure<PublishingExtension> {
|
||||
repositories {
|
||||
maven {
|
||||
name = "GitHubPackages"
|
||||
url = uri("https://{% if currentVersion == "free-pro-team@latest" %}maven.pkg.github.com{% else %}<em>REGISTRY-URL</em>{% endif %}/<em>OWNER</em>/<em>REPOSITORY</em>")
|
||||
credentials {
|
||||
username = project.findProperty("gpr.user") as String? ?: System.getenv("<em>USERNAME</em>")
|
||||
password = project.findProperty("gpr.key") as String? ?: System.getenv("<em>TOKEN</em>")
|
||||
}
|
||||
}
|
||||
}
|
||||
publications {
|
||||
register<MavenPublication>("gpr") {
|
||||
from(components["java"])
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
```shell
|
||||
plugins {
|
||||
`maven-publish` apply false
|
||||
}
|
||||
|
||||
subprojects {
|
||||
apply(plugin = "maven-publish")
|
||||
configure<PublishingExtension> {
|
||||
repositories {
|
||||
maven {
|
||||
name = "GitHubPackages"
|
||||
url = uri("https://{% if currentVersion == "free-pro-team@latest" %}maven.pkg.github.com{% else %}<em>REGISTRY-URL</em>{% endif %}/<em>OWNER</em>/<em>REPOSITORY</em>")
|
||||
credentials {
|
||||
username = project.findProperty("gpr.user") as String? ?: System.getenv("<em>USERNAME</em>")
|
||||
password = project.findProperty("gpr.key") as String? ?: System.getenv("<em>TOKEN</em>")
|
||||
}
|
||||
}
|
||||
}
|
||||
publications {
|
||||
register<MavenPublication>("gpr") {
|
||||
from(components["java"])
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
#### Authenticating with the `GITHUB_TOKEN`
|
||||
|
||||
@@ -173,31 +173,31 @@ You can install a package by adding the package as a dependency to your project.
|
||||
{% data reusables.package_registry.authenticate-step %}
|
||||
2. Add the package dependencies to your *build.gradle* file (Gradle Groovy) or *build.gradle.kts* file (Kotlin DSL) file.
|
||||
|
||||
Example using Grady Groovy:
|
||||
Example using Gradle Groovy:
|
||||
```shell
|
||||
dependencies {
|
||||
implementation 'com.example:package'
|
||||
implementation 'com.example:package'
|
||||
}
|
||||
```
|
||||
Example using Kotlin DSL:
|
||||
```shell
|
||||
dependencies {
|
||||
implementation("com.example:package")
|
||||
implementation("com.example:package")
|
||||
}
|
||||
```
|
||||
|
||||
3. Add the maven plugin to your *build.gradle* file (Gradle Groovy) or *build.gradle.kts* file (Kotlin DSL) file.
|
||||
|
||||
Example using Grady Groovy:
|
||||
Example using Gradle Groovy:
|
||||
```shell
|
||||
plugins {
|
||||
id 'maven'
|
||||
id 'maven'
|
||||
}
|
||||
```
|
||||
Example using Kotlin DSL:
|
||||
```shell
|
||||
plugins {
|
||||
`maven`
|
||||
`maven`
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -52,4 +52,4 @@ For more info about working with this site, check out these READMEs:
|
||||
- [middleware/README.md](../middleware/README.md)
|
||||
- [script/README.md](../script/README.md)
|
||||
- [stylesheets/README.md](../stylesheets/README.md)
|
||||
- [tests/README.md](../tests/README.md)
|
||||
- [tests/README.md](../tests/README.md)
|
||||
|
||||
@@ -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:
|
||||
|
||||
|
||||
6
data/reusables/actions/about-artifact-log-retention.md
Normal file
6
data/reusables/actions/about-artifact-log-retention.md
Normal file
@@ -0,0 +1,6 @@
|
||||
By default, the artifacts and log files generated by workflows are retained for 90 days before they are automatically deleted. You can adjust the retention period, depending on the type of repository:
|
||||
|
||||
- For public repositories: you can change this retention period to anywhere between 1 day or 90 days.
|
||||
- For private, internal, and {% data variables.product.prodname_enterprise %} repositories: you can change this retention period to anywhere between 1 day or 400 days.
|
||||
|
||||
When you customize the retention period, it only applies to new artifacts and log files, and does not retroactively apply to existing objects. For managed repositories and organizations, the maximum retention period cannot exceed the limit set by the managing organization or enterprise.
|
||||
@@ -0,0 +1,2 @@
|
||||
{% if currentVersion == "free-pro-team@latest" or currentVersion ver_gt "enterprise-server@2.22" %} By default, {% data variables.product.product_name %} stores build logs and artifacts for 90 days, and this retention period can be customized. For more information, see "[Usage limits, billing, and administration](/actions/reference/usage-limits-billing-and-administration#artifact-and-log-retention-policy)".{% endif %}
|
||||
{% if currentVersion == "enterprise-server@2.22" %} {% data variables.product.product_name %} stores full build logs and artifacts for 90 days.{% endif %}
|
||||
@@ -0,0 +1,2 @@
|
||||
1. Under **Artifact and log retention duration**, enter a new value.
|
||||
1. Click **Save** to apply the change.
|
||||
@@ -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,162 +100,214 @@ module.exports = {
|
||||
type: 'string',
|
||||
description: 'The browser value of `navigator.language`.'
|
||||
}
|
||||
},
|
||||
oneOf: [{
|
||||
// *** type: page ***
|
||||
required: [
|
||||
'path',
|
||||
'href'
|
||||
],
|
||||
properties: {
|
||||
type: {
|
||||
type: 'string',
|
||||
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 ***
|
||||
required: [
|
||||
'exit_page_id'
|
||||
],
|
||||
properties: {
|
||||
type: {
|
||||
type: 'string',
|
||||
pattern: /^exit$/
|
||||
},
|
||||
exit_page_id: {
|
||||
type: 'string',
|
||||
format: 'uuid',
|
||||
description: 'The value of the corresponding `page` event.'
|
||||
// id of the "page" event
|
||||
},
|
||||
exit_first_paint: {
|
||||
type: 'number',
|
||||
minimum: 0.001,
|
||||
description: 'The duration until `first-contentful-paint`, in seconds. Informs CSS performance.'
|
||||
},
|
||||
exit_dom_interactive: {
|
||||
type: 'number',
|
||||
minimum: 0.001,
|
||||
description: 'The duration until `PerformanceNavigationTiming.domInteractive`, in seconds. Informs JavaScript loading performance.'
|
||||
},
|
||||
exit_dom_complete: {
|
||||
type: 'number',
|
||||
minimum: 0.001,
|
||||
description: 'The duration until `PerformanceNavigationTiming.domComplete`, in seconds. Informs JavaScript execution performance.'
|
||||
},
|
||||
exit_visit_duration: {
|
||||
type: 'number',
|
||||
minimum: 0.001,
|
||||
description: 'The duration of exit.timestamp - page.timestamp, in seconds. Informs bounce rate.'
|
||||
},
|
||||
exit_scroll_length: {
|
||||
type: 'number',
|
||||
minimum: 0,
|
||||
maximum: 1,
|
||||
description: 'The percentage of how far the user scrolled on the page.'
|
||||
}
|
||||
}
|
||||
}, {
|
||||
// *** type: link ***
|
||||
required: [
|
||||
'link_url'
|
||||
],
|
||||
properties: {
|
||||
type: {
|
||||
type: 'string',
|
||||
pattern: /^link$/
|
||||
},
|
||||
link_url: {
|
||||
type: 'string',
|
||||
format: 'uri',
|
||||
description: 'The href of the anchor tag the user clicked, or the page or object they directed their browser to.'
|
||||
}
|
||||
}
|
||||
}, {
|
||||
// *** type: search ***
|
||||
required: [
|
||||
'search_query'
|
||||
],
|
||||
properties: {
|
||||
type: {
|
||||
type: 'string',
|
||||
pattern: /^search$/
|
||||
},
|
||||
search_query: {
|
||||
type: 'string',
|
||||
description: 'The actual text content of the query string the user sent to the service.'
|
||||
},
|
||||
search_context: {
|
||||
type: 'string',
|
||||
description: 'Any additional search context, such as component searched.'
|
||||
}
|
||||
}
|
||||
}, {
|
||||
// *** type: navigate ***
|
||||
properties: {
|
||||
type: {
|
||||
type: 'string',
|
||||
pattern: /^navigate$/
|
||||
},
|
||||
navigate_label: {
|
||||
type: 'string',
|
||||
description: 'An identifier for where the user is navigating.'
|
||||
}
|
||||
}
|
||||
}, {
|
||||
// *** type: survey ***
|
||||
properties: {
|
||||
type: {
|
||||
type: 'string',
|
||||
pattern: /^survey$/
|
||||
},
|
||||
survey_vote: {
|
||||
type: 'boolean',
|
||||
description: 'Whether the user found the page helpful.'
|
||||
},
|
||||
survey_comment: {
|
||||
type: 'string',
|
||||
description: 'Any textual comments the user wanted to provide.'
|
||||
},
|
||||
survey_email: {
|
||||
type: 'string',
|
||||
format: 'email',
|
||||
description: 'The user\'s email address, if the user provided and consented.'
|
||||
}
|
||||
}
|
||||
}, {
|
||||
// *** type: experiment ***
|
||||
required: [
|
||||
'experiment_name',
|
||||
'experiment_variation'
|
||||
],
|
||||
properties: {
|
||||
type: {
|
||||
type: 'string',
|
||||
pattern: /^experiment$/
|
||||
},
|
||||
experiment_name: {
|
||||
type: 'string',
|
||||
description: 'The test that this event is part of.'
|
||||
},
|
||||
experiment_variation: {
|
||||
type: 'string',
|
||||
enum: ['control', 'treatment'],
|
||||
description: 'The variation this user we bucketed in, such as control or treatment.'
|
||||
},
|
||||
experiment_success: {
|
||||
type: 'boolean',
|
||||
default: true,
|
||||
description: 'Whether or not the user successfully performed the test goal.'
|
||||
}
|
||||
}
|
||||
}]
|
||||
}
|
||||
}
|
||||
|
||||
const pageSchema = {
|
||||
additionalProperties: false,
|
||||
required: [
|
||||
'type',
|
||||
'context'
|
||||
],
|
||||
properties: {
|
||||
context,
|
||||
type: {
|
||||
type: 'string',
|
||||
pattern: '^page$'
|
||||
},
|
||||
page_render_duration: {
|
||||
type: 'number',
|
||||
description: 'How long the server took to render the page content, in seconds.',
|
||||
minimum: 0.001
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const exitSchema = {
|
||||
additionalProperties: false,
|
||||
required: [
|
||||
'type',
|
||||
'context',
|
||||
'exit_page_id'
|
||||
],
|
||||
properties: {
|
||||
context,
|
||||
type: {
|
||||
type: 'string',
|
||||
pattern: '^exit$'
|
||||
},
|
||||
exit_page_id: {
|
||||
type: 'string',
|
||||
format: 'uuid',
|
||||
description: 'The value of the corresponding `page` event.'
|
||||
// id of the "page" event
|
||||
},
|
||||
exit_first_paint: {
|
||||
type: 'number',
|
||||
minimum: 0.001,
|
||||
description: 'The duration until `first-contentful-paint`, in seconds. Informs CSS performance.'
|
||||
},
|
||||
exit_dom_interactive: {
|
||||
type: 'number',
|
||||
minimum: 0.001,
|
||||
description: 'The duration until `PerformanceNavigationTiming.domInteractive`, in seconds. Informs JavaScript loading performance.'
|
||||
},
|
||||
exit_dom_complete: {
|
||||
type: 'number',
|
||||
minimum: 0.001,
|
||||
description: 'The duration until `PerformanceNavigationTiming.domComplete`, in seconds. Informs JavaScript execution performance.'
|
||||
},
|
||||
exit_visit_duration: {
|
||||
type: 'number',
|
||||
minimum: 0.001,
|
||||
description: 'The duration of exit.timestamp - page.timestamp, in seconds. Informs bounce rate.'
|
||||
},
|
||||
exit_scroll_length: {
|
||||
type: 'number',
|
||||
minimum: 0,
|
||||
maximum: 1,
|
||||
description: 'The percentage of how far the user scrolled on the page.'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const linkSchema = {
|
||||
additionalProperties: false,
|
||||
required: [
|
||||
'type',
|
||||
'context',
|
||||
'link_url'
|
||||
],
|
||||
properties: {
|
||||
context,
|
||||
type: {
|
||||
type: 'string',
|
||||
pattern: '^link$'
|
||||
},
|
||||
link_url: {
|
||||
type: 'string',
|
||||
format: 'uri',
|
||||
description: 'The href of the anchor tag the user clicked, or the page or object they directed their browser to.'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const searchSchema = {
|
||||
additionalProperties: false,
|
||||
required: [
|
||||
'type',
|
||||
'context',
|
||||
'search_query'
|
||||
],
|
||||
properties: {
|
||||
context,
|
||||
type: {
|
||||
type: 'string',
|
||||
pattern: '^search$'
|
||||
},
|
||||
search_query: {
|
||||
type: 'string',
|
||||
description: 'The actual text content of the query string the user sent to the service.'
|
||||
},
|
||||
search_context: {
|
||||
type: 'string',
|
||||
description: 'Any additional search context, such as component searched.'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const navigateSchema = {
|
||||
additionalProperties: false,
|
||||
required: [
|
||||
'type',
|
||||
'context'
|
||||
],
|
||||
properties: {
|
||||
context,
|
||||
type: {
|
||||
type: 'string',
|
||||
pattern: '^navigate$'
|
||||
},
|
||||
navigate_label: {
|
||||
type: 'string',
|
||||
description: 'An identifier for where the user is navigating.'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const surveySchema = {
|
||||
additionalProperties: false,
|
||||
required: [
|
||||
'type',
|
||||
'context',
|
||||
'survey_vote'
|
||||
],
|
||||
properties: {
|
||||
context,
|
||||
type: {
|
||||
type: 'string',
|
||||
pattern: '^survey$'
|
||||
},
|
||||
token: {
|
||||
type: 'string',
|
||||
description: 'A honeypot.',
|
||||
maxLength: 0
|
||||
},
|
||||
survey_vote: {
|
||||
type: 'boolean',
|
||||
description: 'Whether the user found the page helpful.'
|
||||
},
|
||||
survey_comment: {
|
||||
type: 'string',
|
||||
description: 'Any textual comments the user wanted to provide.'
|
||||
},
|
||||
survey_email: {
|
||||
type: 'string',
|
||||
format: 'email',
|
||||
description: 'The user\'s email address, if the user provided and consented.'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const experimentSchema = {
|
||||
additionalProperties: false,
|
||||
required: [
|
||||
'type',
|
||||
'context',
|
||||
'experiment_name',
|
||||
'experiment_variation'
|
||||
],
|
||||
properties: {
|
||||
context,
|
||||
type: {
|
||||
type: 'string',
|
||||
pattern: '^experiment$'
|
||||
},
|
||||
experiment_name: {
|
||||
type: 'string',
|
||||
description: 'The test that this event is part of.'
|
||||
},
|
||||
experiment_variation: {
|
||||
type: 'string',
|
||||
enum: ['control', 'treatment'],
|
||||
description: 'The variation this user we bucketed in, such as control or treatment.'
|
||||
},
|
||||
experiment_success: {
|
||||
type: 'boolean',
|
||||
default: true,
|
||||
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)
|
||||
.map(actionsUsedInWorkflow)
|
||||
.flatten()
|
||||
.uniq()
|
||||
.sort()
|
||||
.value()
|
||||
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