Skip to content

Commit 1aaa294

Browse files
authored
Branch was updated using the 'autoupdate branch' Actions workflow.
2 parents 739b2c3 + 878e0a6 commit 1aaa294

24 files changed

Lines changed: 179 additions & 132 deletions
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#!/usr/bin/env node
2+
3+
const fs = require('fs')
4+
const core = require('@actions/core')
5+
const eventPayload = JSON.parse(fs.readFileSync(process.env.GITHUB_EVENT_PATH, 'utf8'))
6+
7+
// This workflow-run script does the following:
8+
// 1. Gets an array of labels on a PR.
9+
// 2. Finds one with the relevant Algolia text; if none found, exits early.
10+
// 3. Gets the version substring from the label string.
11+
12+
const labelText = 'sync-english-index-for-'
13+
const labelsArray = eventPayload.pull_request.labels
14+
15+
// Exit early if no labels are on this PR
16+
if (!(labelsArray && labelsArray.length)) {
17+
process.exit(0)
18+
}
19+
20+
// Find the relevant label
21+
const algoliaLabel = labelsArray
22+
.map(label => label.name)
23+
.find(label => label.startsWith(labelText))
24+
25+
// Exit early if no relevant label is found
26+
if (!algoliaLabel) {
27+
process.exit(0)
28+
}
29+
30+
// Given: sync-english-index-for-enterprise-server@3.0
31+
// Returns: enterprise-server@3.0
32+
const versionToSync = algoliaLabel.split(labelText)[1]
33+
34+
// Store the version so we can access it later in the workflow
35+
core.setOutput('versionToSync', versionToSync)
36+
process.exit(0)

.github/workflows/sync-single-english-algolia-index.yml

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ name: Algolia Sync Single English Index
33
on:
44
pull_request:
55
types:
6+
- labeled
7+
- unlabeled
68
- opened
79
- reopened
810
- synchronize
@@ -13,7 +15,7 @@ on:
1315
jobs:
1416
updateIndices:
1517
name: Update English index for single version based on a label's version
16-
if: github.repository == 'github/docs-internal' && startsWith(github.event.label.name, 'sync-english-index-for-')
18+
if: github.repository == 'github/docs-internal'
1719
runs-on: ubuntu-latest
1820
steps:
1921
- name: checkout
@@ -30,13 +32,13 @@ jobs:
3032
${{ runner.os }}-node-
3133
- name: npm ci
3234
run: npm ci
33-
- name: Get version from label
35+
- name: Get version from Algolia label if present; only continue if the label is found.
3436
id: getVersion
35-
run: |
36-
echo "::set-output name=version::$(github.event.label.name.split('sync-english-index-for-')[1])"
37-
- name: Sync English index for single version
37+
run: $GITHUB_WORKSPACE/.github/actions-scripts/enterprise-algolia-label.js
38+
- if: ${{ steps.getVersion.outputs.versionToSync }}
39+
name: Sync English index for single version
3840
env:
39-
VERSION: ${{ steps.getVersion.outputs.version }}
41+
VERSION: ${{ steps.getVersion.outputs.versionToSync }}
4042
LANGUAGE: 'en'
4143
ALGOLIA_APPLICATION_ID: ${{ secrets.ALGOLIA_APPLICATION_ID }}
4244
ALGOLIA_API_KEY: ${{ secrets.ALGOLIA_API_KEY }}

content/actions/guides/building-and-testing-java-with-gradle.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ steps:
9191

9292
### Caching dependencies
9393

94-
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).
94+
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).
9595

9696
{% raw %}
9797
```yaml

content/actions/guides/building-and-testing-java-with-maven.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ steps:
9191

9292
### Caching dependencies
9393

94-
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).
94+
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).
9595

9696
{% raw %}
9797
```yaml

content/actions/guides/building-and-testing-nodejs.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ If you don't specify a Node.js version, {% data variables.product.prodname_dotco
129129
130130
{% 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.
131131
132-
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)."
132+
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>."
133133
134134
#### Example using npm
135135
@@ -227,7 +227,7 @@ always-auth=true
227227

228228
#### Example caching dependencies
229229

230-
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).
230+
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).
231231

232232
{% raw %}
233233
```yaml
@@ -241,7 +241,7 @@ steps:
241241
uses: actions/cache@v2
242242
with:
243243
# npm cache files are stored in `~/.npm` on Linux/macOS
244-
path: ~/.npm
244+
path: ~/.npm
245245
key: ${{ runner.OS }}-node-${{ hashFiles('**/package-lock.json') }}
246246
restore-keys: |
247247
${{ runner.OS }}-node-

content/actions/guides/building-and-testing-powershell.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ We recommend that you have a basic understanding of PowerShell and Pester. For m
3030

3131
### Adding a workflow for Pester
3232

33-
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.
33+
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.
3434

3535
This example workflow file must be added to your repository's `.github/workflows/` directory:
3636

@@ -57,7 +57,7 @@ jobs:
5757
{% endraw %}
5858
5959
* `shell: pwsh` - Configures the job to use PowerShell when running the `run` commands.
60-
* `run: Test-Path resultsfile.log` - Check whether a file called `resultsfile.log` is present in the repository's root directory.
60+
* `run: Test-Path resultsfile.log` - Check whether a file called `resultsfile.log` is present in the repository's root directory.
6161
* `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:
6262

