Skip to content

Commit

Permalink
Fix bug in lint-versions test (github#33798)
Browse files Browse the repository at this point in the history
  • Loading branch information
sarahs authored Jan 6, 2023
1 parent 5960249 commit 6dbe33b
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 18 deletions.
Original file line number Diff line number Diff line change
@@ -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
Expand Down
5 changes: 2 additions & 3 deletions content/admin/guides.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -148,4 +148,3 @@ includeGuides:
- /admin/overview/creating-an-enterprise-account
- /admin/user-management/managing-organizations-in-your-enterprise/restoring-a-deleted-organization
---

7 changes: 3 additions & 4 deletions content/admin/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 %}'
Expand Down Expand Up @@ -126,4 +126,3 @@ children:
- /release-notes
- /all-releases
---

1 change: 1 addition & 0 deletions script/helpers/get-liquid-conditionals.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
12 changes: 2 additions & 10 deletions tests/linting/lint-versioning.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'

Expand Down Expand Up @@ -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.
Expand Down

0 comments on commit 6dbe33b

Please sign in to comment.