Skip to content

Commit d7fec7f

Browse files
authored
Merge pull request #83 from github/repo-sync
repo sync
2 parents dc9d332 + 566d1a7 commit d7fec7f

25 files changed

+99
-111
lines changed
Loading
Loading
Loading
Loading
Loading
Loading

content/github/finding-security-vulnerabilities-and-errors-in-your-code/automatically-scanning-your-code-for-vulnerabilities-and-errors.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ title: Automatically scanning your code for vulnerabilities and errors
33
shortTitle: Scanning automatically
44
intro: 'You can find vulnerabilities and errors in your project''s code on {% data variables.product.prodname_dotcom %}, as well as view, triage, understand, and resolve the related {% data variables.product.prodname_code_scanning %} alerts.'
55
mapTopic: true
6+
product: '{% data reusables.gated-features.code-scanning %}'
67
versions:
78
free-pro-team: '*'
89
enterprise-server: '>=2.22'

content/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning-in-your-ci-system.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ versions:
99
enterprise-server: '>=2.22'
1010
---
1111

12+
{% data reusables.code-scanning.beta-codeql-runner %}
1213
{% data reusables.code-scanning.beta %}
1314
{% data reusables.code-scanning.enterprise-enable-code-scanning %}
1415

content/github/finding-security-vulnerabilities-and-errors-in-your-code/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
---
22
title: Finding security vulnerabilities and errors in your code
3+
product: '{% data reusables.gated-features.code-scanning %}'
34
redirect_from:
45
- /github/managing-security-vulnerabilities/finding-security-vulnerabilities-in-your-projects-code
56
versions:

content/github/finding-security-vulnerabilities-and-errors-in-your-code/integrating-with-code-scanning.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ title: Integrating with code scanning
33
shortTitle: Integration
44
intro: 'You can integrate {% data variables.product.prodname_codeql %} {% data variables.product.prodname_code_scanning %} with your existing CI systems or upload results from other tools.'
55
mapTopic: true
6+
product: '{% data reusables.gated-features.code-scanning %}'
67
redirect_from:
78
- /github/finding-security-vulnerabilities-and-errors-in-your-code/managing-results-from-code-scanning
89
versions:

content/github/finding-security-vulnerabilities-and-errors-in-your-code/managing-code-scanning-alerts-for-your-repository.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ redirect_from:
1313
---
1414

1515
{% data reusables.code-scanning.beta %}
16-
{% data reusables.code-scanning.enterprise-enable-code-scanning %}
1716

1817
### About alerts from {% data variables.product.prodname_code_scanning %}
1918

content/github/finding-security-vulnerabilities-and-errors-in-your-code/running-code-scanning-in-your-ci-system.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ versions:
88
enterprise-server: '>=2.22'
99
---
1010

11+
{% data reusables.code-scanning.beta-codeql-runner %}
1112
{% data reusables.code-scanning.beta %}
1213
{% data reusables.code-scanning.enterprise-enable-code-scanning %}
1314

content/github/finding-security-vulnerabilities-and-errors-in-your-code/sarif-support-for-code-scanning.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ versions:
1111
---
1212

1313
{% data reusables.code-scanning.beta %}
14-
{% data reusables.code-scanning.enterprise-enable-code-scanning %}
1514

1615
### About SARIF support
1716

content/github/finding-security-vulnerabilities-and-errors-in-your-code/triaging-code-scanning-alerts-in-pull-requests.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ versions:
1010
---
1111

1212
{% data reusables.code-scanning.beta %}
13-
{% data reusables.code-scanning.enterprise-enable-code-scanning-actions %}
1413

1514
### About {% data variables.product.prodname_code_scanning %} results on pull requests
1615

content/github/finding-security-vulnerabilities-and-errors-in-your-code/troubleshooting-code-scanning-in-your-ci-system.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ versions:
88
enterprise-server: '>=2.22'
99
---
1010

11+
{% data reusables.code-scanning.beta-codeql-runner %}
1112
{% data reusables.code-scanning.beta %}
12-
{% data reusables.code-scanning.enterprise-enable-code-scanning %}
1313

