1
0
mirror of synced 2026-01-09 15:02:41 -05:00

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

This commit is contained in:
Octomerger Bot
2020-11-24 10:26:47 -08:00
committed by GitHub
24 changed files with 179 additions and 132 deletions

View File

@@ -0,0 +1,36 @@
#!/usr/bin/env node
const fs = require('fs')
const core = require('@actions/core')
const eventPayload = JSON.parse(fs.readFileSync(process.env.GITHUB_EVENT_PATH, 'utf8'))
// This workflow-run script does the following:
// 1. Gets an array of labels on a PR.
// 2. Finds one with the relevant Algolia text; if none found, exits early.
// 3. Gets the version substring from the label string.
const labelText = 'sync-english-index-for-'
const labelsArray = eventPayload.pull_request.labels
// Exit early if no labels are on this PR
if (!(labelsArray && labelsArray.length)) {
process.exit(0)
}
// Find the relevant label
const algoliaLabel = labelsArray
.map(label => label.name)
.find(label => label.startsWith(labelText))
// Exit early if no relevant label is found
if (!algoliaLabel) {
process.exit(0)
}
// Given: sync-english-index-for-enterprise-server@3.0
// Returns: enterprise-server@3.0
const versionToSync = algoliaLabel.split(labelText)[1]
// Store the version so we can access it later in the workflow
core.setOutput('versionToSync', versionToSync)
process.exit(0)

View File

@@ -3,6 +3,8 @@ name: Algolia Sync Single English Index
on:
pull_request:
types:
- labeled
- unlabeled
- opened
- reopened
- synchronize
@@ -13,7 +15,7 @@ on:
jobs:
updateIndices:
name: Update English index for single version based on a label's version
if: github.repository == 'github/docs-internal' && startsWith(github.event.label.name, 'sync-english-index-for-')
if: github.repository == 'github/docs-internal'
runs-on: ubuntu-latest
steps:
- name: checkout
@@ -30,13 +32,13 @@ jobs:
${{ runner.os }}-node-
- name: npm ci
run: npm ci
- name: Get version from label
- name: Get version from Algolia label if present; only continue if the label is found.
id: getVersion
run: |
echo "::set-output name=version::$(github.event.label.name.split('sync-english-index-for-')[1])"
- name: Sync English index for single version
run: $GITHUB_WORKSPACE/.github/actions-scripts/enterprise-algolia-label.js
- if: ${{ steps.getVersion.outputs.versionToSync }}
name: Sync English index for single version
env:
VERSION: ${{ steps.getVersion.outputs.version }}
VERSION: ${{ steps.getVersion.outputs.versionToSync }}
LANGUAGE: 'en'
ALGOLIA_APPLICATION_ID: ${{ secrets.ALGOLIA_APPLICATION_ID }}
ALGOLIA_API_KEY: ${{ secrets.ALGOLIA_API_KEY }}

View File

@@ -91,7 +91,7 @@ steps:
### Caching dependencies
You can cache your dependencies to speed up your workflow runs. After a successful run, your local Gradle package cache will be stored on GitHub Actions infrastructure. In future workflow runs, the cache will be restored so that dependencies don't need to be downloaded from remote package repositories. For more information, see "[Caching dependencies to speed up workflows](/actions/automating-your-workflow-with-github-actions/caching-dependencies-to-speed-up-workflows)" and the [`cache` action](https://github.com/marketplace/actions/cache).
When using {% data variables.product.prodname_dotcom %}-hosted runners, you can cache your dependencies to speed up your workflow runs. After a successful run, your local Gradle package cache will be stored on GitHub Actions infrastructure. In future workflow runs, the cache will be restored so that dependencies don't need to be downloaded from remote package repositories. For more information, see "<a href="/actions/guides/caching-dependencies-to-speed-up-workflows" class="dotcom-only">Caching dependencies to speed up workflows</a>" and the [`cache` action](https://github.com/marketplace/actions/cache).
{% raw %}
```yaml

View File

@@ -91,7 +91,7 @@ steps:
### Caching dependencies
You can cache your dependencies to speed up your workflow runs. After a successful run, your local Maven repository will be stored on GitHub Actions infrastructure. In future workflow runs, the cache will be restored so that dependencies don't need to be downloaded from remote Maven repositories. For more information, see "[Caching dependencies to speed up workflows](/actions/automating-your-workflow-with-github-actions/caching-dependencies-to-speed-up-workflows)" and the [`cache` action](https://github.com/marketplace/actions/cache).
When using {% data variables.product.prodname_dotcom %}-hosted runners, you can cache your dependencies to speed up your workflow runs. After a successful run, your local Maven repository will be stored on GitHub Actions infrastructure. In future workflow runs, the cache will be restored so that dependencies don't need to be downloaded from remote Maven repositories. For more information, see "<a href="/actions/guides/caching-dependencies-to-speed-up-workflows" class="dotcom-only">Caching dependencies to speed up workflows</a>" and the [`cache` action](https://github.com/marketplace/actions/cache).
{% raw %}
```yaml

View File

