1
0
mirror of synced 2025-12-19 18:10:59 -05:00

Merge pull request #41780 from github/repo-sync

Repo sync
This commit is contained in:
docs-bot
2025-12-10 10:38:02 -08:00
committed by GitHub
26 changed files with 3549 additions and 141 deletions

View File

@@ -1,6 +1,6 @@
--- ---
title: Start your journey title: Start your journey
intro: 'Learn the basics of {% data variables.product.github %}.' intro: "Brand new to {% data variables.product.github %}? Learn the basics here."
versions: versions:
fpt: '*' fpt: '*'
ghes: '*' ghes: '*'
@@ -22,4 +22,18 @@ children:
redirect_from: redirect_from:
- /github/getting-started-with-github/quickstart - /github/getting-started-with-github/quickstart
- /get-started/quickstart - /get-started/quickstart
layout: journey-landing
journeyTracks:
- id: 'learn_the_basics'
title: 'Get started'
description: 'Master the fundamentals of {% data variables.product.github %} and Git.'
guides:
- '/get-started/start-your-journey/about-github-and-git'
- '/get-started/start-your-journey/creating-an-account-on-github'
- '/get-started/start-your-journey/hello-world'
- '/get-started/start-your-journey/setting-up-your-profile'
- '/get-started/start-your-journey/finding-inspiration-on-github'
- '/get-started/start-your-journey/downloading-files-from-github'
- '/get-started/start-your-journey/uploading-a-project-to-github'
- '/get-started/start-your-journey/git-and-github-learning-resources'
--- ---

View File

@@ -3,4 +3,4 @@
versions: versions:
fpt: '*' fpt: '*'
ghec: '*' ghec: '*'
ghes: '>3.19' ghes: '>3.18'

View File

@@ -172,11 +172,19 @@ function incrementArticleLookup(
// logs the source of the request, if it's for hovercards it'll have the header X-Request-Source. // logs the source of the request, if it's for hovercards it'll have the header X-Request-Source.
// see src/links/components/LinkPreviewPopover.tsx // see src/links/components/LinkPreviewPopover.tsx
const source = let source = req.get('X-Request-Source')
req.get('X-Request-Source') || if (!source) {
(req.get('Referer') const referer = req.get('Referer')
? `external-${new URL(req.get('Referer') || '').hostname || 'unknown'}` if (referer) {
: 'external') try {
source = `external-${new URL(referer).hostname || 'unknown'}`
} catch {
source = 'external'
}
} else {
source = 'external'
}
}
const tags = [ const tags = [
// According to https://docs.datadoghq.com/getting_started/tagging/#define-tags // According to https://docs.datadoghq.com/getting_started/tagging/#define-tags

View File

@@ -66,4 +66,13 @@ describe('article body api', () => {
const { error } = JSON.parse(res.body) const { error } = JSON.parse(res.body)
expect(error).toContain("isn't yet available in markdown") expect(error).toContain("isn't yet available in markdown")
}) })
test('invalid Referer header does not crash', async () => {
const res = await get(makeURL('/en/get-started/start-your-journey/hello-world'), {
headers: {
Referer: 'invalid-url',
},
})
expect(res.statusCode).toBe(200)
})
}) })

View File