1414
### The `init` command takes too long
1515

content/github/finding-security-vulnerabilities-and-errors-in-your-code/troubleshooting-the-codeql-workflow.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ versions:
1111
---
1212

1313
{% data reusables.code-scanning.beta %}
14-
{% data reusables.code-scanning.enterprise-enable-code-scanning-actions %}
1514

1615
### Automatic build for a compiled language fails
1716

content/github/getting-started-with-github/githubs-products.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ For more information about hosting your own instance of [{% data variables.produ
9696

9797
- {% data variables.contact.github_support %} {% data variables.product.premium_plus_support_plan %}
9898
- {% data variables.product.prodname_insights %}
99-
- {% data variables.product.prodname_advanced_security %}
99+
- {% data variables.product.prodname_advanced_security %}{% if currentVersion == "free-pro-team@latest" %}. For more information, see "[About {% data variables.product.prodname_code_scanning %}](/github/finding-security-vulnerabilities-and-errors-in-your-code/about-code-scanning)" and "[About {% data variables.product.prodname_secret_scanning %}](/github/administering-a-repository/about-secret-scanning) (beta)."{% elsif currentVersion ver_gt "enterprise-server@2.21" %}. For more information, see "[About {% data variables.product.prodname_code_scanning %}](/github/finding-security-vulnerabilities-and-errors-in-your-code/about-code-scanning) (beta)."{% endif %}
100100
- [{% data variables.product.prodname_learning %} for organizations](https://lab.github.com/organizations)
101101

102102
For more information about signing up for {% data variables.product.prodname_ghe_one %}, contact [{% data variables.product.product_name %}'s Sales team](https://enterprise.github.com/contact).
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{% if currentVersion == "free-pro-team@latest" %}
2+
3+
{% note %}
4+
5+
**Note:** The {% data variables.product.prodname_codeql_runner %} is currently in beta and subject to change.
6+
7+
{% endnote %}
8+
9+
{% endif %}

data/reusables/code-scanning/beta.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
1+
{% if currentVersion == "enterprise-server@2.22" %}
2+
13
{% note %}
24

3-
**Note:** {% data variables.product.prodname_code_scanning_capc %} is currently in beta and subject to change. {% if currentVersion == "free-pro-team@latest" %}To request access to the beta, [join the waitlist](https://github.com/features/security/advanced-security/signup).{% else %}If your organization has an {% data variables.product.prodname_advanced_security %} license, you can [join the beta program](https://resources.github.com/beta-signup/).{% endif %}
5+
**Note:** {% data variables.product.prodname_code_scanning_capc %} is currently in beta and subject to change. For more information about taking part in the beta, [sign up here](https://resources.github.com/beta-signup/).
46

57
{% endnote %}
8+
9+
{% endif %}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{% data variables.product.prodname_code_scanning_capc %} is available in public repositories, and in public and private repositories owned by organizations with a license for {% data variables.product.prodname_advanced_security %}. {% if currentVersion == "free-pro-team@latest" %}{% data reusables.gated-features.more-info %}{% endif %}

javascripts/search.js

Lines changed: 30 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
const instantsearch = require('instantsearch.js').default
2-
const { searchBox, hits } = require('instantsearch.js/es/widgets')
2+
const { searchBox, hits, configure } = require('instantsearch.js/es/widgets')
33
const algoliasearch = require('algoliasearch')
44
const searchWithYourKeyboard = require('search-with-your-keyboard')
55
const querystring = require('querystring')
@@ -131,34 +131,39 @@ export default function () {
131131

132132
const search = instantsearch(opts)
133133

134-
search.addWidget(
135-
hits({
136-
container: '#search-results-container',
137-
templates: {
138-
empty: 'No results',
139-
item: resultTemplate
140-
},
141-
// useful for debugging template context, if needed
142-
transformItems: items => {
143-
// console.log(`transformItems`, items)
144-
return items
145-
}
146-
})
147-
)
148-
149134
// Find search placeholder text in a <meta> tag, falling back to a default
150135
const placeholderMeta = document.querySelector('meta[name="site.data.ui.search.placeholder"]')
151136
const placeholder = placeholderMeta ? placeholderMeta.content : 'Search topics, products...'
152137

153-
search.addWidget(
154-
searchBox({
155-
container: '#search-input-container',
156-
placeholder,
157-
// only autofocus on the homepage, and only if no #hash is present in the URL
158-
autofocus: (hasStandaloneSearch()) && !window.location.hash.length,
159-
showReset: false,
160-
showSubmit: false
161-
})
138+
search.addWidgets(
139+
[
140+
hits({
141+
container: '#search-results-container',
142+
templates: {
143+
empty: 'No results',
144+
item: resultTemplate
145+
},
146+
// useful for debugging template context, if needed
147+
transformItems: items => {
148+
// console.log(`transformItems`, items)
149+
return items
150+
}
151+
}),
152+
configure({
153+
analyticsTags: [
154+
'site:docs.github.com',
155+
`env:${process.env.NODE_ENV}`
156+
]
157+
}),
158+
searchBox({
159+
container: '#search-input-container',
160+
placeholder,
161+
// only autofocus on the homepage, and only if no #hash is present in the URL
162+
autofocus: (hasStandaloneSearch()) && !window.location.hash.length,
163+
showReset: false,
164+
showSubmit: false
165+
})
166+
]
162167
)
163168

164169
// enable for debugging

package-lock.json

Lines changed: 18 additions & 76 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
"html-entities": "^1.2.1",
4141
"html-truncate": "^1.2.2",
4242
"imurmurhash": "^0.1.4",
43-
"instantsearch.js": "^3.6.0",
43+
"instantsearch.js": "^4.8.2",
4444
"is-url": "^1.2.4",
4545
"js-cookie": "^2.2.1",
4646
"js-yaml": "^3.14.0",

tests/browser/browser.js

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
/* global page */
1+
/* global page, browser */
22
const sleep = require('await-sleep')
3+
const querystring = require('querystring')
34

45
describe('homepage', () => {
56
test('should be titled "GitHub Documentation"', async () => {
@@ -36,6 +37,29 @@ describe('algolia browser search', () => {
3637
expect(hits.length).toBeGreaterThan(5)
3738
})
3839

40+
it('sends the correct data to algolia', async () => {
41+
const newPage = await browser.newPage()
42+
await newPage.goto('http://localhost:4001/ja/enterprise/2.22/admin/installation')
43+
44+
await newPage.setRequestInterception(true)
45+
newPage.on('request', interceptedRequest => {
46+
if (interceptedRequest.method() === 'POST' && /algolia/i.test(interceptedRequest.url())) {
47+
const data = JSON.parse(interceptedRequest.postData())
48+
const { indexName, params } = data.requests[0]
49+
const parsedParams = querystring.parse(params)
50+
const analyticsTags = JSON.parse(parsedParams.analyticsTags)
51+
expect(indexName).toBe('github-docs-2.22-ja')
52+
expect(analyticsTags).toHaveLength(2)
53+
// browser tests are run against production build, so we are expecting env:production
54+
expect(analyticsTags).toEqual(expect.arrayContaining(['site:docs.github.com', 'env:production']))
55+
}
56+
interceptedRequest.continue()
57+
})
58+
59+
await newPage.click('#search-input-container input[type="search"]')
60+
await newPage.type('#search-input-container input[type="search"]', 'test')
61+
})
62+
3963
it('removes `algolia-query` query param after page load', async () => {
4064
await page.goto('http://localhost:4001/en?algolia-query=helpme')
4165

webpack.config.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
const path = require('path')
22
const MiniCssExtractPlugin = require('mini-css-extract-plugin')
33
const CopyWebpackPlugin = require('copy-webpack-plugin')
4+
const { EnvironmentPlugin } = require('webpack')
45

56
module.exports = {
67
entry: './javascripts/index.js',
@@ -67,6 +68,7 @@ module.exports = {
6768
patterns: [
6869
{ from: 'node_modules/@primer/css/fonts', to: 'fonts' }
6970
]
70-
})
71+
}),
72+
new EnvironmentPlugin(['NODE_ENV'])
7173
]
7274
}

0 commit comments

Comments
 (0)