From 0f796df753f270c77793a0f97a273309a5312daa Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Fri, 6 Jan 2023 17:53:00 +0100 Subject: [PATCH 1/3] contextualize features before computing current product tree (#33793) Co-authored-by: Kevin Heis --- middleware/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/middleware/index.js b/middleware/index.js index 90b84298ea..faa324123f 100644 --- a/middleware/index.js +++ b/middleware/index.js @@ -267,10 +267,10 @@ export default function (app) { app.use(asyncMiddleware(instrument(ghaeReleaseNotes, './contextualizers/ghae-release-notes'))) app.use(asyncMiddleware(instrument(whatsNewChangelog, './contextualizers/whats-new-changelog'))) app.use(instrument(layout, './contextualizers/layout')) + app.use(instrument(features, './contextualizers/features')) // needs to come before product tree app.use(asyncMiddleware(instrument(currentProductTree, './contextualizers/current-product-tree'))) app.use(asyncMiddleware(instrument(genericToc, './contextualizers/generic-toc'))) app.use(instrument(breadcrumbs, './contextualizers/breadcrumbs')) - app.use(instrument(features, './contextualizers/features')) app.use(asyncMiddleware(instrument(productExamples, './contextualizers/product-examples'))) app.use(asyncMiddleware(instrument(productGroups, './contextualizers/product-groups'))) app.use(instrument(glossaries, './contextualizers/glossaries')) From 59602497f6cb165ed4c2f42e990f3a93b51a7a4a Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Fri, 6 Jan 2023 17:59:34 +0100 Subject: [PATCH 2/3] remove leftover nocking (#33791) --- tests/content/featured-links.js | 21 +-------------------- 1 file changed, 1 insertion(+), 20 deletions(-) diff --git a/tests/content/featured-links.js b/tests/content/featured-links.js index b2dbca5e7d..99991569e5 100644 --- a/tests/content/featured-links.js +++ b/tests/content/featured-links.js @@ -1,30 +1,11 @@ -import fs from 'fs/promises' -import path from 'path' -import { fileURLToPath } from 'url' - -import { beforeAll, jest } from '@jest/globals' -import nock from 'nock' +import { jest } from '@jest/globals' import { getDOM, getJSON } from '../helpers/e2etest.js' import enterpriseServerReleases from '../../lib/enterprise-server-releases.js' -const __dirname = path.dirname(fileURLToPath(import.meta.url)) - describe('featuredLinks', () => { jest.setTimeout(3 * 60 * 1000) - beforeAll(async () => { - const packagesFeedFixturePayload = await fs.readFile( - path.join(__dirname, '../fixtures/github-blog-feed-packages-2021.xml'), - 'utf-8' - ) - nock('https://github.blog') - .get('/changelog/label/packages/feed') - .reply(200, packagesFeedFixturePayload) - }) - - afterAll(() => nock.cleanAll()) - describe('rendering', () => { test('non-TOC pages do not have intro links', async () => { const $ = await getDOM('/en/get-started/quickstart/set-up-git') From 6dbe33bd543f437f43e5d79b0a59368197797148 Mon Sep 17 00:00:00 2001 From: Sarah Schneider Date: Fri, 6 Jan 2023 12:21:19 -0500 Subject: [PATCH 3/3] Fix bug in lint-versions test (#33798) --- .../removing-self-hosted-runners.md | 2 +- content/admin/guides.md | 5 ++--- content/admin/index.md | 7 +++---- script/helpers/get-liquid-conditionals.js | 1 + tests/linting/lint-versioning.js | 12 ++---------- 5 files changed, 9 insertions(+), 18 deletions(-) diff --git a/content/actions/hosting-your-own-runners/removing-self-hosted-runners.md b/content/actions/hosting-your-own-runners/removing-self-hosted-runners.md index 04b8943ee1..897cd4754d 100644 --- a/content/actions/hosting-your-own-runners/removing-self-hosted-runners.md +++ b/content/actions/hosting-your-own-runners/removing-self-hosted-runners.md @@ -1,6 +1,6 @@ --- title: Removing self-hosted runners -intro: 'You can permanently remove a self-hosted runner from a repository{% ifversion fpt %} or organization{% elsif ghec or ghes or gahe %}, an organization, or an enterprise{% endif %}.' +intro: 'You can permanently remove a self-hosted runner from a repository{% ifversion fpt %} or organization{% elsif ghec or ghes or ghae %}, an organization, or an enterprise{% endif %}.' redirect_from: - /github/automating-your-workflow-with-github-actions/removing-self-hosted-runners - /actions/automating-your-workflow-with-github-actions/removing-self-hosted-runners diff --git a/content/admin/guides.md b/content/admin/guides.md index 8f8afba403..dd6c11429f 100644 --- a/content/admin/guides.md +++ b/content/admin/guides.md @@ -17,8 +17,8 @@ learningTracks: - adopting_github_actions_for_your_enterprise_ghes_and_ghae - '{% ifversion ghes %}increase_fault_tolerance{% endif %}' - '{% ifversion ghes %}improve_security_of_your_instance{% endif %}' - - '{% ifversion ghes > 2.22 %}configure_github_actions{% endif %}' - - '{% ifversion ghes > 2.22 %}configure_github_advanced_security{% endif %}' + - '{% ifversion ghes %}configure_github_actions{% endif %}' + - '{% ifversion ghes %}configure_github_advanced_security{% endif %}' includeGuides: - /admin/authentication/allowing-built-in-authentication-for-users-outside-your-identity-provider - /admin/authentication/changing-authentication-methods @@ -148,4 +148,3 @@ includeGuides: - /admin/overview/creating-an-enterprise-account - /admin/user-management/managing-organizations-in-your-enterprise/restoring-a-deleted-organization --- - diff --git a/content/admin/index.md b/content/admin/index.md index c7d2c76233..5a846b0799 100644 --- a/content/admin/index.md +++ b/content/admin/index.md @@ -80,9 +80,9 @@ featuredLinks: - '{% ifversion ghec %}/admin/user-management/managing-users-in-your-enterprise/roles-in-an-enterprise{% endif %}' - '{% ifversion ghec %}/admin/user-management/managing-organizations-in-your-enterprise/adding-organizations-to-your-enterprise{% endif %}' guideCards: - - '{% ifversion ghes > 2.22 %} /admin/github-actions/getting-started-with-github-actions-for-github-enterprise-server {% elsif ghes < 3.0 %} /admin/enterprise-management/upgrading-github-enterprise-server {% endif %}' - - '{% ifversion ghes > 2.22 %} /admin/packages/getting-started-with-github-packages-for-your-enterprise {% elsif ghes < 3.0 %} /admin/user-management/customizing-user-messages-for-your-enterprise {% endif %}' - - '{% ifversion ghes > 2.22 %} /admin/configuration/configuring-advanced-security-features {% elsif ghes < 3.0 %} /admin/installation/setting-up-a-staging-instance {% endif %}' + - '{% ifversion ghes %}/admin/github-actions/getting-started-with-github-actions-for-github-enterprise-server{% endif %}' + - '{% ifversion ghes %}/admin/packages/getting-started-with-github-packages-for-your-enterprise{% endif %}' + - '{% ifversion ghes %}/admin/configuration/configuring-advanced-security-features{% endif %}' - '{% ifversion ghae %}/admin/configuration/initializing-github-ae{% endif %}' - '{% ifversion ghae %}/admin/user-management/customizing-user-messages-for-your-enterprise{% endif %}' - '{% ifversion ghae %}/admin/github-actions/getting-started-with-github-actions-for-github-ae{% endif %}' @@ -126,4 +126,3 @@ children: - /release-notes - /all-releases --- - diff --git a/script/helpers/get-liquid-conditionals.js b/script/helpers/get-liquid-conditionals.js index 9143f92058..d2f5064833 100644 --- a/script/helpers/get-liquid-conditionals.js +++ b/script/helpers/get-liquid-conditionals.js @@ -11,6 +11,7 @@ const tokenize = (str) => { // Return an array of just the conditional strings. function getLiquidConditionals(str, tagNames) { if (!tagNames) throw new Error(`Must provide a tag name!`) + if (typeof str !== 'string') throw new Error('Must provide a string!') tagNames = Array.isArray(tagNames) ? tagNames : [tagNames] return tokenize(str) diff --git a/tests/linting/lint-versioning.js b/tests/linting/lint-versioning.js index efca480c6f..d547e3fdd1 100644 --- a/tests/linting/lint-versioning.js +++ b/tests/linting/lint-versioning.js @@ -8,7 +8,6 @@ import { getLiquidConditionals } from '../../script/helpers/get-liquid-condition import allowedVersionOperators from '../../lib/liquid-tags/ifversion-supported-operators.js' import featureVersionsSchema from '../helpers/schemas/feature-versions-schema.js' import walkFiles from '../../script/helpers/walk-files' -import frontmatter from '../../lib/frontmatter.js' import cleanUpDeprecatedGhaeFlagErrors from '../../lib/temporary-ghae-deprecated-flag-error-cleanup.js' import { getDeepDataByLanguage } from '../../lib/get-data.js' @@ -66,15 +65,8 @@ describe('lint Liquid versioning', () => { beforeAll(async () => { fileContents = await fs.readFile(file, 'utf8') - const { data, content: bodyContent } = frontmatter(fileContents) - - ifversionConditionals = getLiquidConditionals(data, ['ifversion', 'elsif']).concat( - getLiquidConditionals(bodyContent, ['ifversion', 'elsif']) - ) - - ifConditionals = getLiquidConditionals(data, 'if').concat( - getLiquidConditionals(bodyContent, 'if') - ) + ifversionConditionals = getLiquidConditionals(fileContents, ['ifversion', 'elsif']) + ifConditionals = getLiquidConditionals(fileContents, 'if') }) // `ifversion` supports both standard and feature-based versioning.