Skip to content

Commit 9a3ab34

Browse files
authored
Merge pull request #41116 from github/repo-sync
Repo sync
2 parents 4828bb7 + 54088ad commit 9a3ab34

File tree

8 files changed

+50
-0
lines changed

8 files changed

+50
-0
lines changed

content/search-github/github-code-search/understanding-github-code-search-syntax.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ You can use parentheses to express more complicated boolean expressions. For exa
100100
You can use specialized keywords to qualify your search.
101101
* [Repository qualifier](#repository-qualifier)
102102
* [Organization and user qualifiers](#organization-and-user-qualifiers)
103+
* [Enterprise qualifier](#enterprise-qualifier)
103104
* [Language qualifier](#language-qualifier)
104105
* [Path qualifier](#path-qualifier)
105106
* [Symbol qualifier](#symbol-qualifier)
@@ -140,6 +141,16 @@ user:octocat
140141
> [!NOTE]
141142
> Code search does not currently support regular expressions or partial matching for organization or user names, so you will have to type the entire organization or user name for the qualifier to work.
142143
144+
### Enterprise qualifier
145+
146+
To search for files within an enterprise, use the `enterprise:` qualifier. For example:
147+
148+
```text
149+
enterprise:octocorp
150+
```
151+
152+
This searches repositories owned by organizations in the `octocorp` enterprise. User-owned repositories are not included.
153+
143154
### Language qualifier
144155

145156
To narrow down to a specific languages, use the `language:` qualifier. For example:

src/events/components/events.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ export function sendEvent<T extends EventType>({
110110
path_article: getMetaContent('path-article'),
111111
page_document_type: getMetaContent('page-document-type'),
112112
page_type: getMetaContent('page-type'),
113+
content_type: getMetaContent('page-content-type'),
113114
status: Number(getMetaContent('status') || 0),
114115
is_logged_in: isLoggedIn(),
115116

src/events/lib/schema.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { languageKeys } from '@/languages/lib/languages-server'
22
import { allVersionKeys } from '@/versions/lib/all-versions'
33
import { productIds } from '@/products/lib/all-products'
44
import { allTools } from '@/tools/lib/all-tools'
5+
import { contentTypesEnum } from '@/frame/lib/frontmatter'
56

67
const versionPattern = '^\\d+(\\.\\d+)?(\\.\\d+)?$'
78

@@ -100,6 +101,11 @@ const context = {
100101
description: 'Optional page type from the content frontmatter.',
101102
enum: ['overview', 'quick_start', 'tutorial', 'how_to', 'reference', 'rai'], // frontmatter.ts
102103
},
104+
content_type: {
105+
type: 'string',
106+
description: 'Optional content type from the content frontmatter (EDI content models).',
107+
enum: contentTypesEnum,
108+
},
103109
status: {
104110
type: 'number',
105111
description: 'The HTTP response status code of the main page HTML.',

src/events/tests/middleware.ts

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { describe, expect, test, vi } from 'vitest'
22

33
import { post } from '@/tests/helpers/e2etest'
4+
import { contentTypesEnum } from '@/frame/lib/frontmatter'
45

56
describe('POST /events', () => {
67
vi.setConfig({ testTimeout: 60 * 1000 })
@@ -163,4 +164,28 @@ describe('POST /events', () => {
163164
})
164165
expect(statusCode).toBe(400)
165166
})
167+
168+
test('should accept content_type field', async () => {
169+
const { statusCode } = await checkEvent({
170+
...pageExample,
171+
context: {
172+
...pageExample.context,
173+
content_type: 'how-tos',
174+
},
175+
})
176+
expect(statusCode).toBe(200)
177+
})
178+
179+
test('should accept valid content_type values from EDI content models', async () => {
180+
for (const contentType of contentTypesEnum) {
181+
const { statusCode } = await checkEvent({
182+
...pageExample,
183+
context: {
184+
...pageExample.context,
185+
content_type: contentType,
186+
},
187+
})
188+
expect(statusCode).toBe(200)
189+
}
190+
})
166191
})

src/events/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ export type EventProps = {
3636
path_article: string
3737
page_document_type: string
3838
page_type: string
39+
content_type: string
3940
status: number
4041
is_logged_in: boolean
4142
dotcom_user: string

src/frame/components/DefaultLayout.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ export const DefaultLayout = (props: Props) => {
119119
/>
120120
)}
121121
{page.type && <meta name="page-type" content={page.type} />}
122+
{page.contentType && <meta name="page-content-type" content={page.contentType} />}
122123
{page.documentType && <meta name="page-document-type" content={page.documentType} />}
123124
{status && <meta name="status" content={status.toString()} />}
124125

src/frame/components/context/MainContext.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ export type MainContextT = {
118118
page: {
119119
documentType: string
120120
type?: string
121+
contentType?: string
121122
topics: Array<string>
122123
title: string
123124
fullTitle?: string
@@ -217,6 +218,7 @@ export const getMainContext = async (req: any, res: any): Promise<MainContextT>
217218
(page && {
218219
documentType,
219220
type: req.context.page.type || null,
221+
contentType: req.context.page.contentType || null,
220222
title: req.context.page.title,
221223
fullTitle: req.context.page.fullTitle || null,
222224
topics: req.context.page.topics || [],

src/types.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ export type PageFrontmatter = {
5151
featuredLinks?: FeaturedLinks
5252
changelog?: ChangeLog
5353
type?: string
54+
contentType?: string
5455
topics?: string[]
5556
includeGuides?: string[]
5657
learningTracks?: string[]
@@ -380,6 +381,8 @@ export type Page = {
380381
complexity?: string[]
381382
industry?: string[]
382383
sidebarLink?: SidebarLink
384+
type?: string
385+
contentType?: string
383386
}
384387

385388
export type SidebarLink = {

0 commit comments

Comments
 (0)