6363
![Failed Pester test](/assets/images/help/repository/actions-failed-pester-test.png)
@@ -83,15 +83,15 @@ The table below describes the locations for various PowerShell modules in each {
8383
8484
### Installing dependencies
8585
86-
{% 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.
86+
{% 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.
8787
8888
{% note %}
8989
9090
**Note:** The pre-installed packages (such as Pester) used by {% data variables.product.prodname_dotcom %}-hosted runners are regularly updated, and can introduce significant changes. As a result, it is recommended that you always specify the required package versions by using `Install-Module` with `-MaximumVersion`.
9191
9292
{% endnote %}
9393
94-
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)."
94+
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>."
9595
9696
For example, the following job installs the `SqlServer` and `PSScriptAnalyzer` modules:
9797
@@ -119,7 +119,7 @@ jobs:
119119

120120
#### Caching dependencies
121121

122-
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)."
122+
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>."
123123

124124
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.
125125

content/actions/guides/building-and-testing-python.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -141,9 +141,9 @@ jobs:
141141
uses: actions/setup-python@v2
142142
with:
143143
# Semantic version range syntax or exact version of a Python version
144-
python-version: '3.x'
144+
python-version: '3.x'
145145
# Optional - x64 or x86 architecture, defaults to x64
146-
architecture: 'x64'
146+
architecture: 'x64'
147147
# You can test your matrix by printing the current Python version
148148
- name: Display Python version
149149
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
192192

193193
{% 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.
194194

195-
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)."
195+
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>."
196196

197197
{% raw %}
198198
```yaml
@@ -228,7 +228,7 @@ steps:
228228

229229
#### Caching Dependencies
230230

231-
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)."
231+
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>."
232232

233233
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).
234234

content/actions/guides/building-and-testing-ruby.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ steps:
148148

149149
#### Caching dependencies
150150

151-
The `setup-ruby` actions provides a method to automatically handle the caching of your gems between runs.
151+
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.
152152

153153
To enable caching, set the following.
154154

@@ -165,7 +165,7 @@ This will configure bundler to install your gems to `vendor/cache`. For each suc
165165

166166
**Caching without setup-ruby**
167167

168-
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)."
168+
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>."
169169

170170
{% raw %}
171171
```yaml

content/actions/learn-github-actions/managing-complex-workflows.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@ versions:
1212

1313
### Overview
1414

15-
This article describes some of the advanced features of {% data variables.product.prodname_actions %} that help you work create more complex workflows.
15+
This article describes some of the advanced features of {% data variables.product.prodname_actions %} that help you work create more complex workflows.
1616

1717
### Storing secrets
1818

19-
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.
19+
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.
2020

2121
This example action demonstrates how to reference an existing secret as an environment variable, and send it as a parameter to an example command.
2222

@@ -57,7 +57,7 @@ jobs:
5757
needs: build
5858
runs-on: ubuntu-latest
5959
steps:
60-
- run: ./test_server.sh
60+
- run: ./test_server.sh
6161
```
6262

6363
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
8585

8686
### Caching dependencies
8787

88-
{% 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.
88+
{% 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.
8989

9090
This example demonstrates how to cache the ` ~/.npm` directory:
9191

@@ -106,7 +106,7 @@ jobs:
106106
```
107107
{% endraw %}
108108

109-
For more information, see "[Caching dependencies to speed up workflows](/actions/configuring-and-managing-workflows/caching-dependencies-to-speed-up-workflows)."
109+
For more information, see "<a href="/actions/guides/caching-dependencies-to-speed-up-workflows" class="dotcom-only">Caching dependencies to speed up workflows</a>."
110110

111111
### Using databases and service containers
112112

@@ -136,7 +136,7 @@ For more information, see "[Using databases and service containers](/actions/con
136136

137137
### Using labels to route workflows
138138

139-
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.
139+
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.
140140

141141
This example shows how a workflow can use labels to specify the required runner:
142142

content/actions/learn-github-actions/migrating-from-circleci-to-github-actions.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ GitHub Actions
101101
</tr>
102102
</table>
103103
104-
For more information, see "[Caching dependencies to speed up workflows](/actions/configuring-and-managing-workflows/caching-dependencies-to-speed-up-workflows)."
104+
{% 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>."
105105
106106
{% data variables.product.prodname_actions %} does not have an equivalent of CircleCI’s Docker Layer Caching (or DLC).
107107

0 commit comments

Comments
 (0)