Skip to content

Repo sync #33363

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jun 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions data/reusables/actions/azure-vnet-supported-regions.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,15 @@ Azure private networking supports GPU runners in the following regions.
- `NorthCentralUs`
- `SouthCentralUs`

Azure private networking supports arm64 runners in the following regions.

- `EastUs`
- `EastUs2`
- `WestUs2`
- `NorthCentralUs`
- `SouthCentralUs`

> [!NOTE]
> GPU and arm64 runners are currently in beta and subject to change.

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.
15 changes: 15 additions & 0 deletions src/content-linter/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -219,3 +219,18 @@ The downside to using the `search-replace` plugin is that you cannot disable eac
```markdown
docs.github.com <!-- markdownlint-disable-line search-replace -->
```

## Adding context to a base rule's error message

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:

```javascript
'fenced-code-language': {
// MD040
severity: 'error',
'partial-markdown-files': true,
'yml-files': true,
allowed_languages: allowedCodeFenceLanguages,
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.`,
},
```
8 changes: 7 additions & 1 deletion src/content-linter/lib/helpers/print-annotations.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,13 @@ export function printAnnotationResults(
annotation += `${bits.join(',')}`

if (flaw.errorDetail) {
annotation += `::${flaw.errorDetail}`
annotation += flaw.errorDetail.endsWith('.')
? `::${flaw.errorDetail}`
: `::${flaw.errorDetail}.`
}

if (flaw.context) {
annotation += ` ${flaw.context}`
}

// Why console.log and not `core.error()` (from @actions/core)?
Expand Down
2 changes: 2 additions & 0 deletions src/content-linter/scripts/lint-content.js
Original file line number Diff line number Diff line change
Expand Up @@ -474,6 +474,8 @@ function formatResult(object, isPrecommit) {
formattedResult.severity =
allConfig[ruleName].severity || getSearchReplaceRuleSeverity(ruleName, object, isPrecommit)

formattedResult.context = allConfig[ruleName].context || ''

return Object.entries(object).reduce((acc, [key, value]) => {
if (key === 'fixInfo') {
acc.fixable = !!value
Expand Down
7 changes: 7 additions & 0 deletions src/content-linter/scripts/pretty-print-results.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,13 @@ export function prettyPrintResults(results, { fixed = false } = {}) {
`${indentWrappedString(result.errorDetail?.replace(/\n/g, ' ').trim(), PREFIX_PADDING.length * 8)}`,
)
}

if (result.context) {
console.log(
label('Context'),
`${indentWrappedString(result.context.replace(/\n/g, ' ').trim(), PREFIX_PADDING.length * 8)}`,
)
}
}
let position = chalk.yellow(result.lineNumber)
if (isNumber(result.columnNumber) && result.columnNumber !== 1) {
Expand Down
1 change: 1 addition & 0 deletions src/content-linter/style/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ export const baseConfig = {
'partial-markdown-files': true,
'yml-files': true,
allowed_languages: allowedCodeFenceLanguages,
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.`,
},
'no-empty-links': {
// MD042
Expand Down
1 change: 1 addition & 0 deletions src/content-linter/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export type Config = {
allowed_languages?: string[]
style?: string
rules?: RuleDetail[]
context?: string
}

export type RuleConfig = {
Expand Down
Loading