@@ -29,7 +29,7 @@ async function main() {
includeBasePath: true, includeBasePath: true,
globs: ['**/*.md'], globs: ['**/*.md'],
}) })
const cliMarkdownContents: Record<string, { data: any; content: string }> = {} const cliMarkdownContents: Record<string, { data: Record<string, unknown>; content: string }> = {}
for (const file of markdownFiles) { for (const file of markdownFiles) {
const sourceContent = await readFile(file, 'utf8') const sourceContent = await readFile(file, 'utf8')

View File

@@ -105,15 +105,16 @@ export const ctasSchema: Rule = {
for (const error of errors) { for (const error of errors) {
let message = '' let message = ''
if (error.keyword === 'required') { if (error.keyword === 'required') {
message = `Missing required parameter: ${(error.params as any)?.missingProperty}` message = `Missing required parameter: ${(error.params as { missingProperty?: string })?.missingProperty}`
} else if (error.keyword === 'enum') { } else if (error.keyword === 'enum') {
const paramName = error.instancePath.substring(1) const paramName = error.instancePath.substring(1)
// Get the actual invalid value from refParams and allowed values from params // Get the actual invalid value from refParams and allowed values from params
const invalidValue = refParams[paramName] const invalidValue = refParams[paramName]
const allowedValues = (error.params as any)?.allowedValues || [] const allowedValues =
(error.params as { allowedValues?: unknown[] })?.allowedValues || []
message = `Invalid value for ${paramName}: "${invalidValue}". Valid values are: ${allowedValues.join(', ')}` message = `Invalid value for ${paramName}: "${invalidValue}". Valid values are: ${allowedValues.join(', ')}`
} else if (error.keyword === 'additionalProperties') { } else if (error.keyword === 'additionalProperties') {
message = `Unexpected parameter: ${(error.params as any)?.additionalProperty}` message = `Unexpected parameter: ${(error.params as { additionalProperty?: string })?.additionalProperty}`
} else { } else {
message = `CTA URL validation error: ${error.message}` message = `CTA URL validation error: ${error.message}`
} }

View File

@@ -3,31 +3,39 @@ import type { RuleParams, RuleErrorCallback, Rule } from '../../types'
import { doesStringEndWithPeriod, getRange, isStringQuoted } from '../helpers/utils' import { doesStringEndWithPeriod, getRange, isStringQuoted } from '../helpers/utils'
// Minimal type for markdownit tokens used in this rule
interface MarkdownToken {
children?: MarkdownToken[]
line?: string
type?: string
content?: string
lineNumber?: number
}
export const linkPunctuation: Rule = { export const linkPunctuation: Rule = {
names: ['GHD001', 'link-punctuation'], names: ['GHD001', 'link-punctuation'],
description: 'Internal link titles must not contain punctuation', description: 'Internal link titles must not contain punctuation',
tags: ['links', 'url'], tags: ['links', 'url'],
parser: 'markdownit', parser: 'markdownit',
function: (params: RuleParams, onError: RuleErrorCallback) => { function: (params: RuleParams, onError: RuleErrorCallback) => {
// Using 'any' type for token as markdownlint-rule-helpers doesn't provide TypeScript types filterTokens(params, 'inline', (token: MarkdownToken) => {
filterTokens(params, 'inline', (token: any) => {
const { children, line } = token const { children, line } = token
let inLink = false let inLink = false
for (const child of children) { for (const child of children || []) {
if (child.type === 'link_open') { if (child.type === 'link_open') {
inLink = true inLink = true
} else if (child.type === 'link_close') { } else if (child.type === 'link_close') {
inLink = false inLink = false
} else if (inLink && child.type === 'text') { } else if (inLink && child.type === 'text' && child.content) {
const content = child.content.trim() const content = child.content.trim()
const hasPeriod = doesStringEndWithPeriod(content) const hasPeriod = doesStringEndWithPeriod(content)
const hasQuotes = isStringQuoted(content) const hasQuotes = isStringQuoted(content)
if (hasPeriod || hasQuotes) { if (hasPeriod || hasQuotes) {
const range = getRange(line, content) const range = line ? getRange(line, content) : []
addError( addError(
onError, onError,
child.lineNumber, child.lineNumber || 1,
'Remove quotes and/or period punctuation from the link title.', 'Remove quotes and/or period punctuation from the link title.',
child.content, child.content,
range, range,

View File

@@ -7,10 +7,13 @@ import { getDataByLanguage } from '@/data-directory/lib/get-data'
const Syntax = /([a-z0-9/\\_.\-[\]]+)/i const Syntax = /([a-z0-9/\\_.\-[\]]+)/i
const SyntaxHelp = "Syntax Error in 'data' - Valid syntax: data [path]" const SyntaxHelp = "Syntax Error in 'data' - Valid syntax: data [path]"
// Using any for scope because it has custom environments property not in Liquid's Scope type // Using unknown for scope because it has custom environments property not in Liquid's Scope type
interface CustomScope { interface CustomScope {
environments: any environments: {
[key: string]: any currentLanguage?: string
[key: string]: unknown
}
[key: string]: unknown
} }
interface DataTag { interface DataTag {
@@ -32,7 +35,7 @@ export default {
}, },
async render(scope: CustomScope) { async render(scope: CustomScope) {
let text = getDataByLanguage(this.path, scope.environments.currentLanguage) let text = getDataByLanguage(this.path, scope.environments.currentLanguage || '')
if (text === undefined) { if (text === undefined) {
if (scope.environments.currentLanguage === 'en') { if (scope.environments.currentLanguage === 'en') {
const message = `Can't find the key 'data ${this.path}' in the scope.` const message = `Can't find the key 'data ${this.path}' in the scope.`

View File

@@ -9,7 +9,7 @@ describe('autotitle', () => {
test('internal links with AUTOTITLE resolves', async () => { test('internal links with AUTOTITLE resolves', async () => {
const $: cheerio.Root = await getDOM('/get-started/foo/autotitling') const $: cheerio.Root = await getDOM('/get-started/foo/autotitling')
const links = $('#article-contents a[href]') const links = $('#article-contents a[href]')
links.each((i: number, element: any) => { links.each((i: number, element: cheerio.Element) => {
if ($(element).attr('href')?.includes('/get-started/start-your-journey/hello-world')) { if ($(element).attr('href')?.includes('/get-started/start-your-journey/hello-world')) {
expect($(element).text()).toBe('Hello World') expect($(element).text()).toBe('Hello World')
} }
@@ -49,13 +49,14 @@ describe('cross-version-links', () => {
// Tests that the hardcoded prefix is always removed // Tests that the hardcoded prefix is always removed
const firstLink = links.filter( const firstLink = links.filter(
(i: number, element: any) => $(element).text() === 'Hello world always in free-pro-team', (i: number, element: cheerio.Element) =>
$(element).text() === 'Hello world always in free-pro-team',
) )
expect(firstLink.attr('href')).toBe('/en/get-started/start-your-journey/hello-world') expect(firstLink.attr('href')).toBe('/en/get-started/start-your-journey/hello-world')
// Tests that the second link always goes to enterprise-server@X.Y // Tests that the second link always goes to enterprise-server@X.Y
const secondLink = links.filter( const secondLink = links.filter(
(i: number, element: any) => (i: number, element: cheerio.Element) =>
$(element).text() === 'Autotitling page always in enterprise-server latest', $(element).text() === 'Autotitling page always in enterprise-server latest',
) )
expect(secondLink.attr('href')).toBe( expect(secondLink.attr('href')).toBe(
@@ -72,7 +73,7 @@ describe('link-rewriting', () => {
{ {
const link = links.filter( const link = links.filter(
(i: number, element: any) => $(element).text() === 'Cross Version Linking', (i: number, element: cheerio.Element) => $(element).text() === 'Cross Version Linking',
) )
expect(link.attr('href')).toMatch('/en/get-started/') expect(link.attr('href')).toMatch('/en/get-started/')
} }
@@ -80,21 +81,25 @@ describe('link-rewriting', () => {
// Some links are left untouched // Some links are left untouched
{ {
const link = links.filter((i: number, element: any) => const link = links.filter((i: number, element: cheerio.Element) =>
$(element).text().includes('Enterprise 11.10'), $(element).text().includes('Enterprise 11.10'),
) )
expect(link.attr('href')).toMatch('/en/enterprise/') expect(link.attr('href')).toMatch('/en/enterprise/')
} }
{ {
const link = links.filter((i: number, element: any) => $(element).text().includes('peterbe')) const link = links.filter((i: number, element: cheerio.Element) =>
$(element).text().includes('peterbe'),
)
expect(link.attr('href')).toMatch(/^https:/) expect(link.attr('href')).toMatch(/^https:/)
} }
{ {
const link = links.filter((i: number, element: any) => $(element).text().includes('Picture')) const link = links.filter((i: number, element: cheerio.Element) =>
$(element).text().includes('Picture'),
)
expect(link.attr('href')).toMatch(/^\/assets\//) expect(link.attr('href')).toMatch(/^\/assets\//)
} }
{ {
const link = links.filter((i: number, element: any) => const link = links.filter((i: number, element: cheerio.Element) =>
$(element).text().includes('GraphQL Schema'), $(element).text().includes('GraphQL Schema'),
) )
expect(link.attr('href')).toMatch(/^\/public\//) expect(link.attr('href')).toMatch(/^\/public\//)
@@ -108,7 +113,7 @@ describe('link-rewriting', () => {
const links = $('#article-contents a[href]') const links = $('#article-contents a[href]')
const link = links.filter( const link = links.filter(
(i: number, element: any) => $(element).text() === 'Cross Version Linking', (i: number, element: cheerio.Element) => $(element).text() === 'Cross Version Linking',
) )
expect(link.attr('href')).toMatch('/en/enterprise-cloud@latest/get-started/') expect(link.attr('href')).toMatch('/en/enterprise-cloud@latest/get-started/')
}) })
@@ -121,7 +126,7 @@ describe('link-rewriting', () => {
const links = $('#article-contents a[href]') const links = $('#article-contents a[href]')
const link = links.filter( const link = links.filter(
(i: number, element: any) => $(element).text() === 'Cross Version Linking', (i: number, element: cheerio.Element) => $(element).text() === 'Cross Version Linking',
) )
expect(link.attr('href')).toMatch( expect(link.attr('href')).toMatch(
`/en/enterprise-server@${enterpriseServerReleases.latestStable}/get-started/`, `/en/enterprise-server@${enterpriseServerReleases.latestStable}/get-started/`,
@@ -133,14 +138,14 @@ describe('subcategory links', () => {
test('no free-pro-team prefix', async () => { test('no free-pro-team prefix', async () => {
const $: cheerio.Root = await getDOM('/rest/actions') const $: cheerio.Root = await getDOM('/rest/actions')
const links = $('[data-testid="table-of-contents"] a[href]') const links = $('[data-testid="table-of-contents"] a[href]')
links.each((i: number, element: any) => { links.each((i: number, element: cheerio.Element) => {
expect($(element).attr('href')).not.toContain('/free-pro-team@latest') expect($(element).attr('href')).not.toContain('/free-pro-team@latest')
}) })
}) })
test('enterprise-server prefix', async () => { test('enterprise-server prefix', async () => {
const $: cheerio.Root = await getDOM('/enterprise-server@latest/rest/actions') const $: cheerio.Root = await getDOM('/enterprise-server@latest/rest/actions')
const links = $('[data-testid="table-of-contents"] a[href]') const links = $('[data-testid="table-of-contents"] a[href]')
links.each((i: number, element: any) => { links.each((i: number, element: cheerio.Element) => {
expect($(element).attr('href')).toMatch(/\/enterprise-server@\d/) expect($(element).attr('href')).toMatch(/\/enterprise-server@\d/)
}) })
}) })

View File

@@ -1,4 +1,139 @@
[ [
{
"schemaChanges": [
{
"title": "The GraphQL schema includes these changes:",
"changes": [
"<p>Type <code>CreateRepositoryCustomPropertyInput</code> was added</p>",
"<p>Input field <code>allowedValues</code> of type '[String!]<code>was added to input object type</code>CreateRepositoryCustomPropertyInput'</p>",
"<p>Input field <code>clientMutationId</code> of type <code>String</code> was added to input object type <code>CreateRepositoryCustomPropertyInput</code></p>",
"<p>Input field <code>defaultValue</code> of type <code>String</code> was added to input object type <code>CreateRepositoryCustomPropertyInput</code></p>",
"<p>Input field <code>description</code> of type <code>String</code> was added to input object type <code>CreateRepositoryCustomPropertyInput</code></p>",
"<p>Input field <code>propertyName</code> of type <code>String!</code> was added to input object type <code>CreateRepositoryCustomPropertyInput</code></p>",
"<p>Input field <code>regex</code> of type <code>String</code> was added to input object type <code>CreateRepositoryCustomPropertyInput</code></p>",
"<p>Input field <code>required</code> of type <code>Boolean</code> was added to input object type <code>CreateRepositoryCustomPropertyInput</code></p>",
"<p>Input field <code>sourceId</code> of type <code>ID!</code> was added to input object type <code>CreateRepositoryCustomPropertyInput</code></p>",
"<p>Input field <code>valueType</code> of type <code>CustomPropertyValueType!</code> was added to input object type <code>CreateRepositoryCustomPropertyInput</code></p>",
"<p>Input field <code>valuesEditableBy</code> of type <code>RepositoryCustomPropertyValuesEditableBy</code> was added to input object type <code>CreateRepositoryCustomPropertyInput</code></p>",
"<p>Type <code>CreateRepositoryCustomPropertyPayload</code> was added</p>",
"<p>Field <code>clientMutationId</code> was added to object type <code>CreateRepositoryCustomPropertyPayload</code></p>",
"<p>Field <code>repositoryCustomProperty</code> was added to object type <code>CreateRepositoryCustomPropertyPayload</code></p>",
"<p>Type <code>CustomPropertySource</code> was added</p>",
"<p>Member <code>Enterprise</code> was added to Union type <code>CustomPropertySource</code></p>",
"<p>Member <code>Organization</code> was added to Union type <code>CustomPropertySource</code></p>",
"<p>Type <code>CustomPropertyValue</code> was added</p>",
"<p>Type <code>CustomPropertyValueInput</code> was added</p>",
"<p>Input field <code>propertyName</code> of type <code>String!</code> was added to input object type <code>CustomPropertyValueInput</code></p>",
"<p>Input field <code>value</code> of type <code>CustomPropertyValue</code> was added to input object type <code>CustomPropertyValueInput</code></p>",
"<p>Type <code>CustomPropertyValueType</code> was added</p>",
"<p>Enum value 'MULTI_SELECT<code>was added to enum</code>CustomPropertyValueType'</p>",
"<p>Enum value 'SINGLE_SELECT<code>was added to enum</code>CustomPropertyValueType'</p>",
"<p>Enum value <code>STRING</code> was added to enum <code>CustomPropertyValueType</code></p>",
"<p>Enum value 'TRUE_FALSE<code>was added to enum</code>CustomPropertyValueType'</p>",
"<p>Enum value <code>URL</code> was added to enum <code>CustomPropertyValueType</code></p>",
"<p>Type <code>DeleteRepositoryCustomPropertyInput</code> was added</p>",
"<p>Input field <code>clientMutationId</code> of type <code>String</code> was added to input object type <code>DeleteRepositoryCustomPropertyInput</code></p>",
"<p>Input field <code>id</code> of type <code>ID!</code> was added to input object type <code>DeleteRepositoryCustomPropertyInput</code></p>",
"<p>Type <code>DeleteRepositoryCustomPropertyPayload</code> was added</p>",
"<p>Field <code>clientMutationId</code> was added to object type <code>DeleteRepositoryCustomPropertyPayload</code></p>",
"<p>Field <code>repositoryCustomProperty</code> was added to object type <code>DeleteRepositoryCustomPropertyPayload</code></p>",
"<p>Type <code>PromoteRepositoryCustomPropertyInput</code> was added</p>",
"<p>Input field <code>clientMutationId</code> of type <code>String</code> was added to input object type <code>PromoteRepositoryCustomPropertyInput</code></p>",
"<p>Input field <code>repositoryCustomPropertyId</code> of type <code>ID!</code> was added to input object type <code>PromoteRepositoryCustomPropertyInput</code></p>",
"<p>Type <code>PromoteRepositoryCustomPropertyPayload</code> was added</p>",
"<p>Field <code>clientMutationId</code> was added to object type <code>PromoteRepositoryCustomPropertyPayload</code></p>",
"<p>Field <code>repositoryCustomProperty</code> was added to object type <code>PromoteRepositoryCustomPropertyPayload</code></p>",
"<p>Type <code>RepositoryCustomProperty</code> was added</p>",
"<p><code>RepositoryCustomProperty</code> object implements <code>Node</code> interface</p>",
"<p>Field <code>allowedValues</code> was added to object type <code>RepositoryCustomProperty</code></p>",
"<p>Field <code>defaultValue</code> was added to object type <code>RepositoryCustomProperty</code></p>",
"<p>Field <code>description</code> was added to object type <code>RepositoryCustomProperty</code></p>",
"<p>Field <code>id</code> was added to object type <code>RepositoryCustomProperty</code></p>",
"<p>Field <code>propertyName</code> was added to object type <code>RepositoryCustomProperty</code></p>",
"<p>Field <code>regex</code> was added to object type <code>RepositoryCustomProperty</code></p>",
"<p>Field <code>required</code> was added to object type <code>RepositoryCustomProperty</code></p>",
"<p>Field <code>source</code> was added to object type <code>RepositoryCustomProperty</code></p>",
"<p>Field <code>valueType</code> was added to object type <code>RepositoryCustomProperty</code></p>",
"<p>Field <code>valuesEditableBy</code> was added to object type <code>RepositoryCustomProperty</code></p>",
"<p>Type <code>RepositoryCustomPropertyConnection</code> was added</p>",
"<p>Field <code>edges</code> was added to object type <code>RepositoryCustomPropertyConnection</code></p>",
"<p>Field <code>nodes</code> was added to object type <code>RepositoryCustomPropertyConnection</code></p>",
"<p>Field <code>pageInfo</code> was added to object type <code>RepositoryCustomPropertyConnection</code></p>",
"<p>Field <code>totalCount</code> was added to object type <code>RepositoryCustomPropertyConnection</code></p>",
"<p>Type <code>RepositoryCustomPropertyEdge</code> was added</p>",
"<p>Field <code>cursor</code> was added to object type <code>RepositoryCustomPropertyEdge</code></p>",
"<p>Field <code>node</code> was added to object type <code>RepositoryCustomPropertyEdge</code></p>",
"<p>Type <code>RepositoryCustomPropertyValue</code> was added</p>",
"<p>Field <code>propertyName</code> was added to object type <code>RepositoryCustomPropertyValue</code></p>",
"<p>Field <code>value</code> was added to object type <code>RepositoryCustomPropertyValue</code></p>",
"<p>Type <code>RepositoryCustomPropertyValueConnection</code> was added</p>",
"<p>Field <code>edges</code> was added to object type <code>RepositoryCustomPropertyValueConnection</code></p>",
"<p>Field <code>nodes</code> was added to object type <code>RepositoryCustomPropertyValueConnection</code></p>",
"<p>Field <code>pageInfo</code> was added to object type <code>RepositoryCustomPropertyValueConnection</code></p>",
"<p>Field <code>totalCount</code> was added to object type <code>RepositoryCustomPropertyValueConnection</code></p>",
"<p>Type <code>RepositoryCustomPropertyValueEdge</code> was added</p>",
"<p>Field <code>cursor</code> was added to object type <code>RepositoryCustomPropertyValueEdge</code></p>",
"<p>Field <code>node</code> was added to object type <code>RepositoryCustomPropertyValueEdge</code></p>",
"<p>Type <code>RepositoryCustomPropertyValuesEditableBy</code> was added</p>",
"<p>Enum value 'ORG_ACTORS<code>was added to enum</code>RepositoryCustomPropertyValuesEditableBy'</p>",
"<p>Enum value 'ORG_AND_REPO_ACTORS<code>was added to enum</code>RepositoryCustomPropertyValuesEditableBy'</p>",
"<p>Type <code>SetRepositoryCustomPropertyValuesInput</code> was added</p>",
"<p>Input field <code>clientMutationId</code> of type <code>String</code> was added to input object type <code>SetRepositoryCustomPropertyValuesInput</code></p>",
"<p>Input field <code>properties</code> of type '[CustomPropertyValueInput!]!<code>was added to input object type</code>SetRepositoryCustomPropertyValuesInput'</p>",
"<p>Input field <code>repositoryId</code> of type <code>ID!</code> was added to input object type <code>SetRepositoryCustomPropertyValuesInput</code></p>",
"<p>Type <code>SetRepositoryCustomPropertyValuesPayload</code> was added</p>",
"<p>Field <code>clientMutationId</code> was added to object type <code>SetRepositoryCustomPropertyValuesPayload</code></p>",
"<p>Field <code>repository</code> was added to object type <code>SetRepositoryCustomPropertyValuesPayload</code></p>",
"<p>Type <code>UpdateRepositoryCustomPropertyInput</code> was added</p>",
"<p>Input field <code>allowedValues</code> of type '[String!]<code>was added to input object type</code>UpdateRepositoryCustomPropertyInput'</p>",
"<p>Input field <code>clientMutationId</code> of type <code>String</code> was added to input object type <code>UpdateRepositoryCustomPropertyInput</code></p>",
"<p>Input field <code>defaultValue</code> of type <code>String</code> was added to input object type <code>UpdateRepositoryCustomPropertyInput</code></p>",
"<p>Input field <code>description</code> of type <code>String</code> was added to input object type <code>UpdateRepositoryCustomPropertyInput</code></p>",
"<p>Input field <code>regex</code> of type <code>String</code> was added to input object type <code>UpdateRepositoryCustomPropertyInput</code></p>",
"<p>Input field <code>repositoryCustomPropertyId</code> of type <code>ID!</code> was added to input object type <code>UpdateRepositoryCustomPropertyInput</code></p>",
"<p>Input field <code>required</code> of type <code>Boolean</code> was added to input object type <code>UpdateRepositoryCustomPropertyInput</code></p>",
"<p>Input field <code>valuesEditableBy</code> of type <code>RepositoryCustomPropertyValuesEditableBy</code> was added to input object type <code>UpdateRepositoryCustomPropertyInput</code></p>",
"<p>Type <code>UpdateRepositoryCustomPropertyPayload</code> was added</p>",
"<p>Field <code>clientMutationId</code> was added to object type <code>UpdateRepositoryCustomPropertyPayload</code></p>",
"<p>Field <code>repositoryCustomProperty</code> was added to object type <code>UpdateRepositoryCustomPropertyPayload</code></p>",
"<p>Field <code>repositoryCustomProperties</code> was added to object type <code>Enterprise</code></p>",
"<p>Argument <code>after: String</code> added to field <code>Enterprise.repositoryCustomProperties</code></p>",
"<p>Argument <code>before: String</code> added to field <code>Enterprise.repositoryCustomProperties</code></p>",
"<p>Argument <code>first: Int</code> added to field <code>Enterprise.repositoryCustomProperties</code></p>",
"<p>Argument <code>last: Int</code> added to field <code>Enterprise.repositoryCustomProperties</code></p>",
"<p>Field <code>repositoryCustomProperty</code> was added to object type <code>Enterprise</code></p>",
"<p>Argument <code>propertyName: String!</code> added to field <code>Enterprise.repositoryCustomProperty</code></p>",
"<p>Field <code>createRepositoryCustomProperty</code> was added to object type <code>Mutation</code></p>",
"<p>Argument <code>input: CreateRepositoryCustomPropertyInput!</code> added to field <code>Mutation.createRepositoryCustomProperty</code></p>",
"<p>Field <code>deleteRepositoryCustomProperty</code> was added to object type <code>Mutation</code></p>",
"<p>Argument <code>input: DeleteRepositoryCustomPropertyInput!</code> added to field <code>Mutation.deleteRepositoryCustomProperty</code></p>",
"<p>Field <code>promoteRepositoryCustomProperty</code> was added to object type <code>Mutation</code></p>",
"<p>Argument <code>input: PromoteRepositoryCustomPropertyInput!</code> added to field <code>Mutation.promoteRepositoryCustomProperty</code></p>",
"<p>Field <code>setRepositoryCustomPropertyValues</code> was added to object type <code>Mutation</code></p>",
"<p>Argument <code>input: SetRepositoryCustomPropertyValuesInput!</code> added to field <code>Mutation.setRepositoryCustomPropertyValues</code></p>",
"<p>Field <code>updateRepositoryCustomProperty</code> was added to object type <code>Mutation</code></p>",
"<p>Argument <code>input: UpdateRepositoryCustomPropertyInput!</code> added to field <code>Mutation.updateRepositoryCustomProperty</code></p>",
"<p>Field <code>repositoryCustomProperties</code> was added to object type <code>Organization</code></p>",
"<p>Argument <code>after: String</code> added to field <code>Organization.repositoryCustomProperties</code></p>",
"<p>Argument <code>before: String</code> added to field <code>Organization.repositoryCustomProperties</code></p>",
"<p>Argument <code>first: Int</code> added to field <code>Organization.repositoryCustomProperties</code></p>",
"<p>Argument <code>last: Int</code> added to field <code>Organization.repositoryCustomProperties</code></p>",
"<p>Field <code>repositoryCustomProperty</code> was added to object type <code>Organization</code></p>",
"<p>Argument <code>propertyName: String!</code> added to field <code>Organization.repositoryCustomProperty</code></p>",
"<p>Field <code>repositoryCustomPropertyValue</code> was added to object type <code>Repository</code></p>",
"<p>Argument <code>propertyName: String!</code> added to field <code>Repository.repositoryCustomPropertyValue</code></p>",
"<p>Field <code>repositoryCustomPropertyValues</code> was added to object type <code>Repository</code></p>",
"<p>Argument <code>after: String</code> added to field <code>Repository.repositoryCustomPropertyValues</code></p>",
"<p>Argument <code>before: String</code> added to field <code>Repository.repositoryCustomPropertyValues</code></p>",
"<p>Argument <code>first: Int</code> added to field <code>Repository.repositoryCustomPropertyValues</code></p>",
"<p>Argument <code>last: Int</code> added to field <code>Repository.repositoryCustomPropertyValues</code></p>"
]
}
],
"previewChanges": [],
"upcomingChanges": [],
"date": "2025-12-10"
},
{ {
"schemaChanges": [ "schemaChanges": [
{ {

View File

@@ -8724,6 +8724,76 @@ type CreateRefPayload {
ref: Ref ref: Ref
} }
"""
Autogenerated input type of CreateRepositoryCustomProperty
"""
input CreateRepositoryCustomPropertyInput {
"""
The allowed values for the custom property.
"""
allowedValues: [String!]
"""
A unique identifier for the client performing the mutation.
"""
clientMutationId: String
"""
The default value for the custom property if the property is required.
"""
defaultValue: String
"""
The description of the custom property.
"""
description: String
"""
The name of the custom property.
"""
propertyName: String!
"""
The regex pattern that the value of the custom property must match, if the `value_type` is `string`.
"""
regex: String
"""
Whether the custom property is required.
"""
required: Boolean
"""
The global relay id of the source in which a new custom property should be created in.
"""
sourceId: ID! @possibleTypes(concreteTypes: ["Enterprise", "Organization"], abstractType: "CustomPropertySource")
"""
The value type for the custom property.
"""
valueType: CustomPropertyValueType!
"""
The allowed actors who can edit the values of a custom property.
"""
valuesEditableBy: RepositoryCustomPropertyValuesEditableBy
}
"""
Autogenerated return type of CreateRepositoryCustomProperty.
"""
type CreateRepositoryCustomPropertyPayload {
"""
A unique identifier for the client performing the mutation.
"""
clientMutationId: String
"""
The newly created repository custom property.
"""
repositoryCustomProperty: RepositoryCustomProperty
}
""" """
Autogenerated input type of CreateRepository Autogenerated input type of CreateRepository
""" """
@@ -9782,6 +9852,64 @@ type CrossReferencedEvent implements Node & UniformResourceLocatable {
willCloseTarget: Boolean! willCloseTarget: Boolean!
} }
"""
Sources which can have custom properties defined.
"""
union CustomPropertySource = Enterprise | Organization
"""
A custom property value can be either a string or an array of strings. All
property types support only a single string value, except for the multi-select
type, which supports only a string array.
"""
scalar CustomPropertyValue
"""
The custom property name and value to be set.
"""
input CustomPropertyValueInput {
"""
The name of the custom property.
"""
propertyName: String!
"""
The value to set for the custom property. Using a value of null will unset the
property value, reverting to the default value if the property is required.
"""
value: CustomPropertyValue
}
"""
The allowed value types for a custom property definition.
"""
enum CustomPropertyValueType {
"""
A multi-select value.
"""
MULTI_SELECT
"""
A single-select value.
"""
SINGLE_SELECT
"""
A string value.
"""
STRING
"""
A true/false value.
"""
TRUE_FALSE
"""
A URL value.
"""
URL
}
""" """
The Common Vulnerability Scoring System The Common Vulnerability Scoring System
""" """
@@ -10588,6 +10716,36 @@ type DeleteRefPayload {
clientMutationId: String clientMutationId: String
} }
"""
Autogenerated input type of DeleteRepositoryCustomProperty
"""
input DeleteRepositoryCustomPropertyInput {
"""
A unique identifier for the client performing the mutation.
"""
clientMutationId: String
"""
The global relay id of the custom property to be deleted.
"""
id: ID! @possibleTypes(concreteTypes: ["RepositoryCustomProperty"])
}
"""
Autogenerated return type of DeleteRepositoryCustomProperty.
"""
type DeleteRepositoryCustomPropertyPayload {
"""
A unique identifier for the client performing the mutation.
"""
clientMutationId: String
"""
The deleted custom property.
"""
repositoryCustomProperty: RepositoryCustomProperty
}
""" """
Autogenerated input type of DeleteRepositoryRuleset Autogenerated input type of DeleteRepositoryRuleset
""" """
@@ -13660,6 +13818,41 @@ type Enterprise implements Node {
""" """
readmeHTML: HTML! readmeHTML: HTML!
"""
A list of repository custom properties for this enterprise.
"""
repositoryCustomProperties(
"""
Returns the elements in the list that come after the specified cursor.
"""
after: String
"""
Returns the elements in the list that come before the specified cursor.
"""
before: String
"""
Returns the first _n_ elements from the list.
"""
first: Int
"""
Returns the last _n_ elements from the list.
"""
last: Int
): RepositoryCustomPropertyConnection
"""
Returns a single repository custom property for the current enterprise by name.
"""
repositoryCustomProperty(
"""
The name of the repository custom property to be returned.
"""
propertyName: String!
): RepositoryCustomProperty
""" """
The HTTP path for this enterprise. The HTTP path for this enterprise.
""" """
@@ -25263,6 +25456,16 @@ type Mutation {
input: CreateRepositoryInput! input: CreateRepositoryInput!
): CreateRepositoryPayload ): CreateRepositoryPayload
"""
Create a repository custom property.
"""
createRepositoryCustomProperty(
"""
Parameters for CreateRepositoryCustomProperty
"""
input: CreateRepositoryCustomPropertyInput!
): CreateRepositoryCustomPropertyPayload
""" """
Create a repository ruleset Create a repository ruleset
""" """
@@ -25593,6 +25796,16 @@ type Mutation {
input: DeleteRefInput! input: DeleteRefInput!
): DeleteRefPayload ): DeleteRefPayload
"""
Delete a repository custom property.
"""
deleteRepositoryCustomProperty(
"""
Parameters for DeleteRepositoryCustomProperty
"""
input: DeleteRepositoryCustomPropertyInput!
): DeleteRepositoryCustomPropertyPayload
""" """
Delete a repository ruleset Delete a repository ruleset
""" """
@@ -25935,6 +26148,16 @@ type Mutation {
input: PinIssueInput! input: PinIssueInput!
): PinIssuePayload ): PinIssuePayload
"""
Promote a repository custom property to the enterprise level.
"""
promoteRepositoryCustomProperty(
"""
Parameters for PromoteRepositoryCustomProperty
"""
input: PromoteRepositoryCustomPropertyInput!
): PromoteRepositoryCustomPropertyPayload
""" """
Publish an existing sponsorship tier that is currently still a draft to a GitHub Sponsors profile. Publish an existing sponsorship tier that is currently still a draft to a GitHub Sponsors profile.
""" """
@@ -26256,6 +26479,16 @@ type Mutation {
input: SetOrganizationInteractionLimitInput! input: SetOrganizationInteractionLimitInput!
): SetOrganizationInteractionLimitPayload ): SetOrganizationInteractionLimitPayload
"""
Set repository custom property values for a repository.
"""
setRepositoryCustomPropertyValues(
"""
Parameters for SetRepositoryCustomPropertyValues
"""
input: SetRepositoryCustomPropertyValuesInput!
): SetRepositoryCustomPropertyValuesPayload
""" """
Sets an interaction limit setting for a repository. Sets an interaction limit setting for a repository.
""" """
@@ -27049,6 +27282,16 @@ type Mutation {
input: UpdateRepositoryInput! input: UpdateRepositoryInput!
): UpdateRepositoryPayload ): UpdateRepositoryPayload
"""
Update a repository custom property.
"""
updateRepositoryCustomProperty(
"""
Parameters for UpdateRepositoryCustomProperty
"""
input: UpdateRepositoryCustomPropertyInput!
): UpdateRepositoryCustomPropertyPayload
""" """
Update a repository ruleset Update a repository ruleset
""" """
@@ -33264,6 +33507,41 @@ type Organization implements Actor & MemberStatusable & Node & PackageOwner & Pr
name: String! name: String!
): Repository ): Repository
"""
A list of custom properties for this organization.
"""
repositoryCustomProperties(
"""
Returns the elements in the list that come after the specified cursor.
"""
after: String
"""
Returns the elements in the list that come before the specified cursor.
"""
before: String
"""
Returns the first _n_ elements from the list.
"""
first: Int
"""
Returns the last _n_ elements from the list.
"""
last: Int
): RepositoryCustomPropertyConnection
"""
Returns a single custom property from the current organization by name.
"""
repositoryCustomProperty(
"""
The name of the custom property to be returned.
"""
propertyName: String!
): RepositoryCustomProperty
""" """
Discussion comments this user has authored. Discussion comments this user has authored.
""" """
@@ -40299,6 +40577,36 @@ enum ProjectV2WorkflowsOrderField {
UPDATED_AT UPDATED_AT
} }
"""
Autogenerated input type of PromoteRepositoryCustomProperty
"""
input PromoteRepositoryCustomPropertyInput {
"""
A unique identifier for the client performing the mutation.
"""
clientMutationId: String
"""
The ID of the repository custom property to be promoted.
"""
repositoryCustomPropertyId: ID! @possibleTypes(concreteTypes: ["RepositoryCustomProperty"])
}
"""
Autogenerated return type of PromoteRepositoryCustomProperty.
"""
type PromoteRepositoryCustomPropertyPayload {
"""
A unique identifier for the client performing the mutation.
"""
clientMutationId: String
"""
The repository custom property that has been promoted.
"""
repositoryCustomProperty: RepositoryCustomProperty
}
""" """
A property that must match A property that must match
""" """
@@ -51484,6 +51792,41 @@ type Repository implements Node & PackageOwner & ProjectOwner & ProjectV2Recent
orderBy: ReleaseOrder orderBy: ReleaseOrder
): ReleaseConnection! ): ReleaseConnection!
"""
A custom property value for the repository.
"""
repositoryCustomPropertyValue(
"""
The name of the custom property to retrieve the value for.
"""
propertyName: String!
): RepositoryCustomPropertyValue
"""
A list of custom properties and their associated values for a repository.
"""
repositoryCustomPropertyValues(
"""
Returns the elements in the list that come after the specified cursor.
"""
after: String
"""
Returns the elements in the list that come before the specified cursor.
"""
before: String
"""
Returns the first _n_ elements from the list.
"""
first: Int
"""
Returns the last _n_ elements from the list.
"""
last: Int
): RepositoryCustomPropertyValueConnection
""" """
A list of applied repository-topic associations for this repository. A list of applied repository-topic associations for this repository.
""" """
@@ -52095,6 +52438,171 @@ enum RepositoryContributionType {
REPOSITORY REPOSITORY
} }
"""
A repository custom property.
"""
type RepositoryCustomProperty implements Node {
"""
The allowed values for the custom property. Required if `value_type` is `single_select` or `multi_select`.
"""
allowedValues: [String!]
"""
The default value of the custom property, if the property is `required`.
"""
defaultValue: CustomPropertyValue
"""
The description of the custom property.
"""
description: String
"""
The Node ID of the RepositoryCustomProperty object
"""
id: ID!
"""
The name of the custom property.
"""
propertyName: String!
"""
The regex pattern that the value of the custom property must match, if the `value_type` is `string`.
"""
regex: String
"""
Whether the custom property is required.
"""
required: Boolean
"""
The source type of the custom property.
"""
source: CustomPropertySource!
"""
The value type of the custom property.
"""
valueType: CustomPropertyValueType!
"""
Who can edit the values of this repository custom property.
"""
valuesEditableBy: RepositoryCustomPropertyValuesEditableBy!
}
"""
The connection type for RepositoryCustomProperty.
"""
type RepositoryCustomPropertyConnection {
"""
A list of edges.
"""
edges: [RepositoryCustomPropertyEdge]
"""
A list of nodes.
"""
nodes: [RepositoryCustomProperty]
"""
Information to aid in pagination.
"""
pageInfo: PageInfo!
"""
Identifies the total count of items in the connection.
"""
totalCount: Int!
}
"""
An edge in a connection.
"""
type RepositoryCustomPropertyEdge {
"""
A cursor for use in pagination.
"""
cursor: String!
"""
The item at the end of the edge.
"""
node: RepositoryCustomProperty
}
"""
A value associated with a repository custom property.
"""
type RepositoryCustomPropertyValue {
"""
The name of the custom property.
"""
propertyName: String!
"""
The value of the custom property.
"""
value: CustomPropertyValue!
}
"""
The connection type for RepositoryCustomPropertyValue.
"""
type RepositoryCustomPropertyValueConnection {
"""
A list of edges.
"""
edges: [RepositoryCustomPropertyValueEdge]
"""
A list of nodes.
"""
nodes: [RepositoryCustomPropertyValue]
"""
Information to aid in pagination.
"""
pageInfo: PageInfo!
"""
Identifies the total count of items in the connection.
"""
totalCount: Int!
}
"""
An edge in a connection.
"""
type RepositoryCustomPropertyValueEdge {
"""
A cursor for use in pagination.
"""
cursor: String!
"""
The item at the end of the edge.
"""
node: RepositoryCustomPropertyValue
}
"""
The allowed actors who can edit the values of a custom property.
"""
enum RepositoryCustomPropertyValuesEditableBy {
"""
The organization actors.
"""
ORG_ACTORS
"""
The organization and repository actors.
"""
ORG_AND_REPO_ACTORS
}
""" """
Represents an author of discussions in repositories. Represents an author of discussions in repositories.
""" """
@@ -56348,6 +56856,41 @@ type SetOrganizationInteractionLimitPayload {
organization: Organization organization: Organization
} }
"""
Autogenerated input type of SetRepositoryCustomPropertyValues
"""
input SetRepositoryCustomPropertyValuesInput {
"""
A unique identifier for the client performing the mutation.
"""
clientMutationId: String
"""
A list of custom property names and associated values to apply.
"""
properties: [CustomPropertyValueInput!]!
"""
The ID of the repository to set properties for.
"""
repositoryId: ID! @possibleTypes(concreteTypes: ["Repository"])
}
"""
Autogenerated return type of SetRepositoryCustomPropertyValues.
"""
type SetRepositoryCustomPropertyValuesPayload {
"""
A unique identifier for the client performing the mutation.
"""
clientMutationId: String
"""
The repository that the custom properties were set for.
"""
repository: Repository
}
""" """
Autogenerated input type of SetRepositoryInteractionLimit Autogenerated input type of SetRepositoryInteractionLimit
""" """
@@ -66870,6 +67413,66 @@ type UpdateRefsPayload {
clientMutationId: String clientMutationId: String
} }
"""
Autogenerated input type of UpdateRepositoryCustomProperty
"""
input UpdateRepositoryCustomPropertyInput {
"""
The updated allowed values for the custom property.
"""
allowedValues: [String!]
"""
A unique identifier for the client performing the mutation.
"""
clientMutationId: String
"""
The updated default value for the custom property if the property is required.
"""
defaultValue: String
"""
The updated description of the custom property.
"""
description: String
"""
The regex pattern that the value of the custom property must match, if the `value_type` is `string`.
"""
regex: String
"""
The global relay id of the source of the custom property.
"""
repositoryCustomPropertyId: ID! @possibleTypes(concreteTypes: ["RepositoryCustomProperty"])
"""
Whether the updated custom property is required.
"""
required: Boolean
"""
The updated actors who can edit the values of the custom property.
"""
valuesEditableBy: RepositoryCustomPropertyValuesEditableBy
}
"""
Autogenerated return type of UpdateRepositoryCustomProperty.
"""
type UpdateRepositoryCustomPropertyPayload {
"""
A unique identifier for the client performing the mutation.
"""
clientMutationId: String
"""
The updated repository custom property.
"""
repositoryCustomProperty: RepositoryCustomProperty
}
""" """
Autogenerated input type of UpdateRepository Autogenerated input type of UpdateRepository
""" """

File diff suppressed because it is too large Load Diff

View File

@@ -8724,6 +8724,76 @@ type CreateRefPayload {
ref: Ref ref: Ref
} }
"""
Autogenerated input type of CreateRepositoryCustomProperty
"""
input CreateRepositoryCustomPropertyInput {
"""
The allowed values for the custom property.
"""
allowedValues: [String!]
"""
A unique identifier for the client performing the mutation.
"""
clientMutationId: String
"""
The default value for the custom property if the property is required.
"""
defaultValue: String
"""
The description of the custom property.
"""
description: String
"""
The name of the custom property.
"""
propertyName: String!
"""
The regex pattern that the value of the custom property must match, if the `value_type` is `string`.
"""
regex: String
"""
Whether the custom property is required.
"""
required: Boolean
"""
The global relay id of the source in which a new custom property should be created in.
"""
sourceId: ID! @possibleTypes(concreteTypes: ["Enterprise", "Organization"], abstractType: "CustomPropertySource")
"""
The value type for the custom property.
"""
valueType: CustomPropertyValueType!
"""
The allowed actors who can edit the values of a custom property.
"""
valuesEditableBy: RepositoryCustomPropertyValuesEditableBy
}
"""
Autogenerated return type of CreateRepositoryCustomProperty.
"""
type CreateRepositoryCustomPropertyPayload {
"""
A unique identifier for the client performing the mutation.
"""
clientMutationId: String
"""
The newly created repository custom property.
"""
repositoryCustomProperty: RepositoryCustomProperty
}
""" """
Autogenerated input type of CreateRepository Autogenerated input type of CreateRepository
""" """
@@ -9782,6 +9852,64 @@ type CrossReferencedEvent implements Node & UniformResourceLocatable {
willCloseTarget: Boolean! willCloseTarget: Boolean!
} }
"""
Sources which can have custom properties defined.
"""
union CustomPropertySource = Enterprise | Organization
"""
A custom property value can be either a string or an array of strings. All
property types support only a single string value, except for the multi-select
type, which supports only a string array.
"""
scalar CustomPropertyValue
"""
The custom property name and value to be set.
"""
input CustomPropertyValueInput {
"""
The name of the custom property.
"""
propertyName: String!
"""
The value to set for the custom property. Using a value of null will unset the
property value, reverting to the default value if the property is required.
"""
value: CustomPropertyValue
}
"""
The allowed value types for a custom property definition.
"""
enum CustomPropertyValueType {
"""
A multi-select value.
"""
MULTI_SELECT
"""
A single-select value.
"""
SINGLE_SELECT
"""
A string value.
"""
STRING
"""
A true/false value.
"""
TRUE_FALSE
"""
A URL value.
"""
URL
}
""" """
The Common Vulnerability Scoring System The Common Vulnerability Scoring System
""" """
@@ -10588,6 +10716,36 @@ type DeleteRefPayload {
clientMutationId: String clientMutationId: String
} }
"""
Autogenerated input type of DeleteRepositoryCustomProperty
"""
input DeleteRepositoryCustomPropertyInput {
"""
A unique identifier for the client performing the mutation.
"""
clientMutationId: String
"""
The global relay id of the custom property to be deleted.
"""
id: ID! @possibleTypes(concreteTypes: ["RepositoryCustomProperty"])
}
"""
Autogenerated return type of DeleteRepositoryCustomProperty.
"""
type DeleteRepositoryCustomPropertyPayload {
"""
A unique identifier for the client performing the mutation.
"""
clientMutationId: String
"""
The deleted custom property.
"""
repositoryCustomProperty: RepositoryCustomProperty
}
""" """
Autogenerated input type of DeleteRepositoryRuleset Autogenerated input type of DeleteRepositoryRuleset
""" """
@@ -13660,6 +13818,41 @@ type Enterprise implements Node {
""" """
readmeHTML: HTML! readmeHTML: HTML!
"""
A list of repository custom properties for this enterprise.
"""
repositoryCustomProperties(
"""
Returns the elements in the list that come after the specified cursor.
"""
after: String
"""
Returns the elements in the list that come before the specified cursor.
"""
before: String
"""
Returns the first _n_ elements from the list.
"""
first: Int
"""
Returns the last _n_ elements from the list.
"""
last: Int
): RepositoryCustomPropertyConnection
"""
Returns a single repository custom property for the current enterprise by name.
"""
repositoryCustomProperty(
"""
The name of the repository custom property to be returned.
"""
propertyName: String!
): RepositoryCustomProperty
""" """
The HTTP path for this enterprise. The HTTP path for this enterprise.
""" """
@@ -25263,6 +25456,16 @@ type Mutation {
input: CreateRepositoryInput! input: CreateRepositoryInput!
): CreateRepositoryPayload ): CreateRepositoryPayload
"""
Create a repository custom property.
"""
createRepositoryCustomProperty(
"""
Parameters for CreateRepositoryCustomProperty
"""
input: CreateRepositoryCustomPropertyInput!
): CreateRepositoryCustomPropertyPayload
""" """
Create a repository ruleset Create a repository ruleset
""" """
@@ -25593,6 +25796,16 @@ type Mutation {
input: DeleteRefInput! input: DeleteRefInput!
): DeleteRefPayload ): DeleteRefPayload
"""
Delete a repository custom property.
"""
deleteRepositoryCustomProperty(
"""
Parameters for DeleteRepositoryCustomProperty
"""
input: DeleteRepositoryCustomPropertyInput!
): DeleteRepositoryCustomPropertyPayload
""" """
Delete a repository ruleset Delete a repository ruleset
""" """
@@ -25935,6 +26148,16 @@ type Mutation {
input: PinIssueInput! input: PinIssueInput!
): PinIssuePayload ): PinIssuePayload
"""
Promote a repository custom property to the enterprise level.
"""
promoteRepositoryCustomProperty(
"""
Parameters for PromoteRepositoryCustomProperty
"""
input: PromoteRepositoryCustomPropertyInput!
): PromoteRepositoryCustomPropertyPayload
""" """
Publish an existing sponsorship tier that is currently still a draft to a GitHub Sponsors profile. Publish an existing sponsorship tier that is currently still a draft to a GitHub Sponsors profile.
""" """
@@ -26256,6 +26479,16 @@ type Mutation {
input: SetOrganizationInteractionLimitInput! input: SetOrganizationInteractionLimitInput!
): SetOrganizationInteractionLimitPayload ): SetOrganizationInteractionLimitPayload
"""
Set repository custom property values for a repository.
"""
setRepositoryCustomPropertyValues(
"""
Parameters for SetRepositoryCustomPropertyValues
"""
input: SetRepositoryCustomPropertyValuesInput!
): SetRepositoryCustomPropertyValuesPayload
""" """
Sets an interaction limit setting for a repository. Sets an interaction limit setting for a repository.
""" """
@@ -27049,6 +27282,16 @@ type Mutation {
input: UpdateRepositoryInput! input: UpdateRepositoryInput!
): UpdateRepositoryPayload ): UpdateRepositoryPayload
"""
Update a repository custom property.
"""
updateRepositoryCustomProperty(
"""
Parameters for UpdateRepositoryCustomProperty
"""
input: UpdateRepositoryCustomPropertyInput!
): UpdateRepositoryCustomPropertyPayload
""" """
Update a repository ruleset Update a repository ruleset
""" """
@@ -33264,6 +33507,41 @@ type Organization implements Actor & MemberStatusable & Node & PackageOwner & Pr
name: String! name: String!
): Repository ): Repository
"""
A list of custom properties for this organization.
"""
repositoryCustomProperties(
"""
Returns the elements in the list that come after the specified cursor.
"""
after: String
"""
Returns the elements in the list that come before the specified cursor.
"""
before: String
"""
Returns the first _n_ elements from the list.
"""
first: Int
"""
Returns the last _n_ elements from the list.
"""
last: Int
): RepositoryCustomPropertyConnection
"""
Returns a single custom property from the current organization by name.
"""
repositoryCustomProperty(
"""
The name of the custom property to be returned.
"""
propertyName: String!
): RepositoryCustomProperty
""" """
Discussion comments this user has authored. Discussion comments this user has authored.
""" """
@@ -40299,6 +40577,36 @@ enum ProjectV2WorkflowsOrderField {
UPDATED_AT UPDATED_AT
} }
"""
Autogenerated input type of PromoteRepositoryCustomProperty
"""
input PromoteRepositoryCustomPropertyInput {
"""
A unique identifier for the client performing the mutation.
"""
clientMutationId: String
"""
The ID of the repository custom property to be promoted.
"""
repositoryCustomPropertyId: ID! @possibleTypes(concreteTypes: ["RepositoryCustomProperty"])
}
"""
Autogenerated return type of PromoteRepositoryCustomProperty.
"""
type PromoteRepositoryCustomPropertyPayload {
"""
A unique identifier for the client performing the mutation.
"""
clientMutationId: String
"""
The repository custom property that has been promoted.
"""
repositoryCustomProperty: RepositoryCustomProperty
}
""" """
A property that must match A property that must match
""" """
@@ -51484,6 +51792,41 @@ type Repository implements Node & PackageOwner & ProjectOwner & ProjectV2Recent
orderBy: ReleaseOrder orderBy: ReleaseOrder
): ReleaseConnection! ): ReleaseConnection!
"""
A custom property value for the repository.
"""
repositoryCustomPropertyValue(
"""
The name of the custom property to retrieve the value for.
"""
propertyName: String!
): RepositoryCustomPropertyValue
"""
A list of custom properties and their associated values for a repository.
"""
repositoryCustomPropertyValues(
"""
Returns the elements in the list that come after the specified cursor.
"""
after: String
"""
Returns the elements in the list that come before the specified cursor.
"""
before: String
"""
Returns the first _n_ elements from the list.
"""
first: Int
"""
Returns the last _n_ elements from the list.
"""
last: Int
): RepositoryCustomPropertyValueConnection
""" """
A list of applied repository-topic associations for this repository. A list of applied repository-topic associations for this repository.
""" """
@@ -52095,6 +52438,171 @@ enum RepositoryContributionType {
REPOSITORY REPOSITORY
} }
"""
A repository custom property.
"""
type RepositoryCustomProperty implements Node {
"""
The allowed values for the custom property. Required if `value_type` is `single_select` or `multi_select`.
"""
allowedValues: [String!]
"""
The default value of the custom property, if the property is `required`.
"""
defaultValue: CustomPropertyValue
"""
The description of the custom property.
"""
description: String
"""
The Node ID of the RepositoryCustomProperty object
"""
id: ID!
"""
The name of the custom property.
"""
propertyName: String!
"""
The regex pattern that the value of the custom property must match, if the `value_type` is `string`.
"""
regex: String
"""
Whether the custom property is required.
"""
required: Boolean
"""
The source type of the custom property.
"""
source: CustomPropertySource!
"""
The value type of the custom property.
"""
valueType: CustomPropertyValueType!
"""
Who can edit the values of this repository custom property.
"""
valuesEditableBy: RepositoryCustomPropertyValuesEditableBy!
}
"""
The connection type for RepositoryCustomProperty.
"""
type RepositoryCustomPropertyConnection {
"""
A list of edges.
"""
edges: [RepositoryCustomPropertyEdge]
"""
A list of nodes.
"""
nodes: [RepositoryCustomProperty]
"""
Information to aid in pagination.
"""
pageInfo: PageInfo!
"""
Identifies the total count of items in the connection.
"""
totalCount: Int!
}
"""
An edge in a connection.
"""
type RepositoryCustomPropertyEdge {
"""
A cursor for use in pagination.
"""
cursor: String!
"""
The item at the end of the edge.
"""
node: RepositoryCustomProperty
}
"""
A value associated with a repository custom property.
"""
type RepositoryCustomPropertyValue {
"""
The name of the custom property.
"""
propertyName: String!
"""
The value of the custom property.
"""
value: CustomPropertyValue!
}
"""
The connection type for RepositoryCustomPropertyValue.
"""
type RepositoryCustomPropertyValueConnection {
"""
A list of edges.
"""
edges: [RepositoryCustomPropertyValueEdge]
"""
A list of nodes.
"""
nodes: [RepositoryCustomPropertyValue]
"""
Information to aid in pagination.
"""
pageInfo: PageInfo!
"""
Identifies the total count of items in the connection.
"""
totalCount: Int!
}
"""
An edge in a connection.
"""
type RepositoryCustomPropertyValueEdge {
"""
A cursor for use in pagination.
"""
cursor: String!
"""
The item at the end of the edge.
"""
node: RepositoryCustomPropertyValue
}
"""
The allowed actors who can edit the values of a custom property.
"""
enum RepositoryCustomPropertyValuesEditableBy {
"""
The organization actors.
"""
ORG_ACTORS
"""
The organization and repository actors.
"""
ORG_AND_REPO_ACTORS
}
""" """
Represents an author of discussions in repositories. Represents an author of discussions in repositories.
""" """
@@ -56348,6 +56856,41 @@ type SetOrganizationInteractionLimitPayload {
organization: Organization organization: Organization
} }
"""
Autogenerated input type of SetRepositoryCustomPropertyValues
"""
input SetRepositoryCustomPropertyValuesInput {
"""
A unique identifier for the client performing the mutation.
"""
clientMutationId: String
"""
A list of custom property names and associated values to apply.
"""
properties: [CustomPropertyValueInput!]!
"""
The ID of the repository to set properties for.
"""
repositoryId: ID! @possibleTypes(concreteTypes: ["Repository"])
}
"""
Autogenerated return type of SetRepositoryCustomPropertyValues.
"""
type SetRepositoryCustomPropertyValuesPayload {
"""
A unique identifier for the client performing the mutation.
"""
clientMutationId: String
"""
The repository that the custom properties were set for.
"""
repository: Repository
}
""" """
Autogenerated input type of SetRepositoryInteractionLimit Autogenerated input type of SetRepositoryInteractionLimit
""" """
@@ -66870,6 +67413,66 @@ type UpdateRefsPayload {
clientMutationId: String clientMutationId: String
} }
"""
Autogenerated input type of UpdateRepositoryCustomProperty
"""
input UpdateRepositoryCustomPropertyInput {
"""
The updated allowed values for the custom property.
"""
allowedValues: [String!]
"""
A unique identifier for the client performing the mutation.
"""
clientMutationId: String
"""
The updated default value for the custom property if the property is required.
"""
defaultValue: String
"""
The updated description of the custom property.
"""
description: String
"""
The regex pattern that the value of the custom property must match, if the `value_type` is `string`.
"""
regex: String
"""
The global relay id of the source of the custom property.
"""
repositoryCustomPropertyId: ID! @possibleTypes(concreteTypes: ["RepositoryCustomProperty"])
"""
Whether the updated custom property is required.
"""
required: Boolean
"""
The updated actors who can edit the values of the custom property.
"""
valuesEditableBy: RepositoryCustomPropertyValuesEditableBy
}
"""
Autogenerated return type of UpdateRepositoryCustomProperty.
"""
type UpdateRepositoryCustomPropertyPayload {
"""
A unique identifier for the client performing the mutation.
"""
clientMutationId: String
"""
The updated repository custom property.
"""
repositoryCustomProperty: RepositoryCustomProperty
}
""" """
Autogenerated input type of UpdateRepository Autogenerated input type of UpdateRepository
""" """

File diff suppressed because it is too large Load Diff

View File

@@ -19,8 +19,8 @@ interface Preview {
title: string title: string
description: string description: string
toggled_by: string toggled_by: string
announcement: any announcement: unknown
updates: any updates: unknown
toggled_on: string[] toggled_on: string[]
owning_teams: string[] owning_teams: string[]
} }
@@ -33,7 +33,7 @@ interface UpcomingChange {
interface IgnoredChange { interface IgnoredChange {
type: string type: string
[key: string]: any [key: string]: unknown
} }
interface IgnoredChangesSummary { interface IgnoredChangesSummary {
@@ -285,7 +285,7 @@ describe('ignored changes tracking', () => {
// This should generate a TypeDescriptionAdded change type that gets ignored // This should generate a TypeDescriptionAdded change type that gets ignored
await createChangelogEntry(oldSchemaString, newSchemaString, [], [], []) await createChangelogEntry(oldSchemaString, newSchemaString, [], [], [])
const ignoredChanges: IgnoredChange[] = getLastIgnoredChanges() const ignoredChanges: IgnoredChange[] = getLastIgnoredChanges() as unknown as IgnoredChange[]
expect(ignoredChanges.length).toBe(1) expect(ignoredChanges.length).toBe(1)
expect(ignoredChanges[0].type).toBe('TYPE_DESCRIPTION_ADDED') expect(ignoredChanges[0].type).toBe('TYPE_DESCRIPTION_ADDED')
}) })

View File

@@ -1,5 +1,6 @@
import { createContext, useContext } from 'react' import { createContext, useContext } from 'react'
import pick from 'lodash/pick' import pick from 'lodash/pick'
import type { ExtendedRequest } from '@/types'
export type LearningTrack = { export type LearningTrack = {
trackName: string trackName: string
@@ -38,24 +39,45 @@ export const useProductGuidesContext = (): ProductGuidesContextT => {
return context return context
} }
export const getProductGuidesContextFromRequest = (req: any): ProductGuidesContextT => { export const getProductGuidesContextFromRequest = (req: ExtendedRequest): ProductGuidesContextT => {
const page = req.context.page if (!req.context || !req.context.page) {
throw new Error('Request context or page is missing')
}
const learningTracks: LearningTrack[] = (page.learningTracks || []).map((track: any) => ({ const page = req.context.page as typeof req.context.page & {
...pick(track, ['title', 'description', 'trackName', 'trackProduct']), learningTracks?: Array<Record<string, unknown>>
guides: (track.guides || []).map((guide: any) => { includeGuides?: Array<Record<string, unknown>>
return pick(guide, ['title', 'intro', 'href', 'page.type']) }
const learningTracks: LearningTrack[] = (page.learningTracks || []).map(
(track: Record<string, unknown>) => ({
title: (track.title as string) || '',
description: (track.description as string) || '',
trackName: (track.trackName as string) || '',
trackProduct: (track.trackProduct as string) || '',
guides: ((track.guides as Array<Record<string, unknown>>) || []).map(
(guide: Record<string, unknown>) => ({
title: (guide.title as string) || '',
intro: (guide.intro as string) || '',
href: (guide.href as string) || '',
page: guide.page as { type: string } | undefined,
}),
),
}), }),
})) )
return { return {
...pick(page, ['title', 'intro']), ...pick(page, ['title', 'intro']),
title: page.title || '',
intro: page.intro || '',
learningTracks, learningTracks,
includeGuides: (page.includeGuides || []).map((guide: any) => { includeGuides: (page.includeGuides || []).map((guide: Record<string, unknown>) => {
return { return {
...pick(guide, ['href', 'title', 'intro']), href: (guide.href as string) || '',
type: guide.type || '', title: (guide.title as string) || '',
topics: guide.topics || [], intro: (guide.intro as string) || '',
type: (guide.type as string) || '',
topics: (guide.topics as Array<string>) || [],
} }
}), }),
} }

View File

@@ -77,10 +77,10 @@ function run(languageCode: string, site: Site, englishReusables: Reusables) {
const illegalTags = new Map<string, number>() const illegalTags = new Map<string, number>()
function countError(error: TokenizationError, where: string) { function countError(error: TokenizationError, where: string) {
const originalError = (error as any).originalError const originalError = (error as { originalError?: Error }).originalError
const errorString = originalError ? originalError.message : error.message const errorString = originalError ? originalError.message : error.message
if (errorString.includes('illegal tag syntax')) { if (errorString.includes('illegal tag syntax')) {
const illegalTag = (error as any).token.content const illegalTag = (error as unknown as { token: { content: string } }).token.content
illegalTags.set(illegalTag, (illegalTags.get(illegalTag) || 0) + 1) illegalTags.set(illegalTag, (illegalTags.get(illegalTag) || 0) + 1)
} }
errors.set(errorString, (errors.get(errorString) || 0) + 1) errors.set(errorString, (errors.get(errorString) || 0) + 1)

View File

@@ -2,18 +2,10 @@
* Common types used across learning track components * Common types used across learning track components
*/ */
/** import type { Context, Page as MainPage } from '@/types'
* Basic context interface for rendering operations
*/ // Re-export Context from main types to avoid duplicate definitions
export interface Context { export type { Context }
currentProduct?: string
currentLanguage?: string
currentVersion?: string
pages?: any
redirects?: any
// Additional properties that may be needed for rendering
[key: string]: any
}
/** /**
* Options for retrieving link data * Options for retrieving link data
@@ -49,11 +41,9 @@ export interface PageFeaturedLinks {
/** /**
* Page interface for basic page properties * Page interface for basic page properties
* Using the main Page type from @/types
*/ */
export interface Page { export type Page = MainPage
renderTitle: (context: Context, opts: any) => Promise<string>
renderProp: (prop: string, context: Context, opts: any) => Promise<string>
}
/** /**
* Guide in a learning track * Guide in a learning track
@@ -83,7 +73,7 @@ export interface LearningTrackMetadata {
title: string title: string
description: string description: string
guides: string[] guides: string[]
versions?: any versions?: unknown
} }
/** /**

View File

@@ -4,7 +4,7 @@ import nock from 'nock'
import FailBot from '../lib/failbot' import FailBot from '../lib/failbot'
describe('FailBot', () => { describe('FailBot', () => {
const requestBodiesSent: any[] = [] const requestBodiesSent: unknown[] = []
beforeEach(() => { beforeEach(() => {
delete process.env.HAYSTACK_URL delete process.env.HAYSTACK_URL

View File

@@ -1,4 +1,4 @@
import express from 'express' import express, { RequestHandler } from 'express'
import path from 'path' import path from 'path'
import { readCompressedJsonFileFallbackLazily } from '@/frame/lib/read-json-file' import { readCompressedJsonFileFallbackLazily } from '@/frame/lib/read-json-file'
@@ -12,20 +12,22 @@ const clientSideRestAPIRedirects = readCompressedJsonFileFallbackLazily(
const router = express.Router() const router = express.Router()
// Returns a client side redirect if one exists for the given path. // Returns a client side redirect if one exists for the given path.
// Note: Using 'any' for req/res because Express types are complex and the const redirects: RequestHandler = (req, res) => {
// function signature is constrained by the router.get() overloads
router.get('/', function redirects(req: any, res: any) {
if (!req.query.path) { if (!req.query.path) {
return res.status(400).send("Missing 'path' query string") res.status(400).send("Missing 'path' query string")
return
} }
if (!req.query.hash) { if (!req.query.hash) {
return res.status(400).send("Missing 'hash' query string") res.status(400).send("Missing 'hash' query string")
return
} }
defaultCacheControl(res) defaultCacheControl(res)
const redirectFrom: string = `${req.query.path}#${req.query.hash}` const redirectFrom: string = `${req.query.path}#${req.query.hash}`
res.status(200).send({ to: clientSideRestAPIRedirects()[redirectFrom] }) res.status(200).send({ to: clientSideRestAPIRedirects()[redirectFrom] })
}) }
router.get('/', redirects)
export default router export default router

View File

@@ -8,7 +8,7 @@ import fs from 'fs'
import path from 'path' import path from 'path'
import { globSync } from 'glob' import { globSync } from 'glob'
import { program } from 'commander' import { program } from 'commander'
import { createOperations, processOperations } from './utils/get-operations' import { createOperations, processOperations, type SchemaInput } from './utils/get-operations'
interface ProgramOptions { interface ProgramOptions {
files: string[] files: string[]
@@ -35,15 +35,15 @@ if (filesToCheck.length) {
async function check(files: string[]): Promise<void> { async function check(files: string[]): Promise<void> {
console.log('Verifying OpenAPI files are valid with decorator') console.log('Verifying OpenAPI files are valid with decorator')
const documents: [string, any][] = files.map((filename: string) => [ const documents: [string, unknown][] = files.map((filename: string) => [
filename, filename,
JSON.parse(fs.readFileSync(path.join(filename), 'utf8')), JSON.parse(fs.readFileSync(path.join(filename), 'utf8')),
]) ])
for (const [filename, schema] of documents as [string, any][]) { for (const [filename, schema] of documents as [string, unknown][]) {
try { try {
// munge OpenAPI definitions object in an array of operations objects // munge OpenAPI definitions object in an array of operations objects
const operations = await createOperations(schema) const operations = await createOperations(schema as SchemaInput)
// process each operation, asynchronously rendering markdown and stuff // process each operation, asynchronously rendering markdown and stuff
await processOperations(operations, {}) await processOperations(operations, {})

View File

@@ -1,18 +1,18 @@
import { renderContent } from './render-content' import { renderContent } from './render-content'
interface Schema { export interface Schema {
oneOf?: any[] oneOf?: Schema[]
type?: string type?: string
items?: any items?: Schema
properties?: Record<string, any> properties?: Record<string, Schema>
required?: string[] required?: string[]
additionalProperties?: any additionalProperties?: Schema
description?: string description?: string
enum?: string[] enum?: string[]
nullable?: boolean nullable?: boolean
allOf?: any[] allOf?: Schema[]
anyOf?: any[] anyOf?: Schema[]
[key: string]: any [key: string]: unknown
} }
export interface TransformedParam { export interface TransformedParam {
@@ -24,7 +24,7 @@ export interface TransformedParam {
childParamsGroups?: TransformedParam[] childParamsGroups?: TransformedParam[]
enum?: string[] enum?: string[]
oneOfObject?: boolean oneOfObject?: boolean
default?: any default?: unknown
} }
interface BodyParamProps { interface BodyParamProps {
@@ -43,7 +43,7 @@ interface BodyParamProps {
// operations have a top-level oneOf. // operations have a top-level oneOf.
async function getTopLevelOneOfProperty( async function getTopLevelOneOfProperty(
schema: Schema, schema: Schema,
): Promise<{ properties: Record<string, any>; required: string[] }> { ): Promise<{ properties: Record<string, Schema>; required: string[] }> {
if (!schema.oneOf) { if (!schema.oneOf) {
throw new Error('Schema does not have a requestBody oneOf property defined') throw new Error('Schema does not have a requestBody oneOf property defined')
} }
@@ -65,10 +65,14 @@ async function getTopLevelOneOfProperty(
// This merges all of the properties and required values. // This merges all of the properties and required values.
if (allOneOfAreObjects) { if (allOneOfAreObjects) {
for (const each of schema.oneOf.slice(1)) { for (const each of schema.oneOf.slice(1)) {
Object.assign(firstOneOfObject.properties, each.properties) if (firstOneOfObject.properties && each.properties) {
required = firstOneOfObject.required.concat(each.required) Object.assign(firstOneOfObject.properties, each.properties)
}
if (firstOneOfObject.required && each.required) {
required = firstOneOfObject.required.concat(each.required)
}
} }
properties = firstOneOfObject.properties properties = firstOneOfObject.properties || {}
} }
return { properties, required } return { properties, required }
} }
@@ -79,7 +83,7 @@ async function handleObjectOnlyOneOf(
param: Schema, param: Schema,
paramType: string[], paramType: string[],
): Promise<TransformedParam[]> { ): Promise<TransformedParam[]> {
if (param.oneOf && param.oneOf.every((object: TransformedParam) => object.type === 'object')) { if (param.oneOf && param.oneOf.every((object: Schema) => object.type === 'object')) {
paramType.push('object') paramType.push('object')
param.oneOfObject = true param.oneOfObject = true
return await getOneOfChildParams(param) return await getOneOfChildParams(param)
@@ -97,6 +101,9 @@ export async function getBodyParams(schema: Schema, topLevel = false): Promise<T
// there will not be properties on the `schema` object. // there will not be properties on the `schema` object.
if (topLevel && schema.type === 'array') { if (topLevel && schema.type === 'array') {
const childParamsGroups: TransformedParam[] = [] const childParamsGroups: TransformedParam[] = []
if (!schema.items) {
throw new Error('Array schema must have items property')
}
const arrayType = schema.items.type const arrayType = schema.items.type
const paramType = [schema.type] const paramType = [schema.type]
if (arrayType === 'object') { if (arrayType === 'object') {
@@ -118,11 +125,14 @@ export async function getBodyParams(schema: Schema, topLevel = false): Promise<T
// This makes type an array regardless of how many values the array // This makes type an array regardless of how many values the array
// includes. This allows us to support 3.1 while remaining backwards // includes. This allows us to support 3.1 while remaining backwards
// compatible with 3.0. // compatible with 3.0.
const paramType = Array.isArray(param.type) ? param.type : [param.type] const paramType = (Array.isArray(param.type) ? param.type : [param.type]).filter(
(t): t is string => t !== undefined,
)
const additionalPropertiesType = param.additionalProperties const additionalPropertiesType = param.additionalProperties
? Array.isArray(param.additionalProperties.type) ? (Array.isArray(param.additionalProperties.type)
? param.additionalProperties.type ? param.additionalProperties.type
: [param.additionalProperties.type] : [param.additionalProperties.type]
).filter((t): t is string => t !== undefined)
: [] : []
const childParamsGroups: TransformedParam[] = [] const childParamsGroups: TransformedParam[] = []
@@ -142,7 +152,6 @@ export async function getBodyParams(schema: Schema, topLevel = false): Promise<T
description: await renderContent( description: await renderContent(
`A user-defined key to represent an item in \`${paramKey}\`.`, `A user-defined key to represent an item in \`${paramKey}\`.`,
), ),
isRequired: param.required,
enum: param.enum, enum: param.enum,
default: param.default, default: param.default,
childParamsGroups: [], childParamsGroups: [],
@@ -153,7 +162,7 @@ export async function getBodyParams(schema: Schema, topLevel = false): Promise<T
childParamsGroups.push(keyParam) childParamsGroups.push(keyParam)
} else if (paramType.includes('array') && param.items) { } else if (paramType.includes('array') && param.items) {
if (param.items.oneOf) { if (param.items.oneOf) {
if (param.items.oneOf.every((object: TransformedParam) => object.type === 'object')) { if (param.items.oneOf.every((object: Schema) => object.type === 'object')) {
paramType.splice(paramType.indexOf('array'), 1, `array of objects`) paramType.splice(paramType.indexOf('array'), 1, `array of objects`)
param.oneOfObject = true param.oneOfObject = true
childParamsGroups.push(...(await getOneOfChildParams(param.items))) childParamsGroups.push(...(await getOneOfChildParams(param.items)))
@@ -169,7 +178,7 @@ export async function getBodyParams(schema: Schema, topLevel = false): Promise<T
if (arrayType === 'string' && param.items.enum) { if (arrayType === 'string' && param.items.enum) {
param.description += `${ param.description += `${
param.description ? '\n' : '' param.description ? '\n' : ''
}Supported values are: ${param.items.enum.map((lang: string) => `<code>${lang}</code>`).join(', ')}` }Supported values are: ${((param.items.enum || []) as string[]).map((lang: string) => `<code>${lang}</code>`).join(', ')}`
} }
} }
} else if (paramType.includes('object')) { } else if (paramType.includes('object')) {
@@ -183,7 +192,7 @@ export async function getBodyParams(schema: Schema, topLevel = false): Promise<T
} }
} else if (param.oneOf) { } else if (param.oneOf) {
// Check if all oneOf items are objects - if so, treat this as a oneOfObject case // Check if all oneOf items are objects - if so, treat this as a oneOfObject case
const oneOfChildren = await handleObjectOnlyOneOf(param, paramType) const oneOfChildren = await handleObjectOnlyOneOf(param as Schema, paramType)
if (oneOfChildren.length > 0) { if (oneOfChildren.length > 0) {
childParamsGroups.push(...oneOfChildren) childParamsGroups.push(...oneOfChildren)
} else { } else {
@@ -193,19 +202,25 @@ export async function getBodyParams(schema: Schema, topLevel = false): Promise<T
paramType.push(childParam.type) paramType.push(childParam.type)
if (!param.description) { if (!param.description) {
if (childParam.type === 'array') { if (childParam.type === 'array') {
if (childParam.items.description) { if (childParam.items && childParam.items.description) {
descriptions.push({ descriptions.push({
type: childParam.type, type: (childParam.type as string) || '',
description: childParam.items.description, description: (childParam.items?.description as string) || '',
}) })
} }
} else { } else {
if (childParam.description) { if (childParam.description) {
descriptions.push({ type: childParam.type, description: childParam.description }) descriptions.push({
type: (childParam.type as string) || '',
description: (childParam.description as string) || '',
})
} }
} }
} else { } else {
descriptions.push({ type: param.type, description: param.description }) descriptions.push({
type: (param.type as string) || '',
description: (param.description as string) || '',
})
} }
} }
// Occasionally, there is no parent description and the description // Occasionally, there is no parent description and the description
@@ -226,12 +241,10 @@ export async function getBodyParams(schema: Schema, topLevel = false): Promise<T
if (firstObject) { if (firstObject) {
paramType.push('object') paramType.push('object')
param.description = firstObject.description param.description = firstObject.description
param.isRequired = firstObject.required
childParamsGroups.push(...(await getBodyParams(firstObject, false))) childParamsGroups.push(...(await getBodyParams(firstObject, false)))
} else { } else {
paramType.push(param.anyOf[0].type) paramType.push(param.anyOf[0].type as string)
param.description = param.anyOf[0].description param.description = param.anyOf[0].description
param.isRequired = param.anyOf[0].required
} }
// Used only for webhooks handling allOf // Used only for webhooks handling allOf
} else if (param.allOf) { } else if (param.allOf) {
@@ -313,9 +326,8 @@ async function getOneOfChildParams(param: Schema): Promise<TransformedParam[]> {
for (const oneOfParam of param.oneOf) { for (const oneOfParam of param.oneOf) {
const objParam: TransformedParam = { const objParam: TransformedParam = {
type: 'object', type: 'object',
name: oneOfParam.title, name: (oneOfParam.title as string) || '',
description: await renderContent(oneOfParam.description), description: await renderContent((oneOfParam.description as string) || ''),
isRequired: oneOfParam.required,
childParamsGroups: [], childParamsGroups: [],
} }
if (objParam.childParamsGroups) { if (objParam.childParamsGroups) {

View File

@@ -4,7 +4,7 @@ interface ProgAccessData {
[key: string]: any [key: string]: any
} }
interface SchemaInput { export interface SchemaInput {
paths?: { paths?: {
[requestPath: string]: { [requestPath: string]: {
[verb: string]: any [verb: string]: any

View File

@@ -7,8 +7,9 @@
* https://github.com/github/token-scanning-service/blob/main/docs/public-docs * https://github.com/github/token-scanning-service/blob/main/docs/public-docs
* directory to src/secret-scanning/data/pattern-docs * directory to src/secret-scanning/data/pattern-docs
*/ */
import { writeFile } from 'fs/promises' import { writeFile, mkdir } from 'fs/promises'
import yaml from 'js-yaml' import yaml from 'js-yaml'
import path from 'path'
import { getDirectoryContents } from '@/workflows/git-utils' import { getDirectoryContents } from '@/workflows/git-utils'
import schema from '@/secret-scanning/data/public-docs-schema' import schema from '@/secret-scanning/data/public-docs-schema'
@@ -52,6 +53,7 @@ async function main() {
const filePath = file.path.replace(`${directory}/`, '') const filePath = file.path.replace(`${directory}/`, '')
const localFilePath = `${SECRET_SCANNING_DIR}/${filePath}` const localFilePath = `${SECRET_SCANNING_DIR}/${filePath}`
await mkdir(path.dirname(localFilePath), { recursive: true })
await writeFile(localFilePath, yaml.dump(yamlData)) await writeFile(localFilePath, yaml.dump(yamlData))
} }
} }

View File

@@ -1,5 +1,9 @@
import { describe, expect, test } from 'vitest' import { describe, expect, test } from 'vitest'
import { getBodyParams, type TransformedParam } from '../../rest/scripts/utils/get-body-params' import {
getBodyParams,
type TransformedParam,
type Schema,
} from '../../rest/scripts/utils/get-body-params'
describe('oneOf handling in webhook parameters', () => { describe('oneOf handling in webhook parameters', () => {
test('should handle oneOf fields correctly for secret_scanning_alert_location details', async () => { test('should handle oneOf fields correctly for secret_scanning_alert_location details', async () => {
@@ -122,7 +126,7 @@ describe('oneOf handling in webhook parameters', () => {
}, },
} }
const result: TransformedParam[] = await getBodyParams(mockSchema, true) const result: TransformedParam[] = await getBodyParams(mockSchema as unknown as Schema, true)
// Find the location parameter // Find the location parameter
const locationParam: TransformedParam | undefined = result.find( const locationParam: TransformedParam | undefined = result.find(
@@ -205,7 +209,10 @@ describe('oneOf handling in webhook parameters', () => {
}, },
} }
const result: TransformedParam[] = await getBodyParams(mockSchemaWithoutTitles, true) const result: TransformedParam[] = await getBodyParams(
mockSchemaWithoutTitles as unknown as Schema,
true,
)
const detailsParam: TransformedParam | undefined = result.find( const detailsParam: TransformedParam | undefined = result.find(
(param) => param.name === 'details', (param) => param.name === 'details',
@@ -260,7 +267,10 @@ describe('oneOf handling in webhook parameters', () => {
}, },
} }
const result: TransformedParam[] = await getBodyParams(mockNestedOneOfSchema, true) const result: TransformedParam[] = await getBodyParams(
mockNestedOneOfSchema as unknown as Schema,
true,
)
const wrapperParam: TransformedParam | undefined = result.find( const wrapperParam: TransformedParam | undefined = result.find(
(param) => param.name === 'wrapper', (param) => param.name === 'wrapper',

View File

@@ -17,28 +17,34 @@ import {
* @param data GraphQL response data containing PR information * @param data GraphQL response data containing PR information
* @returns Object with isCopilotAuthor boolean and copilotAssignee string * @returns Object with isCopilotAuthor boolean and copilotAssignee string
*/ */
function getCopilotAuthorInfo(data: Record<string, any>): { function getCopilotAuthorInfo(data: Record<string, unknown>): {
isCopilotAuthor: boolean isCopilotAuthor: boolean
copilotAssignee: string copilotAssignee: string
} { } {
const item = data.item as Record<string, unknown>
const author = item.author as Record<string, unknown> | undefined
const assigneesObj = item.assignees as Record<string, unknown> | undefined
// Check if this is a Copilot-authored PR // Check if this is a Copilot-authored PR
const isCopilotAuthor = const isCopilotAuthor = !!(
data.item.__typename === 'PullRequest' && item.__typename === 'PullRequest' &&
data.item.author && author &&
data.item.author.login === 'copilot-swe-agent' author.login === 'copilot-swe-agent'
)
// For Copilot PRs, find the appropriate assignee (excluding Copilot itself) // For Copilot PRs, find the appropriate assignee (excluding Copilot itself)
let copilotAssignee = '' let copilotAssignee = ''
if (isCopilotAuthor && data.item.assignees && data.item.assignees.nodes) { if (isCopilotAuthor && assigneesObj && assigneesObj.nodes) {
const assignees = data.item.assignees.nodes const nodes = assigneesObj.nodes as Array<Record<string, unknown>>
.map((assignee: Record<string, any>) => assignee.login) const assigneeLogins = nodes
.map((assignee: Record<string, unknown>) => assignee.login as string)
.filter((login: string) => login !== 'copilot-swe-agent') .filter((login: string) => login !== 'copilot-swe-agent')
// Use the first non-Copilot assignee // Use the first non-Copilot assignee
copilotAssignee = assignees.length > 0 ? assignees[0] : '' copilotAssignee = assigneeLogins.length > 0 ? assigneeLogins[0] : ''
} }
return { isCopilotAuthor, copilotAssignee } return { isCopilotAuthor, copilotAssignee: copilotAssignee || '' }
} }
/** /**
@@ -66,7 +72,7 @@ function getAuthorFieldValue(
async function run() { async function run() {
// Get info about the docs-content review board project // Get info about the docs-content review board project
const data: Record<string, any> = await graphql( const data: Record<string, unknown> = await graphql(
` `
query ($organization: String!, $projectNumber: Int!, $id: ID!) { query ($organization: String!, $projectNumber: Int!, $id: ID!) {
organization(login: $organization) { organization(login: $organization) {
@@ -123,7 +129,9 @@ async function run() {
) )
// Get the project ID // Get the project ID
const projectID = data.organization.projectV2.id const organization = data.organization as Record<string, unknown>
const projectV2 = organization.projectV2 as Record<string, unknown>
const projectID = projectV2.id as string
// Get the ID of the fields that we want to populate // Get the ID of the fields that we want to populate
const datePostedID = findFieldID('Date posted', data) const datePostedID = findFieldID('Date posted', data)
@@ -152,7 +160,7 @@ async function run() {
// If yes, set the author to 'first time contributor' instead of to the author login // If yes, set the author to 'first time contributor' instead of to the author login
let firstTimeContributor let firstTimeContributor
if (process.env.REPO === 'github/docs') { if (process.env.REPO === 'github/docs') {
const contributorData: Record<string, any> = await graphql( const contributorData: Record<string, unknown> = await graphql(
` `
query ($author: String!) { query ($author: String!) {
user(login: $author) { user(login: $author) {
@@ -184,17 +192,30 @@ async function run() {
}, },
}, },
) )
const docsPRData = const user = contributorData.user as Record<string, unknown>
contributorData.user.contributionsCollection.pullRequestContributionsByRepository.filter( const contributionsCollection = user.contributionsCollection as Record<string, unknown>
(item: Record<string, any>) => item.repository.nameWithOwner === 'github/docs', const pullRequestContributions =
)[0] contributionsCollection.pullRequestContributionsByRepository as Array<Record<string, unknown>>
const prCount = docsPRData ? docsPRData.contributions.totalCount : 0 const docsPRData = pullRequestContributions.filter((item: Record<string, unknown>) => {
const repository = item.repository as Record<string, unknown>
return repository.nameWithOwner === 'github/docs'
})[0]
const prContributions = docsPRData
? (docsPRData.contributions as Record<string, unknown>)
: undefined
const prCount = prContributions ? (prContributions.totalCount as number) : 0
const docsIssueData = const issueContributions = contributionsCollection.issueContributionsByRepository as Array<
contributorData.user.contributionsCollection.issueContributionsByRepository.filter( Record<string, unknown>
(item: Record<string, any>) => item.repository.nameWithOwner === 'github/docs', >
)[0] const docsIssueData = issueContributions.filter((item: Record<string, unknown>) => {
const issueCount = docsIssueData ? docsIssueData.contributions.totalCount : 0 const repository = item.repository as Record<string, unknown>
return repository.nameWithOwner === 'github/docs'
})[0]
const issueContributionsObj = docsIssueData
? (docsIssueData.contributions as Record<string, unknown>)
: undefined
const issueCount = issueContributionsObj ? (issueContributionsObj.totalCount as number) : 0
if (prCount + issueCount <= 1) { if (prCount + issueCount <= 1) {
firstTimeContributor = true firstTimeContributor = true