Skip to content

Commit 070921c

Browse files
authored
Merge pull request #33363 from github/repo-sync
Repo sync
2 parents 30bfe7b + 58ed15d commit 070921c

File tree

7 files changed

+44
-1
lines changed

7 files changed

+44
-1
lines changed

data/reusables/actions/azure-vnet-supported-regions.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,15 @@ Azure private networking supports GPU runners in the following regions.
2727
- `NorthCentralUs`
2828
- `SouthCentralUs`
2929

30+
Azure private networking supports arm64 runners in the following regions.
31+
32+
- `EastUs`
33+
- `EastUs2`
34+
- `WestUs2`
35+
- `NorthCentralUs`
36+
- `SouthCentralUs`
37+
38+
> [!NOTE]
39+
> GPU and arm64 runners are currently in beta and subject to change.
40+
3041
If your desired region is not supported, please submit a request for new region availability in [this GitHub form](https://resources.github.com/private-networking-for-github-hosted-runners-with-azure-virtual-networks/). You may also use global virtual network peering to connect virtual networks across Azure regions. For more information, see [Virtual network peering](https://learn.microsoft.com/en-us/azure/virtual-network/virtual-network-peering-overview) in the Azure documentation.

src/content-linter/README.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,3 +219,18 @@ The downside to using the `search-replace` plugin is that you cannot disable eac
219219
```markdown
220220
docs.github.com <!-- markdownlint-disable-line search-replace -->
221221
```
222+
223+
## Adding context to a base rule's error message
224+
225+
If you want to add context to a base rule's error message, go to[`base.js`](/src/content-linter/style/base.js), and add the `context` property to the base rule's object. For e.g. if you wanted to add `context` to `MD040` (the `fenced-code-language` base rule), the object would look like this:
226+
227+
```javascript
228+
'fenced-code-language': {
229+
// MD040
230+
severity: 'error',
231+
'partial-markdown-files': true,
232+
'yml-files': true,
233+
allowed_languages: allowedCodeFenceLanguages,
234+
context: `When you add a fenced code block, you must specify the code language. Allowed languages are: ${allowedCodeFenceLanguages.join(', ')}. You can add allowed languages by updating data/code-languages.yml.`,
235+
},
236+
```

src/content-linter/lib/helpers/print-annotations.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,13 @@ export function printAnnotationResults(
3535
annotation += `${bits.join(',')}`
3636

3737
if (flaw.errorDetail) {
38-
annotation += `::${flaw.errorDetail}`
38+
annotation += flaw.errorDetail.endsWith('.')
39+
? `::${flaw.errorDetail}`
40+
: `::${flaw.errorDetail}.`
41+
}
42+
43+
if (flaw.context) {
44+
annotation += ` ${flaw.context}`
3945
}
4046

4147
// Why console.log and not `core.error()` (from @actions/core)?

src/content-linter/scripts/lint-content.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -474,6 +474,8 @@ function formatResult(object, isPrecommit) {
474474
formattedResult.severity =
475475
allConfig[ruleName].severity || getSearchReplaceRuleSeverity(ruleName, object, isPrecommit)
476476

477+
formattedResult.context = allConfig[ruleName].context || ''
478+
477479
return Object.entries(object).reduce((acc, [key, value]) => {
478480
if (key === 'fixInfo') {
479481
acc.fixable = !!value

src/content-linter/scripts/pretty-print-results.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,13 @@ export function prettyPrintResults(results, { fixed = false } = {}) {
8181
`${indentWrappedString(result.errorDetail?.replace(/\n/g, ' ').trim(), PREFIX_PADDING.length * 8)}`,
8282
)
8383
}
84+
85+
if (result.context) {
86+
console.log(
87+
label('Context'),
88+
`${indentWrappedString(result.context.replace(/\n/g, ' ').trim(), PREFIX_PADDING.length * 8)}`,
89+
)
90+
}
8491
}
8592
let position = chalk.yellow(result.lineNumber)
8693
if (isNumber(result.columnNumber) && result.columnNumber !== 1) {

src/content-linter/style/base.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ export const baseConfig = {
120120
'partial-markdown-files': true,
121121
'yml-files': true,
122122
allowed_languages: allowedCodeFenceLanguages,
123+
context: `When you add a fenced code block, you must specify the code language. Allowed languages are: ${allowedCodeFenceLanguages.join(', ')}. You can add allowed languages by updating data/code-languages.yml.`,
123124
},
124125
'no-empty-links': {
125126
// MD042

src/content-linter/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ export type Config = {
2222
allowed_languages?: string[]
2323
style?: string
2424
rules?: RuleDetail[]
25+
context?: string
2526
}
2627

2728
export type RuleConfig = {

0 commit comments

Comments
 (0)