From 5822fa474766805e618127cc6ee3d31ab2dcf998 Mon Sep 17 00:00:00 2001 From: Sarah Schneider Date: Thu, 12 Nov 2020 13:28:32 -0500 Subject: [PATCH 01/18] add new module --- lib/find-page-in-version.js | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 lib/find-page-in-version.js diff --git a/lib/find-page-in-version.js b/lib/find-page-in-version.js new file mode 100644 index 0000000000..21f55f02c3 --- /dev/null +++ b/lib/find-page-in-version.js @@ -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 +} From 9bfaee1dc1f051b2e17cedb14f7621caacce2d03 Mon Sep 17 00:00:00 2001 From: Sarah Schneider Date: Thu, 12 Nov 2020 13:28:38 -0500 Subject: [PATCH 02/18] use new module --- lib/check-developer-links.js | 28 ++++++++++++-------------- lib/check-links.js | 28 ++++++++++++-------------- lib/liquid-tags/link.js | 16 +++------------ lib/path-utils.js | 31 +++++++++++++++++++---------- lib/site-tree.js | 38 +++++++++++++----------------------- 5 files changed, 64 insertions(+), 77 deletions(-) diff --git a/lib/check-developer-links.js b/lib/check-developer-links.js index 81cef84bde..e5e708be88 100644 --- a/lib/check-developer-links.js +++ b/lib/check-developer-links.js @@ -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 diff --git a/lib/check-links.js b/lib/check-links.js index 6729cb77bc..1d000da7f0 100644 --- a/lib/check-links.js +++ b/lib/check-links.js @@ -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 diff --git a/lib/liquid-tags/link.js b/lib/liquid-tags/link.js index c5160081a2..b583b006ec 100644 --- a/lib/liquid-tags/link.js +++ b/lib/liquid-tags/link.js @@ -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 '' } diff --git a/lib/path-utils.js b/lib/path-utils.js index f180d28f07..02e75aab1d 100644 --- a/lib/path-utils.js +++ b/lib/path-utils.js @@ -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)) { diff --git a/lib/site-tree.js b/lib/site-tree.js index cca006dccc..62facb3cad 100644 --- a/lib/site-tree.js +++ b/lib/site-tree.js @@ -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 }) From ae0aabf63685e8edca60ff8569d5a74f3f812a67 Mon Sep 17 00:00:00 2001 From: Sarah Schneider Date: Thu, 12 Nov 2020 13:31:47 -0500 Subject: [PATCH 03/18] update links (recreate https://github.com/github/docs-internal/pull/15486) --- .../building-and-testing-java-with-gradle.md | 2 +- .../building-and-testing-java-with-maven.md | 2 +- .../guides/building-and-testing-nodejs.md | 6 +++--- .../guides/building-and-testing-powershell.md | 10 +++++----- .../guides/building-and-testing-python.md | 8 ++++---- .../managing-complex-workflows.md | 12 ++++++------ .../migrating-from-circleci-to-github-actions.md | 2 +- ...grating-from-gitlab-cicd-to-github-actions.md | 16 ++++++++-------- ...migrating-from-travis-ci-to-github-actions.md | 8 ++++---- .../usage-limits-billing-and-administration.md | 2 ++ ...ying-and-authorizing-users-for-github-apps.md | 8 ++++---- .../webhook-events-and-payloads.md | 5 +++-- .../managing-releases-in-a-repository.md | 5 ++++- .../expiring-user-access-tokens-beta.md | 2 +- 14 files changed, 47 insertions(+), 41 deletions(-) diff --git a/content/actions/guides/building-and-testing-java-with-gradle.md b/content/actions/guides/building-and-testing-java-with-gradle.md index 2642fd35dd..0509514ba9 100644 --- a/content/actions/guides/building-and-testing-java-with-gradle.md +++ b/content/actions/guides/building-and-testing-java-with-gradle.md @@ -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 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 "Caching dependencies to speed up workflows" and the [`cache` action](https://github.com/marketplace/actions/cache). {% raw %} ```yaml diff --git a/content/actions/guides/building-and-testing-java-with-maven.md b/content/actions/guides/building-and-testing-java-with-maven.md index 278d8b1ed2..cfe0d3b317 100644 --- a/content/actions/guides/building-and-testing-java-with-maven.md +++ b/content/actions/guides/building-and-testing-java-with-maven.md @@ -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 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 "Caching dependencies to speed up workflows" and the [`cache` action](https://github.com/marketplace/actions/cache). {% raw %} ```yaml diff --git a/content/actions/guides/building-and-testing-nodejs.md b/content/actions/guides/building-and-testing-nodejs.md index b24bc1e181..06b9f638a8 100644 --- a/content/actions/guides/building-and-testing-nodejs.md +++ b/content/actions/guides/building-and-testing-nodejs.md @@ -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 data.variables.product.prodname_dotcom %}-hosted runners, you can also cache dependencies to speed up your workflow. For more information, see "Caching dependencies to speed up workflows." #### 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 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 "Caching dependencies to speed up workflows" 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- diff --git a/content/actions/guides/building-and-testing-powershell.md b/content/actions/guides/building-and-testing-powershell.md index 07802471c8..a0c058c0e4 100644 --- a/content/actions/guides/building-and-testing-powershell.md +++ b/content/actions/guides/building-and-testing-powershell.md @@ -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 data.variables.product.prodname_dotcom %}-hosted runners, you can also cache dependencies to speed up your workflow. For more information, see "Caching dependencies to speed up workflows." 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 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 "Caching dependencies to speed up workflows." 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. diff --git a/content/actions/guides/building-and-testing-python.md b/content/actions/guides/building-and-testing-python.md index 2dcf401f6d..e99a1f63da 100644 --- a/content/actions/guides/building-and-testing-python.md +++ b/content/actions/guides/building-and-testing-python.md @@ -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 data.variables.product.prodname_dotcom %}-hosted runners, you can also cache dependencies to speed up your workflow. For more information, see "Caching dependencies to speed up workflows." {% 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 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 "Caching dependencies to speed up workflows." 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). diff --git a/content/actions/learn-github-actions/managing-complex-workflows.md b/content/actions/learn-github-actions/managing-complex-workflows.md index ae35c35064..66ff5b77ae 100644 --- a/content/actions/learn-github-actions/managing-complex-workflows.md +++ b/content/actions/learn-github-actions/managing-complex-workflows.md @@ -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..needs`](/actions/reference/workflow-syntax-for-github-actions#jobsjob_idneeds). @@ -85,7 +85,7 @@ For more information, see [`jobs..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 "Caching dependencies to speed up workflows." ### 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: diff --git a/content/actions/learn-github-actions/migrating-from-circleci-to-github-actions.md b/content/actions/learn-github-actions/migrating-from-circleci-to-github-actions.md index 17d1431c82..463684b4b6 100644 --- a/content/actions/learn-github-actions/migrating-from-circleci-to-github-actions.md +++ b/content/actions/learn-github-actions/migrating-from-circleci-to-github-actions.md @@ -101,7 +101,7 @@ GitHub Actions -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 data.variables.product.prodname_dotcom %}-hosted runners. For more information, see "Caching dependencies to speed up workflows." {% data variables.product.prodname_actions %} does not have an equivalent of CircleCI’s Docker Layer Caching (or DLC). diff --git a/content/actions/learn-github-actions/migrating-from-gitlab-cicd-to-github-actions.md b/content/actions/learn-github-actions/migrating-from-gitlab-cicd-to-github-actions.md index 618503642e..ec552bc909 100644 --- a/content/actions/learn-github-actions/migrating-from-gitlab-cicd-to-github-actions.md +++ b/content/actions/learn-github-actions/migrating-from-gitlab-cicd-to-github-actions.md @@ -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: -For more information, see "[Caching dependencies to speed up workflows](/actions/guides/caching-dependencies-to-speed-up-workflows)." +For more information, see "Caching dependencies to speed up workflows." ### Artifacts @@ -367,7 +367,7 @@ GitLab CI/CD {% 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 diff --git a/content/actions/learn-github-actions/migrating-from-travis-ci-to-github-actions.md b/content/actions/learn-github-actions/migrating-from-travis-ci-to-github-actions.md index 2d95d8d0f7..f317f32aae 100644 --- a/content/actions/learn-github-actions/migrating-from-travis-ci-to-github-actions.md +++ b/content/actions/learn-github-actions/migrating-from-travis-ci-to-github-actions.md @@ -178,7 +178,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 @@ -207,7 +207,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. @@ -282,7 +282,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. @@ -317,7 +317,7 @@ cache: npm
-For more information, see "[Caching dependencies to speed up workflows](/actions/guides/caching-dependencies-to-speed-up-workflows)." +For more information, see "Caching dependencies to speed up workflows." ### Examples of common tasks diff --git a/content/actions/reference/usage-limits-billing-and-administration.md b/content/actions/reference/usage-limits-billing-and-administration.md index 1cc3b5a2e6..9029966809 100644 --- a/content/actions/reference/usage-limits-billing-and-administration.md +++ b/content/actions/reference/usage-limits-billing-and-administration.md @@ -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 %} diff --git a/content/developers/apps/identifying-and-authorizing-users-for-github-apps.md b/content/developers/apps/identifying-and-authorizing-users-for-github-apps.md index 60a7f9be39..fdf3748205 100644 --- a/content/developers/apps/identifying-and-authorizing-users-for-github-apps.md +++ b/content/developers/apps/identifying-and-authorizing-users-for-github-apps.md @@ -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 %} @@ -460,7 +460,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 %} @@ -482,7 +482,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) @@ -822,7 +822,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) diff --git a/content/developers/webhooks-and-events/webhook-events-and-payloads.md b/content/developers/webhooks-and-events/webhook-events-and-payloads.md index ee273ce0d1..94ecac6533 100644 --- a/content/developers/webhooks-and-events/webhook-events-and-payloads.md +++ b/content/developers/webhooks-and-events/webhook-events-and-payloads.md @@ -1287,7 +1287,7 @@ The event’s actor is the [user](/v3/users/) who starred a repository, and the {{ webhookPayloadsForCurrentVersion.watch.started }} -{% if currentVersion == "free-pro-team@latest" %} +{% if currentVersion == "free-pro-team@latest" or currentVersion ver_gt "enterprise-server@2.21" %} ### workflow_dispatch This event occurs when someone triggers a workflow run on GitHub or sends a `POST` request to the "[Create a workflow dispatch event](/rest/reference/actions/#create-a-workflow-dispatch-event)" endpoint. For more information, see "[Events that trigger workflows](/actions/reference/events-that-trigger-workflows#workflow_dispatch)." @@ -1299,7 +1299,6 @@ This event occurs when someone triggers a workflow run on GitHub or sends a `POS #### Webhook payload example {{ webhookPayloadsForCurrentVersion.workflow_dispatch }} -{% endif %} ### workflow_run @@ -1321,3 +1320,5 @@ Key | Type | Description #### Webhook payload example {{ webhookPayloadsForCurrentVersion.workflow_run }} + +{% endif %} diff --git a/content/github/administering-a-repository/managing-releases-in-a-repository.md b/content/github/administering-a-repository/managing-releases-in-a-repository.md index 32977281b8..0f4032a957 100644 --- a/content/github/administering-a-repository/managing-releases-in-a-repository.md +++ b/content/github/administering-a-repository/managing-releases-in-a-repository.md @@ -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 "Publishing an action in the {% data variables.product.prodname_marketplace %}." +{% 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 %} diff --git a/data/reusables/pre-release-program/expiring-user-access-tokens-beta.md b/data/reusables/pre-release-program/expiring-user-access-tokens-beta.md index 6bf0fb2ed4..7bed2bb577 100644 --- a/data/reusables/pre-release-program/expiring-user-access-tokens-beta.md +++ b/data/reusables/pre-release-program/expiring-user-access-tokens-beta.md @@ -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)." From d9b1fa9d40f7d6cc6f2c7a3777187cfdb4e50e25 Mon Sep 17 00:00:00 2001 From: Sarah Schneider Date: Thu, 12 Nov 2020 13:31:57 -0500 Subject: [PATCH 04/18] use new module --- middleware/featured-links.js | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/middleware/featured-links.js b/middleware/featured-links.js index ed58a26948..eeaba4fa34 100644 --- a/middleware/featured-links.js +++ b/middleware/featured-links.js @@ -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({ From e9c15f676237e4c943a6cfcd53402cf15227521d Mon Sep 17 00:00:00 2001 From: Sarah Schneider Date: Mon, 23 Nov 2020 13:14:10 -0500 Subject: [PATCH 05/18] Update content/actions/guides/building-and-testing-java-with-gradle.md Co-authored-by: Lucas Costi --- content/actions/guides/building-and-testing-java-with-gradle.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/actions/guides/building-and-testing-java-with-gradle.md b/content/actions/guides/building-and-testing-java-with-gradle.md index 0509514ba9..9a7b45671e 100644 --- a/content/actions/guides/building-and-testing-java-with-gradle.md +++ b/content/actions/guides/building-and-testing-java-with-gradle.md @@ -91,7 +91,7 @@ steps: ### Caching dependencies -When using {% data 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 "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 "Caching dependencies to speed up workflows" and the [`cache` action](https://github.com/marketplace/actions/cache). {% raw %} ```yaml From acc5f4953e4e930e294cd183276f4839ccd5d92a Mon Sep 17 00:00:00 2001 From: Sarah Schneider Date: Mon, 23 Nov 2020 13:14:28 -0500 Subject: [PATCH 06/18] Update content/actions/learn-github-actions/migrating-from-gitlab-cicd-to-github-actions.md Co-authored-by: Lucas Costi --- .../migrating-from-gitlab-cicd-to-github-actions.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/actions/learn-github-actions/migrating-from-gitlab-cicd-to-github-actions.md b/content/actions/learn-github-actions/migrating-from-gitlab-cicd-to-github-actions.md index ec552bc909..44dc243304 100644 --- a/content/actions/learn-github-actions/migrating-from-gitlab-cicd-to-github-actions.md +++ b/content/actions/learn-github-actions/migrating-from-gitlab-cicd-to-github-actions.md @@ -346,7 +346,7 @@ jobs: -For more information, see "Caching dependencies to speed up workflows." +{% data variables.product.prodname_actions %} caching is only applicable to {% data data.variables.product.prodname_dotcom %}-hosted runners. For more information, see "Caching dependencies to speed up workflows." ### Artifacts From aaa99ff53f73b4aee3c60a0c6d2585a2cd6e5808 Mon Sep 17 00:00:00 2001 From: Sarah Schneider Date: Mon, 23 Nov 2020 13:14:42 -0500 Subject: [PATCH 07/18] Update content/actions/learn-github-actions/migrating-from-travis-ci-to-github-actions.md Co-authored-by: Lucas Costi --- .../migrating-from-travis-ci-to-github-actions.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/actions/learn-github-actions/migrating-from-travis-ci-to-github-actions.md b/content/actions/learn-github-actions/migrating-from-travis-ci-to-github-actions.md index f317f32aae..04de1a76b7 100644 --- a/content/actions/learn-github-actions/migrating-from-travis-ci-to-github-actions.md +++ b/content/actions/learn-github-actions/migrating-from-travis-ci-to-github-actions.md @@ -317,7 +317,7 @@ cache: npm -For more information, see "Caching dependencies to speed up workflows." +{% data variables.product.prodname_actions %} caching is only applicable to {% data data.variables.product.prodname_dotcom %}-hosted runners. For more information, see "Caching dependencies to speed up workflows." ### Examples of common tasks From 3c6eb47fece818ca57c0b48558024b437cbc627d Mon Sep 17 00:00:00 2001 From: Sarah Schneider Date: Mon, 23 Nov 2020 13:27:20 -0500 Subject: [PATCH 08/18] fix data ref syntax --- .../actions/guides/building-and-testing-java-with-maven.md | 2 +- content/actions/guides/building-and-testing-nodejs.md | 4 ++-- content/actions/guides/building-and-testing-powershell.md | 4 ++-- content/actions/guides/building-and-testing-python.md | 4 ++-- .../migrating-from-circleci-to-github-actions.md | 2 +- .../migrating-from-gitlab-cicd-to-github-actions.md | 2 +- .../migrating-from-travis-ci-to-github-actions.md | 2 +- 7 files changed, 10 insertions(+), 10 deletions(-) diff --git a/content/actions/guides/building-and-testing-java-with-maven.md b/content/actions/guides/building-and-testing-java-with-maven.md index cfe0d3b317..f43330f7bd 100644 --- a/content/actions/guides/building-and-testing-java-with-maven.md +++ b/content/actions/guides/building-and-testing-java-with-maven.md @@ -91,7 +91,7 @@ steps: ### Caching dependencies -When using {% data 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 "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 "Caching dependencies to speed up workflows" and the [`cache` action](https://github.com/marketplace/actions/cache). {% raw %} ```yaml diff --git a/content/actions/guides/building-and-testing-nodejs.md b/content/actions/guides/building-and-testing-nodejs.md index 06b9f638a8..49f45da43e 100644 --- a/content/actions/guides/building-and-testing-nodejs.md +++ b/content/actions/guides/building-and-testing-nodejs.md @@ -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. -When using {% data data.variables.product.prodname_dotcom %}-hosted runners, you can also cache dependencies to speed up your workflow. For more information, see "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 "Caching dependencies to speed up workflows." #### Example using npm @@ -227,7 +227,7 @@ always-auth=true #### Example caching dependencies -When using {% data 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 "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 "Caching dependencies to speed up workflows" and the [`cache` action](https://github.com/marketplace/actions/cache). {% raw %} ```yaml diff --git a/content/actions/guides/building-and-testing-powershell.md b/content/actions/guides/building-and-testing-powershell.md index a0c058c0e4..ccfa14b990 100644 --- a/content/actions/guides/building-and-testing-powershell.md +++ b/content/actions/guides/building-and-testing-powershell.md @@ -91,7 +91,7 @@ The table below describes the locations for various PowerShell modules in each { {% endnote %} -When using {% data data.variables.product.prodname_dotcom %}-hosted runners, you can also cache dependencies to speed up your workflow. For more information, see "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 "Caching dependencies to speed up workflows." For example, the following job installs the `SqlServer` and `PSScriptAnalyzer` modules: @@ -119,7 +119,7 @@ jobs: #### Caching dependencies -When using {% data 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 "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 "Caching dependencies to speed up workflows." 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. diff --git a/content/actions/guides/building-and-testing-python.md b/content/actions/guides/building-and-testing-python.md index e99a1f63da..c1ab59cba5 100644 --- a/content/actions/guides/building-and-testing-python.md +++ b/content/actions/guides/building-and-testing-python.md @@ -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. -When using {% data data.variables.product.prodname_dotcom %}-hosted runners, you can also cache dependencies to speed up your workflow. For more information, see "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 "Caching dependencies to speed up workflows." {% raw %} ```yaml @@ -228,7 +228,7 @@ steps: #### Caching Dependencies -When using {% data 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 "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 "Caching dependencies to speed up workflows." 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). diff --git a/content/actions/learn-github-actions/migrating-from-circleci-to-github-actions.md b/content/actions/learn-github-actions/migrating-from-circleci-to-github-actions.md index 463684b4b6..497f6175fc 100644 --- a/content/actions/learn-github-actions/migrating-from-circleci-to-github-actions.md +++ b/content/actions/learn-github-actions/migrating-from-circleci-to-github-actions.md @@ -101,7 +101,7 @@ GitHub Actions -{% data variables.product.prodname_actions %} caching is only applicable to {% data data.variables.product.prodname_dotcom %}-hosted runners. For more information, see "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 "Caching dependencies to speed up workflows." {% data variables.product.prodname_actions %} does not have an equivalent of CircleCI’s Docker Layer Caching (or DLC). diff --git a/content/actions/learn-github-actions/migrating-from-gitlab-cicd-to-github-actions.md b/content/actions/learn-github-actions/migrating-from-gitlab-cicd-to-github-actions.md index 44dc243304..80d2f12511 100644 --- a/content/actions/learn-github-actions/migrating-from-gitlab-cicd-to-github-actions.md +++ b/content/actions/learn-github-actions/migrating-from-gitlab-cicd-to-github-actions.md @@ -346,7 +346,7 @@ jobs: -{% data variables.product.prodname_actions %} caching is only applicable to {% data data.variables.product.prodname_dotcom %}-hosted runners. For more information, see "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 "Caching dependencies to speed up workflows." ### Artifacts diff --git a/content/actions/learn-github-actions/migrating-from-travis-ci-to-github-actions.md b/content/actions/learn-github-actions/migrating-from-travis-ci-to-github-actions.md index 04de1a76b7..143c8df55b 100644 --- a/content/actions/learn-github-actions/migrating-from-travis-ci-to-github-actions.md +++ b/content/actions/learn-github-actions/migrating-from-travis-ci-to-github-actions.md @@ -317,7 +317,7 @@ cache: npm -{% data variables.product.prodname_actions %} caching is only applicable to {% data data.variables.product.prodname_dotcom %}-hosted runners. For more information, see "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 "Caching dependencies to speed up workflows." ### Examples of common tasks From 3cc870e1651f25e10f933618036e4b27ed1be9c3 Mon Sep 17 00:00:00 2001 From: Sarah Schneider Date: Mon, 23 Nov 2020 15:44:37 -0500 Subject: [PATCH 09/18] workflow should run on label events --- .github/workflows/sync-single-english-algolia-index.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/sync-single-english-algolia-index.yml b/.github/workflows/sync-single-english-algolia-index.yml index a35815cd87..41048aedd2 100644 --- a/.github/workflows/sync-single-english-algolia-index.yml +++ b/.github/workflows/sync-single-english-algolia-index.yml @@ -3,6 +3,8 @@ name: Algolia Sync Single English Index on: pull_request: types: + - labeled + - unlabeled - opened - reopened - synchronize From f0303416f577e9ffc4f6dacd531767328ea691fa Mon Sep 17 00:00:00 2001 From: Sarah Schneider Date: Mon, 23 Nov 2020 17:03:02 -0500 Subject: [PATCH 10/18] use js to find the version substring from the label string --- .../enterprise-algolia-label.js | 24 +++++++++++++++++++ .../sync-single-english-algolia-index.yml | 7 +++--- 2 files changed, 27 insertions(+), 4 deletions(-) create mode 100755 .github/actions-scripts/enterprise-algolia-label.js diff --git a/.github/actions-scripts/enterprise-algolia-label.js b/.github/actions-scripts/enterprise-algolia-label.js new file mode 100755 index 0000000000..bb8d8f8970 --- /dev/null +++ b/.github/actions-scripts/enterprise-algolia-label.js @@ -0,0 +1,24 @@ +#!/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: +// 1. Gets an array of labels on a PR +// 2. Finds one with the relevant Algolia text +// 3. Gets the version substring from the label string + +const labelText = 'sync-english-index-for-' +const labelsArray = eventPayload.pull_request.labels + +// Find the relevant label +const algoliaLabel = labelsArray.find(label => label.startsWith(labelText)) + +// 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) \ No newline at end of file diff --git a/.github/workflows/sync-single-english-algolia-index.yml b/.github/workflows/sync-single-english-algolia-index.yml index 41048aedd2..b89c1f481d 100644 --- a/.github/workflows/sync-single-english-algolia-index.yml +++ b/.github/workflows/sync-single-english-algolia-index.yml @@ -15,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' && contains(github.event.pull_request.labels.*.name, 'sync-english-index-for-') runs-on: ubuntu-latest steps: - name: checkout @@ -34,11 +34,10 @@ jobs: run: npm ci - name: Get version from label id: getVersion - run: | - echo "::set-output name=version::$(github.event.label.name.split('sync-english-index-for-')[1])" + run: $GITHUB_WORKSPACE/.github/actions-scripts/enterprise-algolia-label.js - 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 }} From a0909636646f5ac08029ea1c6b2a26848b2945d7 Mon Sep 17 00:00:00 2001 From: Lucas Costi Date: Tue, 24 Nov 2020 10:54:44 +1000 Subject: [PATCH 11/18] Fix caching link in ruby article for GHES --- content/actions/guides/building-and-testing-ruby.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/content/actions/guides/building-and-testing-ruby.md b/content/actions/guides/building-and-testing-ruby.md index 3a8fc3bb89..c3c091109e 100644 --- a/content/actions/guides/building-and-testing-ruby.md +++ b/content/actions/guides/building-and-testing-ruby.md @@ -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 "Caching dependencies to speed up workflows." {% raw %} ```yaml From 8c3be7d8c4d72ca52835fba9b934b02b061a6dab Mon Sep 17 00:00:00 2001 From: Sarah Schneider Date: Tue, 24 Nov 2020 11:49:20 -0500 Subject: [PATCH 12/18] run the script to check labels at the start of the workflow; exit if none is found --- .../enterprise-algolia-label.js | 13 +++++++---- .../sync-single-english-algolia-index.yml | 23 +++++++++++-------- 2 files changed, 23 insertions(+), 13 deletions(-) diff --git a/.github/actions-scripts/enterprise-algolia-label.js b/.github/actions-scripts/enterprise-algolia-label.js index bb8d8f8970..273f0f73fb 100755 --- a/.github/actions-scripts/enterprise-algolia-label.js +++ b/.github/actions-scripts/enterprise-algolia-label.js @@ -4,10 +4,10 @@ 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: -// 1. Gets an array of labels on a PR -// 2. Finds one with the relevant Algolia text -// 3. Gets the version substring from the label string +// 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 @@ -15,6 +15,11 @@ const labelsArray = eventPayload.pull_request.labels // Find the relevant label const algoliaLabel = labelsArray.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] diff --git a/.github/workflows/sync-single-english-algolia-index.yml b/.github/workflows/sync-single-english-algolia-index.yml index b89c1f481d..b616107489 100644 --- a/.github/workflows/sync-single-english-algolia-index.yml +++ b/.github/workflows/sync-single-english-algolia-index.yml @@ -15,27 +15,32 @@ on: jobs: updateIndices: name: Update English index for single version based on a label's version - if: github.repository == 'github/docs-internal' && contains(github.event.pull_request.labels.*.name, 'sync-english-index-for-') + if: github.repository == 'github/docs-internal' runs-on: ubuntu-latest steps: - - name: checkout + - name: Get version from label if present + id: getVersion + run: $GITHUB_WORKSPACE/.github/actions-scripts/enterprise-algolia-label.js + - if: ${{ steps.getVersion.outputs.versionToSync }} + name: checkout uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f - - uses: actions/setup-node@56899e050abffc08c2b3b61f3ec6a79a9dc3223d + - if: ${{ steps.getVersion.outputs.versionToSync }} + uses: actions/setup-node@56899e050abffc08c2b3b61f3ec6a79a9dc3223d with: node-version: 14.x - - name: cache node modules + - if: ${{ steps.getVersion.outputs.versionToSync }} + name: cache node modules uses: actions/cache@0781355a23dac32fd3bac414512f4b903437991a with: path: ~/.npm key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} restore-keys: | ${{ runner.os }}-node- - - name: npm ci + - if: ${{ steps.getVersion.outputs.versionToSync }} + name: npm ci run: npm ci - - name: Get version from label - id: getVersion - run: $GITHUB_WORKSPACE/.github/actions-scripts/enterprise-algolia-label.js - - name: Sync English index for single version + - if: ${{ steps.getVersion.outputs.versionToSync }} + name: Sync English index for single version env: VERSION: ${{ steps.getVersion.outputs.versionToSync }} LANGUAGE: 'en' From 43b99c7e42e8158910075ed3f266a1e291f336b0 Mon Sep 17 00:00:00 2001 From: Sarah Schneider Date: Tue, 24 Nov 2020 11:55:43 -0500 Subject: [PATCH 13/18] remove WORKSPACE path --- .github/workflows/sync-single-english-algolia-index.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/sync-single-english-algolia-index.yml b/.github/workflows/sync-single-english-algolia-index.yml index b616107489..2ba242d93d 100644 --- a/.github/workflows/sync-single-english-algolia-index.yml +++ b/.github/workflows/sync-single-english-algolia-index.yml @@ -20,7 +20,7 @@ jobs: steps: - name: Get version from label if present id: getVersion - run: $GITHUB_WORKSPACE/.github/actions-scripts/enterprise-algolia-label.js + run: .github/actions-scripts/enterprise-algolia-label.js - if: ${{ steps.getVersion.outputs.versionToSync }} name: checkout uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f From 070387adc32701881b710b4ed3cc5ba76c92c0c5 Mon Sep 17 00:00:00 2001 From: Sarah Schneider Date: Tue, 24 Nov 2020 12:05:20 -0500 Subject: [PATCH 14/18] checkout first --- .github/workflows/sync-single-english-algolia-index.yml | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/.github/workflows/sync-single-english-algolia-index.yml b/.github/workflows/sync-single-english-algolia-index.yml index 2ba242d93d..9b52901a1a 100644 --- a/.github/workflows/sync-single-english-algolia-index.yml +++ b/.github/workflows/sync-single-english-algolia-index.yml @@ -18,12 +18,11 @@ jobs: if: github.repository == 'github/docs-internal' runs-on: ubuntu-latest steps: - - name: Get version from label if present - id: getVersion - run: .github/actions-scripts/enterprise-algolia-label.js - - if: ${{ steps.getVersion.outputs.versionToSync }} - name: checkout + - name: checkout uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f + - name: Get version from Algolia label if present; do not continue if the label is not found. + id: getVersion + run: $GITHUB_WORKSPACE/.github/actions-scripts/enterprise-algolia-label.js - if: ${{ steps.getVersion.outputs.versionToSync }} uses: actions/setup-node@56899e050abffc08c2b3b61f3ec6a79a9dc3223d with: From c14ab26e401e313a6c859731ff13b76304c924e0 Mon Sep 17 00:00:00 2001 From: Sarah Schneider Date: Tue, 24 Nov 2020 12:10:15 -0500 Subject: [PATCH 15/18] ran npm i @actions/core --save-dev --- package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/package.json b/package.json index 66f45b24db..574f4d0f7b 100644 --- a/package.json +++ b/package.json @@ -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", From 3829c9423639f22ab29efde03cab4edb465cd432 Mon Sep 17 00:00:00 2001 From: Sarah Schneider Date: Tue, 24 Nov 2020 12:12:34 -0500 Subject: [PATCH 16/18] we need to install deps etc --- .../sync-single-english-algolia-index.yml | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/.github/workflows/sync-single-english-algolia-index.yml b/.github/workflows/sync-single-english-algolia-index.yml index 9b52901a1a..2338b0555c 100644 --- a/.github/workflows/sync-single-english-algolia-index.yml +++ b/.github/workflows/sync-single-english-algolia-index.yml @@ -20,24 +20,21 @@ jobs: steps: - name: checkout uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f - - name: Get version from Algolia label if present; do not continue if the label is not found. - id: getVersion - run: $GITHUB_WORKSPACE/.github/actions-scripts/enterprise-algolia-label.js - - if: ${{ steps.getVersion.outputs.versionToSync }} - uses: actions/setup-node@56899e050abffc08c2b3b61f3ec6a79a9dc3223d + - uses: actions/setup-node@56899e050abffc08c2b3b61f3ec6a79a9dc3223d with: node-version: 14.x - - if: ${{ steps.getVersion.outputs.versionToSync }} - name: cache node modules + - name: cache node modules uses: actions/cache@0781355a23dac32fd3bac414512f4b903437991a with: path: ~/.npm key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} restore-keys: | ${{ runner.os }}-node- - - if: ${{ steps.getVersion.outputs.versionToSync }} - name: npm ci + - name: npm ci run: npm ci + - name: Get version from Algolia label if present; only continue if the label is found. + id: getVersion + run: $GITHUB_WORKSPACE/.github/actions-scripts/enterprise-algolia-label.js - if: ${{ steps.getVersion.outputs.versionToSync }} name: Sync English index for single version env: From 0476553fb8ced8d2a64f3ce194c3fc9b983cda46 Mon Sep 17 00:00:00 2001 From: Sarah Schneider Date: Tue, 24 Nov 2020 12:35:20 -0500 Subject: [PATCH 17/18] exit early if no labels are found --- .github/actions-scripts/enterprise-algolia-label.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/actions-scripts/enterprise-algolia-label.js b/.github/actions-scripts/enterprise-algolia-label.js index 273f0f73fb..2563db2d0b 100755 --- a/.github/actions-scripts/enterprise-algolia-label.js +++ b/.github/actions-scripts/enterprise-algolia-label.js @@ -12,6 +12,11 @@ const eventPayload = JSON.parse(fs.readFileSync(process.env.GITHUB_EVENT_PATH, ' 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.find(label => label.startsWith(labelText)) From 62bfc32ace18f5c8f1e412d5368ceb1b95929200 Mon Sep 17 00:00:00 2001 From: Sarah Schneider Date: Tue, 24 Nov 2020 12:38:45 -0500 Subject: [PATCH 18/18] label array items are objects --- .github/actions-scripts/enterprise-algolia-label.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/actions-scripts/enterprise-algolia-label.js b/.github/actions-scripts/enterprise-algolia-label.js index 2563db2d0b..c412ff84dc 100755 --- a/.github/actions-scripts/enterprise-algolia-label.js +++ b/.github/actions-scripts/enterprise-algolia-label.js @@ -18,7 +18,9 @@ if (!(labelsArray && labelsArray.length)) { } // Find the relevant label -const algoliaLabel = labelsArray.find(label => label.startsWith(labelText)) +const algoliaLabel = labelsArray + .map(label => label.name) + .find(label => label.startsWith(labelText)) // Exit early if no relevant label is found if (!algoliaLabel) {