Skip to content

Commit 4e6c775

Browse files
authored
Merge pull request #38941 from github/repo-sync
Repo sync
2 parents 1b36ff3 + 706f7a2 commit 4e6c775

File tree

19 files changed

+1200
-578
lines changed

19 files changed

+1200
-578
lines changed

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
# ---------------------------------------------------------------
99
# To update the sha:
1010
# https://github.com/github/gh-base-image/pkgs/container/gh-base-image%2Fgh-base-noble
11-
FROM ghcr.io/github/gh-base-image/gh-base-noble:20250616-220726-g8823b63b3 AS base
11+
FROM ghcr.io/github/gh-base-image/gh-base-noble:20250617-184854-gd653802be AS base
1212

1313
# Install curl for Node install and determining the early access branch
1414
# Install git for cloning docs-early-access & translations repos

src/audit-logs/data/fpt/organization.json

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1139,11 +1139,6 @@
11391139
"description": "Autofix for third party tools for code scanning alerts was enabled for an organization.",
11401140
"docs_reference_links": "N/A"
11411141
},
1142-
{
1143-
"action": "org_code_security_metered_usage.lock",
1144-
"description": "Enablement for Code Security features on new repositories has been locked for this organization.",
1145-
"docs_reference_links": "N/A"
1146-
},
11471142
{
11481143
"action": "org.codeql_disabled",
11491144
"description": "Code scanning using the default setup was disabled for an organization.",
@@ -1564,11 +1559,6 @@
15641559
"description": "The visibility of a self-hosted runner group was updated via the REST API.",
15651560
"docs_reference_links": "/rest/actions#update-a-self-hosted-runner-group-for-an-organization"
15661561
},
1567-
{
1568-
"action": "org_secret_protection_metered_usage.lock",
1569-
"description": "Enablement for Secret Protection features on new repositories has been locked for this organization.",
1570-
"docs_reference_links": "N/A"
1571-
},
15721562
{
15731563
"action": "org_secret_scanning_automatic_validity_checks.disabled",
15741564
"description": "Automatic partner validation checks have been disabled at the organization level",

src/audit-logs/data/ghec/enterprise.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,11 @@
154154
"description": "GitHub Advanced Security was enabled for new user namespace repositories in your enterprise.",
155155
"docs_reference_links": "/admin/code-security/managing-github-advanced-security-for-your-enterprise/managing-github-advanced-security-features-for-your-enterprise"
156156
},
157+
{
158+
"action": "business.advanced_security_metered_usage_unlock",
159+
"description": "Enablement for Advanced Security features on new repositories has been unlocked for this enterprise.",
160+
"docs_reference_links": "N/A"
161+
},
157162
{
158163
"action": "business.advanced_security_policy_update",
159164
"description": "An enterprise owner created, updated, or removed a policy for GitHub Advanced Security.",
@@ -240,7 +245,7 @@
240245
"docs_reference_links": "/code-security/getting-started/github-security-features#available-with-github-code-security"
241246
},
242247
{
243-
"action": "business_code_security_metered_usage.lock",
248+
"action": "business.code_security_metered_usage_lock",
244249
"description": "Enablement for Code Security features on new repositories has been locked for this enterprise.",
245250
"docs_reference_links": "N/A"
246251
},
@@ -489,11 +494,6 @@
489494
"description": "The SAML single sign-on session for a member in an enterprise was revoked.",
490495
"docs_reference_links": "N/A"
491496
},
492-
{
493-
"action": "business_secret_protection_metered_usage.lock",
494-
"description": "Enablement for Secret Protection features on new repositories has been locked for this enterprise.",
495-
"docs_reference_links": "N/A"
496-
},
497497
{
498498
"action": "business_secret_scanning_automatic_validity_checks.disabled",
499499
"description": "Automatic partner validation checks have been disabled at the business level",

src/audit-logs/data/ghec/organization.json

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1139,11 +1139,6 @@
11391139
"description": "Autofix for third party tools for code scanning alerts was enabled for an organization.",
11401140
"docs_reference_links": "N/A"
11411141
},
1142-
{
1143-
"action": "org_code_security_metered_usage.lock",
1144-
"description": "Enablement for Code Security features on new repositories has been locked for this organization.",
1145-
"docs_reference_links": "N/A"
1146-
},
11471142
{
11481143
"action": "org.codeql_disabled",
11491144
"description": "Code scanning using the default setup was disabled for an organization.",
@@ -1564,11 +1559,6 @@
15641559
"description": "The visibility of a self-hosted runner group was updated via the REST API.",
15651560
"docs_reference_links": "/rest/actions#update-a-self-hosted-runner-group-for-an-organization"
15661561
},
1567-
{
1568-
"action": "org_secret_protection_metered_usage.lock",
1569-
"description": "Enablement for Secret Protection features on new repositories has been locked for this organization.",
1570-
"docs_reference_links": "N/A"
1571-
},
15721562
{
15731563
"action": "org_secret_scanning_automatic_validity_checks.disabled",
15741564
"description": "Automatic partner validation checks have been disabled at the organization level",

src/audit-logs/lib/config.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@
33
"apiOnlyEvents": "This event is not available in the web interface, only via the REST API, audit log streaming, or JSON/CSV exports.",
44
"apiRequestEvent": "This event is only available via audit log streaming."
55
},
6-
"sha": "bce8d9394f9f4e9dcd9d1661a53735ddebc8bd8c"
6+
"sha": "eba0af9fafae7ac460e7063e153b06b7bc5ab300"
77
}
Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
import { addError } from 'markdownlint-rule-helpers'
2+
import { getRange } from '../helpers/utils.js'
3+
import frontmatter from '#src/frame/lib/read-frontmatter.js'
4+
5+
export const britishEnglishQuotes = {
6+
names: ['GHD048', 'british-english-quotes'],
7+
description:
8+
'Periods and commas should be placed inside quotation marks (American English style)',
9+
tags: ['punctuation', 'quotes', 'style', 'consistency'],
10+
severity: 'warning', // Non-blocking as requested in the issue
11+
function: (params, onError) => {
12+
// Skip autogenerated files
13+
const frontmatterString = params.frontMatterLines.join('\n')
14+
const fm = frontmatter(frontmatterString).data
15+
if (fm && fm.autogenerated) return
16+
17+
// Check each line for British English quote patterns
18+
for (let i = 0; i < params.lines.length; i++) {
19+
const line = params.lines[i]
20+
const lineNumber = i + 1
21+
22+
// Skip code blocks, code spans, and URLs
23+
if (isInCodeContext(line, params.lines, i)) {
24+
continue
25+
}
26+
27+
// Find British English quote patterns and report them
28+
findAndReportBritishQuotes(line, lineNumber, onError)
29+
}
30+
},
31+
}
32+
33+
/**
34+
* Check if the current position is within a code context (code blocks, inline code, URLs)
35+
*/
36+
function isInCodeContext(line, allLines, lineIndex) {
37+
// Skip if line contains code fences
38+
if (line.includes('```') || line.includes('~~~')) {
39+
return true
40+
}
41+
42+
// Check if we're inside a code block
43+
let inCodeBlock = false
44+
for (let i = 0; i < lineIndex; i++) {
45+
if (allLines[i].includes('```') || allLines[i].includes('~~~')) {
46+
inCodeBlock = !inCodeBlock
47+
}
48+
}
49+
if (inCodeBlock) {
50+
return true
51+
}
52+
53+
// Skip if line appears to be mostly code (has multiple backticks)
54+
const backtickCount = (line.match(/`/g) || []).length
55+
if (backtickCount >= 4) {
56+
return true
57+
}
58+
59+
// Skip URLs and email addresses
60+
if (line.includes('http://') || line.includes('https://') || line.includes('mailto:')) {
61+
return true
62+
}
63+
64+
return false
65+
}
66+
67+
/**
68+
* Find and report British English quote patterns in a line
69+
*/
70+
function findAndReportBritishQuotes(line, lineNumber, onError) {
71+
// Pattern to find quote followed by punctuation outside
72+
// Matches: "text". or 'text', or "text", etc.
73+
const britishPattern = /(["'])([^"']*?)\1\s*([.,])/g
74+
75+
let match
76+
while ((match = britishPattern.exec(line)) !== null) {
77+
const quoteChar = match[1]
78+
const quotedText = match[2]
79+
const punctuation = match[3]
80+
const fullMatch = match[0]
81+
const startIndex = match.index
82+
83+
// Create the corrected version (punctuation inside quotes)
84+
const correctedText = quoteChar + quotedText + punctuation + quoteChar
85+
86+
const range = getRange(line, fullMatch)
87+
const punctuationName = punctuation === '.' ? 'period' : 'comma'
88+
const errorMessage = `Use American English punctuation: place ${punctuationName} inside the quotation marks`
89+
90+
// Provide auto-fix
91+
const fixInfo = {
92+
editColumn: startIndex + 1,
93+
deleteCount: fullMatch.length,
94+
insertText: correctedText,
95+
}
96+
97+
addError(onError, lineNumber, errorMessage, line, range, fixInfo)
98+
}
99+
}

src/content-linter/lib/linting-rules/index.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ import { liquidTagWhitespace } from './liquid-tag-whitespace.js'
3535
import { linkQuotation } from './link-quotation.js'
3636
import { octiconAriaLabels } from './octicon-aria-labels.js'
3737
import { liquidIfversionVersions } from './liquid-ifversion-versions.js'
38+
import { britishEnglishQuotes } from './british-english-quotes.js'
39+
import { multipleEmphasisPatterns } from './multiple-emphasis-patterns.js'
3840
import { noteWarningFormatting } from './note-warning-formatting.js'
3941

4042
const noDefaultAltText = markdownlintGitHub.find((elem) =>
@@ -85,6 +87,8 @@ export const gitHubDocsMarkdownlint = {
8587
liquidTagWhitespace,
8688
linkQuotation,
8789
octiconAriaLabels,
90+
britishEnglishQuotes,
91+
multipleEmphasisPatterns,
8892
noteWarningFormatting,
8993
],
9094
}
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
import { addError } from 'markdownlint-rule-helpers'
2+
import { getRange } from '../helpers/utils.js'
3+
import frontmatter from '#src/frame/lib/read-frontmatter.js'
4+
5+
export const multipleEmphasisPatterns = {
6+
names: ['GHD050', 'multiple-emphasis-patterns'],
7+
description: 'Do not use more than one emphasis/strong, italics, or uppercase for a string',
8+
tags: ['formatting', 'emphasis', 'style'],
9+
severity: 'warning',
10+
function: (params, onError) => {
11+
// Skip autogenerated files
12+
const frontmatterString = params.frontMatterLines.join('\n')
13+
const fm = frontmatter(frontmatterString).data
14+
if (fm && fm.autogenerated) return
15+
16+
const lines = params.lines
17+
let inCodeBlock = false
18+
19+
for (let i = 0; i < lines.length; i++) {
20+
const line = lines[i]
21+
const lineNumber = i + 1
22+
23+
// Track code block state
24+
if (line.trim().startsWith('```')) {
25+
inCodeBlock = !inCodeBlock
26+
continue
27+
}
28+
29+
// Skip code blocks and indented code
30+
if (inCodeBlock || line.trim().startsWith(' ')) continue
31+
32+
// Check for multiple emphasis patterns
33+
checkMultipleEmphasis(line, lineNumber, onError)
34+
}
35+
},
36+
}
37+
38+
/**
39+
* Check for multiple emphasis types in a single text segment
40+
*/
41+
function checkMultipleEmphasis(line, lineNumber, onError) {
42+
// Focus on the clearest violations of the style guide
43+
const multipleEmphasisPatterns = [
44+
// Bold + italic combinations (***text***)
45+
{ regex: /\*\*\*([^*]+)\*\*\*/g, types: ['bold', 'italic'] },
46+
{ regex: /___([^_]+)___/g, types: ['bold', 'italic'] },
47+
48+
// Bold with code nested inside
49+
{ regex: /\*\*([^*]*`[^`]+`[^*]*)\*\*/g, types: ['bold', 'code'] },
50+
{ regex: /__([^_]*`[^`]+`[^_]*)__/g, types: ['bold', 'code'] },
51+
52+
// Code with bold nested inside
53+
{ regex: /`([^`]*\*\*[^*]+\*\*[^`]*)`/g, types: ['code', 'bold'] },
54+
{ regex: /`([^`]*__[^_]+__[^`]*)`/g, types: ['code', 'bold'] },
55+
]
56+
57+
for (const pattern of multipleEmphasisPatterns) {
58+
let match
59+
while ((match = pattern.regex.exec(line)) !== null) {
60+
// Skip if this is likely intentional or very short
61+
if (shouldSkipMatch(match[0], match[1])) continue
62+
63+
const range = getRange(line, match[0])
64+
addError(
65+
onError,
66+
lineNumber,
67+
`Do not use multiple emphasis types in a single string: ${pattern.types.join(' + ')}`,
68+
line,
69+
range,
70+
null, // No auto-fix as this requires editorial judgment
71+
)
72+
}
73+
}
74+
}
75+
76+
/**
77+
* Determine if a match should be skipped (likely intentional formatting)
78+
*/
79+
function shouldSkipMatch(fullMatch, content) {
80+
// Skip common false positives
81+
if (!content) return true
82+
83+
// Skip very short content (likely intentional single chars)
84+
if (content.trim().length < 2) return true
85+
86+
// Skip if it's mostly code-like content (constants, variables)
87+
if (/^[A-Z_][A-Z0-9_]*$/.test(content.trim())) return true
88+
89+
// Skip file extensions or URLs
90+
if (/\.[a-z]{2,4}$/i.test(content.trim()) || /https?:\/\//.test(content)) return true
91+
92+
return false
93+
}

0 commit comments

Comments
 (0)