-
Notifications
You must be signed in to change notification settings - Fork 60.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Check that content-liter-rules.md stays up-to-date (#49389)
- Loading branch information
Showing
6 changed files
with
98 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
name: 'Check content-linter rules docs' | ||
|
||
# **What it does**: Makes sure the content-linter-rules.md is up-to-date. | ||
# **Why we have it**: So what's automated doesn't fall behind | ||
# **Who does it impact**: Docs content. | ||
|
||
on: | ||
workflow_dispatch: | ||
pull_request: | ||
paths: | ||
- 'src/content-linter/**' | ||
# In case imported markdownlint rules are updated | ||
- package-lock.json | ||
# In case manual changes are made to the content-linter-rules.md file | ||
- data/reusables/contributing/content-linter-rules.md | ||
# Self-test | ||
- .github/workflows/content-linter-rules-docs.yml | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
check-content-linter-rules-docs: | ||
runs-on: ${{ fromJSON('["ubuntu-latest", "ubuntu-20.04-xl"]')[github.repository == 'github/docs-internal'] }} | ||
if: github.repository == 'github/docs-internal' || github.repository == 'github/docs' | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | ||
|
||
- uses: ./.github/actions/node-npm-setup | ||
|
||
- name: Check that content-linter-rules.md is up-to-date | ||
run: npm run generate-content-linter-docs | ||
|
||
- name: Fail if it isn't up-to-date | ||
run: | | ||
if [ -n "$(git status --porcelain)" ]; then | ||
git status | ||
git diff | ||
# Some whitespace for the sake of the message below | ||
echo "" | ||
echo "" | ||
echo "content-linter-rules.md is out of date." | ||
echo "Please run 'npm run generate-content-linter-docs' and commit the changes." | ||
exit 1; | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
// get-rules.d.ts | ||
// This is a declaration file for get-rules.js | ||
|
||
import type { Rule, RuleConfig } from '../../types.ts' | ||
|
||
export const customRules: Rule[] | ||
export const allRules: Rule[] | ||
export const allConfig: RuleConfig |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
export type Rule = { | ||
names: string[] | ||
description: string | ||
tags: string[] | ||
information?: URL | ||
function: Function[] | ||
} | ||
|
||
type RuleDetail = Rule & { | ||
name: string | ||
'partial-markdown-files': boolean | ||
message: string | ||
severity: string | ||
searchPattern: string | ||
searchScope: string | ||
precommitSeverity?: string | ||
} | ||
|
||
export type Config = { | ||
severity: string | ||
'partial-markdown-files': boolean | ||
allowed_languages?: string[] | ||
style?: string | ||
rules?: RuleDetail[] | ||
} | ||
|
||
export type RuleConfig = { | ||
[name: string]: Config | ||
} |