@@ -129,7 +129,7 @@ If you don't specify a Node.js version, {% data variables.product.prodname_dotco
{% data variables.product.prodname_dotcom %}-hosted runners have npm and Yarn dependency managers installed. You can use npm and Yarn to install dependencies in your workflow before building and testing your code. The Windows and Linux {% data variables.product.prodname_dotcom %}-hosted runners also have Grunt, Gulp, and Bower installed.
You can also cache dependencies to speed up your workflow. For more information, see "[Caching dependencies to speed up your workflow](/actions/automating-your-workflow-with-github-actions/caching-dependencies-to-speed-up-workflows)."
When using {% data variables.product.prodname_dotcom %}-hosted runners, you can also cache dependencies to speed up your workflow. For more information, see "<a href="/actions/guides/caching-dependencies-to-speed-up-workflows" class="dotcom-only">Caching dependencies to speed up workflows</a>."
#### Example using npm
@@ -227,7 +227,7 @@ always-auth=true
#### Example caching dependencies
You can cache dependencies using a unique key, and restore the dependencies when you run future workflows using the `cache` action. For more information, see "[Caching dependencies to speed up workflows](/actions/automating-your-workflow-with-github-actions/caching-dependencies-to-speed-up-workflows)" and the [`cache` action](https://github.com/marketplace/actions/cache).
When using {% data variables.product.prodname_dotcom %}-hosted runners, you can cache dependencies using a unique key, and restore the dependencies when you run future workflows using the `cache` action. For more information, see "<a href="/actions/guides/caching-dependencies-to-speed-up-workflows" class="dotcom-only">Caching dependencies to speed up workflows</a>" and the [`cache` action](https://github.com/marketplace/actions/cache).
{% raw %}
```yaml
@@ -241,7 +241,7 @@ steps:
uses: actions/cache@v2
with:
# npm cache files are stored in `~/.npm` on Linux/macOS
path: ~/.npm
path: ~/.npm
key: ${{ runner.OS }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.OS }}-node-

View File

@@ -30,7 +30,7 @@ We recommend that you have a basic understanding of PowerShell and Pester. For m
### Adding a workflow for Pester
To automate your testing with PowerShell and Pester, you can add a workflow that runs every time a change is pushed to your repository. In the following example, `Test-Path` is used to check that a file called `resultsfile.log` is present.
To automate your testing with PowerShell and Pester, you can add a workflow that runs every time a change is pushed to your repository. In the following example, `Test-Path` is used to check that a file called `resultsfile.log` is present.
This example workflow file must be added to your repository's `.github/workflows/` directory:
@@ -57,7 +57,7 @@ jobs:
{% endraw %}
* `shell: pwsh` - Configures the job to use PowerShell when running the `run` commands.
* `run: Test-Path resultsfile.log` - Check whether a file called `resultsfile.log` is present in the repository's root directory.
* `run: Test-Path resultsfile.log` - Check whether a file called `resultsfile.log` is present in the repository's root directory.
* `Should -Be $true` - Uses Pester to define an expected result. If the result is unexpected, then {% data variables.product.prodname_actions %} flags this as a failed test. For example:
![Failed Pester test](/assets/images/help/repository/actions-failed-pester-test.png)
@@ -83,7 +83,7 @@ The table below describes the locations for various PowerShell modules in each {
### Installing dependencies
{% data variables.product.prodname_dotcom %}-hosted runners have PowerShell 7 and Pester installed. You can use `Install-Module` to install additional dependencies from the PowerShell Gallery before building and testing your code.
{% data variables.product.prodname_dotcom %}-hosted runners have PowerShell 7 and Pester installed. You can use `Install-Module` to install additional dependencies from the PowerShell Gallery before building and testing your code.
{% note %}
@@ -91,7 +91,7 @@ The table below describes the locations for various PowerShell modules in each {
{% endnote %}
You can also cache dependencies to speed up your workflow. For more information, see "[Caching dependencies to speed up your workflow](/actions/automating-your-workflow-with-github-actions/caching-dependencies-to-speed-up-workflows)."
When using {% data variables.product.prodname_dotcom %}-hosted runners, you can also cache dependencies to speed up your workflow. For more information, see "<a href="/actions/guides/caching-dependencies-to-speed-up-workflows" class="dotcom-only">Caching dependencies to speed up workflows</a>."
For example, the following job installs the `SqlServer` and `PSScriptAnalyzer` modules:
@@ -119,7 +119,7 @@ jobs:
#### Caching dependencies
You can cache PowerShell dependencies using a unique key, which allows you to restore the dependencies for future workflows with the [`cache`](https://github.com/marketplace/actions/cache) action. For more information, see "[Caching dependencies to speed up workflows](/actions/automating-your-workflow-with-github-actions/caching-dependencies-to-speed-up-workflows)."
When using {% data variables.product.prodname_dotcom %}-hosted runners, you can cache PowerShell dependencies using a unique key, which allows you to restore the dependencies for future workflows with the [`cache`](https://github.com/marketplace/actions/cache) action. For more information, see "<a href="/actions/guides/caching-dependencies-to-speed-up-workflows" class="dotcom-only">Caching dependencies to speed up workflows</a>."
PowerShell caches its dependencies in different locations, depending on the runner's operating system. For example, the `path` location used in the following Ubuntu example will be different for a Windows operating system.

View File

@@ -141,9 +141,9 @@ jobs:
uses: actions/setup-python@v2
with:
# Semantic version range syntax or exact version of a Python version
python-version: '3.x'
python-version: '3.x'
# Optional - x64 or x86 architecture, defaults to x64
architecture: 'x64'
architecture: 'x64'
# You can test your matrix by printing the current Python version
- name: Display Python version
run: python -c "import sys; print(sys.version)"
@@ -192,7 +192,7 @@ We recommend using `setup-python` to configure the version of Python used in you
{% data variables.product.prodname_dotcom %}-hosted runners have the pip package manager installed. You can use pip to install dependencies from the PyPI package registry before building and testing your code. For example, the YAML below installs or upgrades the `pip` package installer and the `setuptools` and `wheel` packages.
You can also cache dependencies to speed up your workflow. For more information, see "[Caching dependencies to speed up your workflow](/actions/automating-your-workflow-with-github-actions/caching-dependencies-to-speed-up-workflows)."
When using {% data variables.product.prodname_dotcom %}-hosted runners, you can also cache dependencies to speed up your workflow. For more information, see "<a href="/actions/guides/caching-dependencies-to-speed-up-workflows" class="dotcom-only">Caching dependencies to speed up workflows</a>."
{% raw %}
```yaml
@@ -228,7 +228,7 @@ steps:
#### Caching Dependencies
You can cache pip dependencies using a unique key, and restore the dependencies when you run future workflows using the [`cache`](https://github.com/marketplace/actions/cache) action. For more information, see "[Caching dependencies to speed up workflows](/actions/automating-your-workflow-with-github-actions/caching-dependencies-to-speed-up-workflows)."
When using {% data variables.product.prodname_dotcom %}-hosted runners, you can cache pip dependencies using a unique key, and restore the dependencies when you run future workflows using the [`cache`](https://github.com/marketplace/actions/cache) action. For more information, see "<a href="/actions/guides/caching-dependencies-to-speed-up-workflows" class="dotcom-only">Caching dependencies to speed up workflows</a>."
Pip caches dependencies in different locations, depending on the operating system of the runner. The path you'll need to cache may differ from the Ubuntu example below depending on the operating system you use. For more information, see [Python caching examples](https://github.com/actions/cache/blob/main/examples.md#python---pip).

View File

@@ -148,7 +148,7 @@ steps:
#### Caching dependencies
The `setup-ruby` actions provides a method to automatically handle the caching of your gems between runs.
If you are using {% data variables.product.prodname_dotcom %}-hosted runners, the `setup-ruby` actions provides a method to automatically handle the caching of your gems between runs.
To enable caching, set the following.
@@ -165,7 +165,7 @@ This will configure bundler to install your gems to `vendor/cache`. For each suc
**Caching without setup-ruby**
For greater control over caching, you can use the `actions/cache` Action directly. For more information, see "[Caching dependencies to speed up your workflow](/actions/automating-your-workflow-with-github-actions/caching-dependencies-to-speed-up-workflows)."
For greater control over caching, if you are using {% data variables.product.prodname_dotcom %}-hosted runners, you can use the `actions/cache` Action directly. For more information, see "<a href="/actions/guides/caching-dependencies-to-speed-up-workflows" class="dotcom-only">Caching dependencies to speed up workflows</a>."
{% raw %}
```yaml

View File

@@ -12,11 +12,11 @@ versions:
### Overview
This article describes some of the advanced features of {% data variables.product.prodname_actions %} that help you work create more complex workflows.
This article describes some of the advanced features of {% data variables.product.prodname_actions %} that help you work create more complex workflows.
### Storing secrets
If your workflows use sensitive data, such as passwords or certificates, you can save these in {% data variables.product.prodname_dotcom %} as _secrets_ and then use them in your workflows as environment variables. This means that you will be able to create and share workflows without having to embed sensitive values directly in the YAML workflow.
If your workflows use sensitive data, such as passwords or certificates, you can save these in {% data variables.product.prodname_dotcom %} as _secrets_ and then use them in your workflows as environment variables. This means that you will be able to create and share workflows without having to embed sensitive values directly in the YAML workflow.
This example action demonstrates how to reference an existing secret as an environment variable, and send it as a parameter to an example command.
@@ -57,7 +57,7 @@ jobs:
needs: build
runs-on: ubuntu-latest
steps:
- run: ./test_server.sh
- run: ./test_server.sh
```
For more information, see [`jobs.<job_id>.needs`](/actions/reference/workflow-syntax-for-github-actions#jobsjob_idneeds).
@@ -85,7 +85,7 @@ For more information, see [`jobs.<job_id>.strategy.matrix`](/actions/reference/w
### Caching dependencies
{% data variables.product.prodname_dotcom %}-hosted runners are started as fresh environments for each job, so if your jobs regularly reuse dependencies, you can consider caching these files to help improve performance. Once the cache is created, it is available to all workflows in the same repository.
{% data variables.product.prodname_dotcom %}-hosted runners are started as fresh environments for each job, so if your jobs regularly reuse dependencies, you can consider caching these files to help improve performance. Once the cache is created, it is available to all workflows in the same repository.
This example demonstrates how to cache the ` ~/.npm` directory:
@@ -106,7 +106,7 @@ jobs:
```
{% endraw %}
For more information, see "[Caching dependencies to speed up workflows](/actions/configuring-and-managing-workflows/caching-dependencies-to-speed-up-workflows)."
For more information, see "<a href="/actions/guides/caching-dependencies-to-speed-up-workflows" class="dotcom-only">Caching dependencies to speed up workflows</a>."
### Using databases and service containers
@@ -136,7 +136,7 @@ For more information, see "[Using databases and service containers](/actions/con
### Using labels to route workflows
This feature helps you assign jobs to a specific self-hosted runner. If you want to be sure that a particular type of runner will process your job, you can use labels to control where jobs are executed. You can assign labels to a self-hosted runner, and then refer to these labels in your YAML workflow, ensuring that the job is routed in a predictable way.
This feature helps you assign jobs to a specific self-hosted runner. If you want to be sure that a particular type of runner will process your job, you can use labels to control where jobs are executed. You can assign labels to a self-hosted runner, and then refer to these labels in your YAML workflow, ensuring that the job is routed in a predictable way.
This example shows how a workflow can use labels to specify the required runner:

View File

@@ -101,7 +101,7 @@ GitHub Actions
</tr>
</table>
For more information, see "[Caching dependencies to speed up workflows](/actions/configuring-and-managing-workflows/caching-dependencies-to-speed-up-workflows)."
{% data variables.product.prodname_actions %} caching is only applicable to {% data variables.product.prodname_dotcom %}-hosted runners. For more information, see "<a href="/actions/guides/caching-dependencies-to-speed-up-workflows" class="dotcom-only">Caching dependencies to speed up workflows</a>."
{% data variables.product.prodname_actions %} does not have an equivalent of CircleCIs Docker Layer Caching (or DLC).

View File

@@ -262,7 +262,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- run: echo "This job will be run first, in parallel with build_a"
test_ab:
runs-on: ubuntu-latest
needs: [build_a,build_b]
@@ -346,7 +346,7 @@ jobs:
</tr>
</table>
For more information, see "[Caching dependencies to speed up workflows](/actions/guides/caching-dependencies-to-speed-up-workflows)."
{% data variables.product.prodname_actions %} caching is only applicable to {% data variables.product.prodname_dotcom %}-hosted runners. For more information, see "<a href="/actions/guides/caching-dependencies-to-speed-up-workflows" class="dotcom-only">Caching dependencies to speed up workflows</a>."
### Artifacts
@@ -367,7 +367,7 @@ GitLab CI/CD
<td class="d-table-cell v-align-top">
{% raw %}
```yaml
script:
script:
artifacts:
paths:
- math-homework.txt
@@ -414,7 +414,7 @@ GitLab CI/CD
container-job:
variables:
POSTGRES_PASSWORD: postgres
# The hostname used to communicate with the
# The hostname used to communicate with the
# PostgreSQL service container
POSTGRES_HOST: postgres
# The default PostgreSQL port
@@ -423,10 +423,10 @@ container-job:
services:
- postgres
script:
# Performs a clean installation of all dependencies
# Performs a clean installation of all dependencies
# in the `package.json` file
- npm ci
# Runs a script that creates a PostgreSQL client,
# Runs a script that creates a PostgreSQL client,
# populates the client with data, and retrieves data
- node client.js
tags:
@@ -452,7 +452,7 @@ jobs:
- name: Check out repository code
uses: actions/checkout@v2
# Performs a clean installation of all dependencies
# Performs a clean installation of all dependencies
# in the `package.json` file
- name: Install dependencies
run: npm ci
@@ -462,7 +462,7 @@ jobs:
# populates the client with data, and retrieves data
run: node client.js
env:
# The hostname used to communicate with the
# The hostname used to communicate with the
# PostgreSQL service container
POSTGRES_HOST: postgres
# The default PostgreSQL port

View File

@@ -184,7 +184,7 @@ When migrating from Travis CI, consider the following key features in {% data va
#### Hosting your own runners
If your jobs require specific hardware or software, {% data variables.product.prodname_actions %} allows you to host your own runners and send your jobs to them for processing. {% data variables.product.prodname_actions %} also lets you use policies to control how these runners are accessed, granting access at the organization or repository level. For more information, see ["Hosting your own runners](/actions/hosting-your-own-runners)."
If your jobs require specific hardware or software, {% data variables.product.prodname_actions %} allows you to host your own runners and send your jobs to them for processing. {% data variables.product.prodname_actions %} also lets you use policies to control how these runners are accessed, granting access at the organization or repository level. For more information, see ["Hosting your own runners](/actions/hosting-your-own-runners)."
#### Concurrent jobs and execution time
@@ -213,7 +213,7 @@ For example:
shell: bash
```
### Error handling in {% data variables.product.prodname_actions %}
### Error handling in {% data variables.product.prodname_actions %}
When migrating to {% data variables.product.prodname_actions %}, there are different approaches to error handling that you might need to be aware of.
@@ -288,7 +288,7 @@ jobs:
### Caching dependencies
Travis CI and {% data variables.product.prodname_actions %} let you manually cache dependencies for later reuse. This example demonstrates the cache syntax for each system.
Travis CI and {% data variables.product.prodname_actions %} let you manually cache dependencies for later reuse. This example demonstrates the cache syntax for each system.
<table>
<tr>
@@ -323,7 +323,7 @@ cache: npm
</tr>
</table>
For more information, see "[Caching dependencies to speed up workflows](/actions/guides/caching-dependencies-to-speed-up-workflows)."
{% data variables.product.prodname_actions %} caching is only applicable to {% data variables.product.prodname_dotcom %}-hosted runners. For more information, see "<a href="/actions/guides/caching-dependencies-to-speed-up-workflows" class="dotcom-only">Caching dependencies to speed up workflows</a>."
### Examples of common tasks

View File

@@ -76,6 +76,7 @@ For more information, see:
- "[Disabling or limiting {% data variables.product.prodname_actions %} for your organization](/github/setting-up-and-managing-organizations-and-teams/disabling-or-limiting-github-actions-for-your-organization)"{% if currentVersion == "free-pro-team@latest" %}
- "[Enforcing {% data variables.product.prodname_actions %} policies in your enterprise account](/github/setting-up-and-managing-your-enterprise/enforcing-github-actions-policies-in-your-enterprise-account)" for {% data variables.product.prodname_ghe_cloud %}{% endif %}
{% if currentVersion == "free-pro-team@latest" or currentVersion ver_gt "enterprise-server@2.22" %}
### Disabling and enabling workflows
You can enable and disable individual workflows in your repository on {% data variables.product.prodname_dotcom %}.
@@ -83,3 +84,4 @@ You can enable and disable individual workflows in your repository on {% data va
{% data reusables.actions.scheduled-workflows-disabled %}
For more information, see "[Disabling and enabling a workflow](/actions/managing-workflow-runs/disabling-and-enabling-a-workflow)."
{% endif %}

View File

@@ -67,7 +67,7 @@ If the user accepts your request, GitHub redirects back to your site with a temp
{% endnote %}
Exchange this `code` for an access token. {% if currentVersion == "free-pro-team@latest" or currentVersion ver_gt "enterprise-server@2.21" or currentVersion == "github-ae@latest" %} When expiring tokens are enabled, the access token expires in 8 hours and the refresh token expires in 6 months. Every time you refresh the token, you get a new refresh token. For more information, see "[Refreshing user-to-server access tokens](/apps/building-github-apps/refreshing-user-to-server-access-tokens/)."
Exchange this `code` for an access token. {% if currentVersion == "free-pro-team@latest" or currentVersion ver_gt "enterprise-server@2.21" or currentVersion == "github-ae@latest" %} When expiring tokens are enabled, the access token expires in 8 hours and the refresh token expires in 6 months. Every time you refresh the token, you get a new refresh token. For more information, see "[Refreshing user-to-server access tokens](/developers/apps/refreshing-user-to-server-access-tokens)."
Expiring user tokens are currently part of the user-to-server token expiration beta and subject to change. To opt-in to the user-to-server token expiration beta feature, see "[Activating beta features for apps](/developers/apps/activating-beta-features-for-apps)."{% endif %}
@@ -462,7 +462,7 @@ While most of your API interaction should occur using your server-to-server inst
* [List teams](/v3/teams/#list-teams)
* [Create a team](/v3/teams/#create-a-team)
* [Get a team by name](/v3/teams/#get-a-team-by-name)
* [Get a team by name](/v3/teams/#get-a-team-by-name)
{% if enterpriseServerVersions contains currentVersion and currentVersion ver_lt "enterprise-server@2.21" %}
* [Get a team](/v3/teams/#get-a-team)
{% endif %}
@@ -484,7 +484,7 @@ While most of your API interaction should occur using your server-to-server inst
* [Get an organization](/v3/orgs/#get-an-organization)
* [Update an organization](/v3/orgs/#update-an-organization)
* [List organization memberships for the authenticated user](/v3/orgs/members/#list-organization-memberships-for-the-authenticated-user)
* [Get an organization membership for the authenticated user](/v3/orgs/members/#get-an-organization-membership-for-the-authenticated-user)
* [Get an organization membership for the authenticated user](/v3/orgs/members/#get-an-organization-membership-for-the-authenticated-user)
* [Update an organization membership for the authenticated user](/v3/orgs/members/#update-an-organization-membership-for-the-authenticated-user)
* [List organizations for the authenticated user](/v3/orgs/#list-organizations-for-the-authenticated-user)
* [List organizations for a user](/v3/orgs/#list-organizations-for-a-user)
@@ -824,7 +824,7 @@ While most of your API interaction should occur using your server-to-server inst
* [List commit statuses for a reference](/v3/repos/statuses/#list-commit-statuses-for-a-reference)
* [Create a commit status](/v3/repos/statuses/#create-a-commit-status)
##### Team Discussions
##### Team Discussions
* [List discussions](/v3/teams/discussions/#list-discussions)
* [Create a discussion](/v3/teams/discussions/#create-a-discussion)

View File

@@ -15,11 +15,14 @@ versions:
github-ae: '*'
---
{% if currentVersion == "free-pro-team@latest" or currentVersion ver_gt "enterprise-server@2.22" or currentVersion ver_gt "github-ae@latest" %}
### About release management
{% if currentVersion == "free-pro-team@latest" %}
You can also publish an action from a specific release in {% data variables.product.prodname_marketplace %}. For more information, see "<a href="/actions/creating-actions/publishing-actions-in-github-marketplace" class="dotcom-only">Publishing an action in the {% data variables.product.prodname_marketplace %}</a>."
{% endif %}
{% if currentVersion == "free-pro-team@latest" or currentVersion ver_gt "enterprise-server@2.22" or currentVersion == "github-ae@latest" %}
You can choose whether {% data variables.large_files.product_name_long %} ({% data variables.large_files.product_name_short %}) objects are included in the ZIP files and tarballs that {% data variables.product.product_name %} creates for each release. For more information, see "[Managing {% data variables.large_files.product_name_short %} objects in archives of your repository](/github/administering-a-repository/managing-git-lfs-objects-in-archives-of-your-repository)."
{% endif %}

View File

@@ -1,4 +1,4 @@
{% if currentVersion == "free-pro-team@latest" or currentVersion ver_gt "enterprise-server@2.21" or currentVersion == "github-ae@latest" %}
{% if currentVersion == "free-pro-team@latest" %}
{% note %}
**Note:** Expiring user tokens are currently part of the user-to-server token expiration beta and subject to change. To opt-in to the user-to-server token expiration beta feature, see "[Activating beta features for apps](/developers/apps/activating-beta-features-for-apps)." For more information, see "[Expiring user-to-server access tokens for GitHub Apps](https://developer.github.com/changes/2020-04-30-expiring-user-to-server-access-tokens-for-github-apps)."

View File

@@ -1,11 +1,11 @@
const cheerio = require('cheerio')
const findPage = require('./find-page')
const findPageInVersion = require('./find-page-in-version')
const renderContent = require('./render-content')
const rewriteLocalLinks = require('./rewrite-local-links')
const getApplicableVersions = require('./get-applicable-versions')
const nonEnterpriseDefaultVersion = require('./non-enterprise-default-version')
const { getPathWithoutLanguage } = require('./path-utils')
const { getEnterpriseVersionNumber } = require('./patterns')
const { deprecated } = require('./enterprise-server-releases')
const { getEnterpriseVersionNumber, adminProduct } = require('./patterns')
const { deprecated, latest } = require('./enterprise-server-releases')
// internal links will have a language code by the time we're testing them
// we also want to capture same-page anchors (#foo)
@@ -59,7 +59,15 @@ module.exports = async function checkLinks ($, page, context, version, checkedLi
if (gheVersionInLink && deprecated.includes(gheVersionInLink[1])) continue
// look for linked page
const linkedPage = findPage(link, context.pages, context.redirects, languageCode)
const isDotcomOnly = $(internalLink).attr('class')
// special case for GHES Admin links on dotcom, which are not broken; they go to the latest GHES version
let versionToCheck = version
if (version === nonEnterpriseDefaultVersion && adminProduct.test(link)) {
versionToCheck = `enterprise-server@${latest}`
}
const linkedPage = findPageInVersion(link, context.pages, context.redirects, languageCode, versionToCheck, isDotcomOnly)
if (!linkedPage) {
brokenLinks.links.push({ 'broken link': link, reason: 'linked page not found' })
@@ -79,16 +87,6 @@ module.exports = async function checkLinks ($, page, context, version, checkedLi
.filter(operation => operation.operationId.startsWith(docsPath))
}
// finding the linked page isn't enough if it's a github.com page; also need to check versions
if (linkedPage.relativePath.startsWith('github')) {
const linkedPageVersions = getApplicableVersions(linkedPage.versions, linkedPage.relativePath)
if (!linkedPageVersions.includes(version) && $(internalLink).attr('class') !== 'dotcom-only') {
brokenLinks.links.push({ 'broken link': link, reason: `${version} not found in linked page versions`, 'linked page': linkedPage.fullPath })
continue
}
}
// collect elements of the page that may contain links
const linkedPageContent = linkedPage.relativePath.includes('graphql/reference/objects')
? linkedPage.markdown + context.graphql.prerenderedObjectsForCurrentVersion.html

View File

@@ -1,11 +1,11 @@
const cheerio = require('cheerio')
const findPage = require('./find-page')
const findPageInVersion = require('./find-page-in-version')
const renderContent = require('./render-content')
const rewriteLocalLinks = require('./rewrite-local-links')
const getApplicableVersions = require('./get-applicable-versions')
const nonEnterpriseDefaultVersion = require('./non-enterprise-default-version')
const { getPathWithoutLanguage } = require('./path-utils')
const { getEnterpriseVersionNumber } = require('./patterns')
const { deprecated } = require('./enterprise-server-releases')
const { getEnterpriseVersionNumber, adminProduct } = require('./patterns')
const { deprecated, latest } = require('./enterprise-server-releases')
// internal links will have a language code by the time we're testing them
// we also want to capture same-page anchors (#foo)
@@ -59,23 +59,21 @@ module.exports = async function checkLinks ($, page, context, version, checkedLi
if (gheVersionInLink && deprecated.includes(gheVersionInLink[1])) continue
// look for linked page
const linkedPage = findPage(link, context.pages, context.redirects, languageCode)
const isDotcomOnly = $(internalLink).attr('class')
// special case for GHES Admin links on dotcom, which are not broken; they go to the latest GHES version
let versionToCheck = version
if (version === nonEnterpriseDefaultVersion && adminProduct.test(link)) {
versionToCheck = `enterprise-server@${latest}`
}
const linkedPage = findPageInVersion(link, context.pages, context.redirects, languageCode, versionToCheck, isDotcomOnly)
if (!linkedPage) {
brokenLinks.links.push({ 'broken link': link, reason: 'linked page not found' })
continue
}
// finding the linked page isn't enough if it's a github.com page; also need to check versions
if (linkedPage.relativePath.startsWith('github')) {
const linkedPageVersions = getApplicableVersions(linkedPage.versions, linkedPage.relativePath)
if (!linkedPageVersions.includes(version) && $(internalLink).attr('class') !== 'dotcom-only') {
brokenLinks.links.push({ 'broken link': link, reason: `${version} not found in linked page versions`, 'linked page': linkedPage.fullPath })
continue
}
}
// don't check anchors on developers content
if (linkedPage.relativePath.match(/^(rest|graphql|developers)/)) continue

View File

@@ -0,0 +1,22 @@
const findPage = require('./find-page')
const getApplicableVersions = require('./get-applicable-versions')
module.exports = function findPageInVersion (href, pages, redirects, languageCode, version, isDotcomOnly = false) {
// findPage() will throw an error if an English page can't be found
const page = findPage(href, pages, redirects, languageCode)
if (!page) return null
// if the link is on the homepage, return the page as soon as it's found
if (version === 'homepage') return page
// if the link is dotcom-only, return the page as soon as it's found
if (isDotcomOnly) return page
// otherwise, get the versions that the found page is available in
const applicableVersions = getApplicableVersions(page.versions, page.fullPath)
// return null if the found page's available versions do not include the specified version
if (!applicableVersions.includes(version)) return null
return page
}

View File

@@ -4,8 +4,7 @@ const Liquid = require('liquid')
const liquid = new Liquid.Engine()
const { getPathWithLanguage } = require('../path-utils')
const LiquidTag = require('./liquid-tag')
const findPage = require('../find-page')
const getApplicableVersions = require('../get-applicable-versions')
const findPageInVersion = require('../find-page-in-version')
// This class supports a set of link tags. Each tag expects one parameter, a language-agnostic href:
//
@@ -56,20 +55,11 @@ module.exports = class Link extends LiquidTag {
fullPath = getPathWithLanguage(fullPath, ctx.currentLanguage)
// find the page based on the full path
const page = findPage(fullPath, ctx.pages, ctx.redirects, ctx.currentLanguage)
// workaround for localized links that can't be found because they are not in sync
if (!page) return ''
// get versions of the found page
const applicableVersions = getApplicableVersions(page.versions, fullPath)
// check whether the page versions include the current version
const shouldLinkRenderInCurrentVersion = applicableVersions.includes(ctx.currentVersion)
const page = findPageInVersion(fullPath, ctx.pages, ctx.redirects, ctx.currentLanguage, ctx.currentVersion)
// if found page should NOT render in current version, return early with an empty string
// also return if it's a hidden link on a non-hidden page (hidden links on hidden pages are OK)
if (!shouldLinkRenderInCurrentVersion || (page.hidden && !ctx.page.hidden)) {
if (!page || (page.hidden && !ctx.page.hidden)) {
return ''
}

View File

@@ -22,19 +22,30 @@ function getVersionedPathWithoutLanguage (href, version) {
// example: enterprise-server@2.22 or free-pro-team@latest
let versionFromPath = getVersionStringFromPath(href)
// if versionFromPath doesn't match any current versions, this may be an old
// versioned path that should be converted to new versioned path. Examples:
// OLD: /enterprise/2.22/admin/installation OR /enterprise/admin/installation
// NEW: /enterprise-server@2.22/admin/installation
// OLD: /desktop/installing-and-configuring-github-desktop
// NEW: /free-pro-team@latest/desktop/installing-and-configuring-github-desktop
// if the version found is not a currently supported version...
let productObjectFromPath
if (!Object.keys(allVersions).includes(versionFromPath)) {
href = getNewVersionedPath(href)
versionFromPath = getVersionStringFromPath(href)
// first check if the first segment is instead a current product;
// example: /admin/foo or /desktop/foo
productObjectFromPath = allProducts[versionFromPath]
// if so, add the first supported version for that product to the href
if (productObjectFromPath) {
href = path.join('/', productObjectFromPath.versions[0], href)
versionFromPath = productObjectFromPath.versions[0]
} else {
// otherwise, this may be an old path that should be converted to new path;
// OLD: /enterprise/2.22/admin/installation OR /enterprise/admin/installation
// NEW: /enterprise-server@2.22/admin/installation
href = getNewVersionedPath(href)
versionFromPath = getVersionStringFromPath(href)
}
}
// derive the product from the path (e.g., github or admin) and get corresponding object
const productObjectFromPath = getProductObjectFromPath(href)
// if not previously found, derive the product object from the path (e.g., github or admin)
if (!productObjectFromPath) {
productObjectFromPath = getProductObjectFromPath(href)
}
// if the product's versions don't include the specified version, nothing to change!
if (productObjectFromPath && !productObjectFromPath.versions.includes(version)) {

View File

@@ -1,6 +1,5 @@
const path = require('path')
const findPage = require('./find-page')
const getApplicableVersions = require('./get-applicable-versions')
const findPageInVersion = require('./find-page-in-version')
const products = Object.values(require('../lib/all-products'))
const { getVersionedPathWithoutLanguage } = require('./path-utils')
const languageCodes = Object.keys(require('./languages'))
@@ -39,7 +38,10 @@ module.exports = async function buildSiteTree (pages, site, redirects) {
product.href = item.href
// find the product TOC page and get TOC items
const page = findPage(item.href, pages, redirects, languageCode)
const page = findPageInVersion(item.href, pages, redirects, languageCode, version)
// skip if page can't be found in this version
if (!page) return
product.categories = buildCategoriesTree(page.tocItems, item.href, pages, redirects, version, languageCode)
@@ -69,17 +71,13 @@ function buildCategoriesTree (tocItems, productHref, pages, redirects, version,
category.href = versionedCategoryHref
// find the category TOC page and get its TOC items
const page = findPage(categoryHref, pages, redirects, languageCode)
const page = findPageInVersion(categoryHref, pages, redirects, languageCode, version)
// skip if translated page can't be found
if (!page && languageCode !== 'en') return
// skip if page can't be found in this version
if (!page) return
category.title = page.shortTitle || page.title
if (!getApplicableVersions(page.versions, page.fullPath).includes(version)) {
return
}
// support standalone pages at the category level, like actions/quickstart.md
if (!page.tocItems) {
category.standalone = true
@@ -120,18 +118,14 @@ function buildMaptopicsTree (tocItems, categoryHref, pages, redirects, version,
// we already have access to the child articles via the category TOC items
// but we still need the page to get the available versions
const page = findPage(maptopicHref, pages, redirects, languageCode)
const page = findPageInVersion(maptopicHref, pages, redirects, languageCode, version)
// skip if translated page can't be found
if (!page && languageCode !== 'en') return
// skip if page can't be found in this version
if (!page) return
// if this is not a maptopic, return early
if (!page.mapTopic) return
if (!getApplicableVersions(page.versions, page.fullPath).includes(version)) {
return
}
const childArticles = getChildArticles(tocItems, item.href)
maptopic.title = page.title
@@ -163,17 +157,13 @@ function buildArticlesTree (tocItems, categoryHref, pages, redirects, version, l
const versionedArticleHref = getVersionedPathWithoutLanguage(articleHref, version)
article.href = versionedArticleHref
const page = findPage(articleHref, pages, redirects, languageCode)
const page = findPageInVersion(articleHref, pages, redirects, languageCode, version)
// skip if translated page can't be found
if (!page && languageCode !== 'en') return
// skip if page can't be found in this version
if (!page) return
article.title = page.shortTitle || page.title
if (!getApplicableVersions(page.versions, page.fullPath).includes(version)) {
return
}
articleTree[versionedArticleHref] = article
})

View File

@@ -1,5 +1,4 @@
const findPage = require('../lib/find-page')
const getApplicableVersions = require('../lib/get-applicable-versions')
const findPageInVersion = require('../lib/find-page-in-version')
const { getVersionedPathWithLanguage } = require('../lib/path-utils')
// this middleware adds properties to the context object
@@ -30,14 +29,9 @@ async function getLinkData (rawLinks, context) {
? getVersionedPathWithLanguage(link.href, context.currentVersion, context.currentLanguage)
: getVersionedPathWithLanguage(link, context.currentVersion, context.currentLanguage)
const linkedPage = findPage(href, context.pages, context.redirects, context.currentLanguage)
const linkedPage = findPageInVersion(href, context.pages, context.redirects, context.currentLanguage, context.currentVersion)
if (!linkedPage) continue
const applicableVersions = getApplicableVersions(linkedPage.versions, linkedPage.fullPath)
// skip link if this is not the homepage and the link's versions do not include the current version
if (context.currentVersion !== 'homepage' && !applicableVersions.includes(context.currentVersion)) continue
const opts = { textOnly: true, encodeEntities: true }
links.push({

View File

@@ -77,6 +77,7 @@
"webpack-cli": "^3.3.12"
},
"devDependencies": {
"@actions/core": "^1.2.6",
"ajv": "^6.11.0",
"async": "^3.2.0",
"await-sleep": "0.0.1",