Skip to content

Commit

Permalink
Merge pull request github#28478 from github/repo-sync
Browse files Browse the repository at this point in the history
Repo sync
  • Loading branch information
docs-bot authored Sep 25, 2023
2 parents 3fe384a + a5888f4 commit 82cf6b8
Show file tree
Hide file tree
Showing 11 changed files with 50 additions and 461 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,14 @@ topics:
redirect_from:
- /code-security/secure-coding/about-codeql-code-scanning-in-your-ci-system
- /code-security/secure-coding/using-codeql-code-scanning-with-your-existing-ci-system/about-codeql-code-scanning-in-your-ci-system
# Add redirects from CodeQL runner article
- /code-security/code-scanning/using-codeql-code-scanning-with-your-existing-ci-system/running-codeql-runner-in-your-ci-system
- /github/finding-security-vulnerabilities-and-errors-in-your-code/using-codeql-code-scanning-with-your-existing-ci-system/running-codeql-code-scanning-in-your-ci-system
- /github/finding-security-vulnerabilities-and-errors-in-your-code/running-codeql-code-scanning-in-your-ci-system
- /github/finding-security-vulnerabilities-and-errors-in-your-code/troubleshooting-codeql-code-scanning-in-your-ci-system
- /github/finding-security-vulnerabilities-and-errors-in-your-code/using-codeql-code-scanning-with-your-existing-ci-system/troubleshooting-codeql-code-scanning-in-your-ci-system
- /code-security/code-scanning/using-codeql-code-scanning-with-your-existing-ci-system/migrating-from-the-codeql-runner-to-codeql-cli
# End redirects from CodeQL runner article
---
<!--UI-LINK: When GitHub Enterprise Server 3.1+ doesn't have GitHub Actions set up, the Security > Code scanning alerts view links to this article.-->

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,4 @@ children:
- /about-codeql-code-scanning-in-your-ci-system
- /installing-codeql-cli-in-your-ci-system
- /configuring-codeql-cli-in-your-ci-system
- /migrating-from-the-codeql-runner-to-codeql-cli
---

This file was deleted.

2 changes: 0 additions & 2 deletions data/learning-tracks/code-security.yml
Original file line number Diff line number Diff line change
Expand Up @@ -219,8 +219,6 @@ code_security_ci:
/code-security/code-scanning/using-codeql-code-scanning-with-your-existing-ci-system/installing-codeql-cli-in-your-ci-system
- >-
/code-security/code-scanning/using-codeql-code-scanning-with-your-existing-ci-system/configuring-codeql-cli-in-your-ci-system
- >-
/code-security/code-scanning/using-codeql-code-scanning-with-your-existing-ci-system/migrating-from-the-codeql-runner-to-codeql-cli
end_to_end_supply_chain:
title: End-to-end supply chain
description: >-
Expand Down
3 changes: 0 additions & 3 deletions data/variables/code-scanning.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
# Variables used in code scanning that are not product names

# Deprecated product for running CodeQL analysis outside GitHub
codeql_runner: 'CodeQL runner'

# Descriptive name for the workflow used to run code scanning using the CodeQL action
codeql_workflow: 'CodeQL analysis workflow'

Expand Down
11 changes: 5 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@
"slash": "^5.0.0",
"strip-html-comments": "^1.0.0",
"styled-components": "^5.3.5",
"swr": "^2.0.0",
"swr": "^2.2.2",
"unified": "^11.0.3",
"unist-util-visit": "^5.0.0",
"url-template": "^3.0.0",
Expand Down
9 changes: 5 additions & 4 deletions src/content-linter/style/base.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import highlightJs from 'highlight.js'
import fs from 'fs'
import yaml from 'js-yaml'

const highlightJsLanguages = highlightJs.listLanguages()
const languageAliases = ['text']
const allowedCodeFenceLanguages = new Set([...highlightJsLanguages, ...languageAliases])
const allowedCodeFenceLanguages = Object.keys(
yaml.load(fs.readFileSync('data/variables/code-languages.yml', 'utf8')),
)

export const baseConfig = {
// Don't run all rules by default. This must be done first to
Expand Down
8 changes: 8 additions & 0 deletions src/content-render/tests/render-changed-and-deleted-files.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@

import path from 'path'

import { jest } from '@jest/globals'

import { head, get } from '../../../tests/helpers/e2etest.js'
import { loadPages } from '../../../lib/page-data.js'

Expand All @@ -56,6 +58,12 @@ function getContentFiles(spaceSeparatedList) {
})
}

// If the list of changed pages is very large, this test can take a long time.
// It can also happen if some of the pages involves are infamously slow.
// For example guide pages because they involved a lot of processing
// to gather and preview linked data.
jest.setTimeout(60 * 1000)

describe('changed-content', () => {
const changedContentFiles = getChangedContentFiles()

Expand Down
24 changes: 20 additions & 4 deletions src/learning-track/lib/get-link-data.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,33 @@ export default async (
return await processLink(rawLinks, context, option)
}

const links = (await Promise.all(rawLinks.map((link) => processLink(link, context, option))))
.filter(Boolean)
.slice(0, maxLinks)
const links = []
// Using a for loop here because the async work is not network or
// disk bound. It's CPU bound.
// And if we use a for-loop we can potentially bail early if
// the `maxLinks` is reached. That's instead of computing them all,
// and then slicing the array. So it avoids wasted processing.
for (const link of rawLinks) {
const processedLink = await processLink(link, context, option)
if (processedLink) {
links.push(processedLink)
if (links.length >= maxLinks) {
break
}
}
}

return links
}

async function processLink(link, context, option) {
const opts = { textOnly: true }
const linkHref = link.href || link
// Parse the link in case it includes Liquid conditionals
const linkPath = await renderContent(link.href || link, context, opts)
const linkPath = linkHref.includes('{') ? await renderContent(linkHref, context, opts) : linkHref
// If the link was `{% ifversion ghes %}/admin/foo/bar{% endifversion %}`
// the `context.currentVersion` was `enterprise-cloud`, the final
// output would become '' (empty string).
if (!linkPath) return null

const version =
Expand Down
4 changes: 3 additions & 1 deletion src/learning-track/lib/process-learning-tracks.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ export default async function processLearningTracks(rawLearningTracks, context)

for (const rawTrackName of rawLearningTracks) {
// Track names in frontmatter may include Liquid conditionals.
const renderedTrackName = await renderContent(rawTrackName, context, renderOpts)
const renderedTrackName = rawTrackName.includes('{')
? await renderContent(rawTrackName, context, renderOpts)
: rawTrackName
if (!renderedTrackName) continue

// Find the data for the current product and track name.
Expand Down

0 comments on commit 82cf6b8

Please sign in to comment.