From 6dbe33bd543f437f43e5d79b0a59368197797148 Mon Sep 17 00:00:00 2001 From: Sarah Schneider Date: Fri, 6 Jan 2023 12:21:19 -0500 Subject: [PATCH] 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 04b8943ee199..897cd4754d04 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 8f8afba403b7..dd6c11429f5e 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 c7d2c762335c..5a846b079953 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 9143f920580c..d2f506483390 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 efca480c6fc9..d547e3fdd150 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.