Skip to content

Commit 41b0ef0

Browse files
graceparkpeterbe
andauthored
Add content linter to CI (#42192)
Co-authored-by: Peter Bengtsson <peterbe@github.com>
1 parent ab43d3c commit 41b0ef0

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: 'Content Lint Markdown'
2+
3+
# **What it does**: Lints our content markdown to ensure the content matches the specified styleguide.
4+
# **Why we have it**: We want some level of consistency to our content markdown files.
5+
# **Who does it impact**: Docs content writers.
6+
7+
on:
8+
pull_request:
9+
10+
permissions:
11+
contents: read
12+
13+
jobs:
14+
lint-content:
15+
if: github.repository == 'github/docs-internal' || github.repository == 'github/docs'
16+
runs-on: ${{ fromJSON('["ubuntu-latest", "ubuntu-20.04-xl"]')[github.repository == 'github/docs-internal'] }}
17+
steps:
18+
- name: Check out repo
19+
uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0
20+
with:
21+
# Needed to detect changed files
22+
fetch-depth: 2
23+
24+
- name: Set up Node and dependencies
25+
uses: ./.github/actions/node-npm-setup
26+
27+
- name: Get changed content/data files
28+
id: changed-files
29+
uses: tj-actions/changed-files@246636f5fa148b5ad8e65ca4c57b18af3123e5f6 # v39.0.1
30+
with:
31+
fetch_depth: 2
32+
files: |
33+
content/**
34+
data/**
35+
36+
- name: Run content linter if changed content/data files
37+
if: steps.changed-files.outputs.any_changed == 'true'
38+
run: node src/content-linter/scripts/markdownlint.js --errors-only --paths ${{ steps.changed-files.outputs.all_changed_files }}

0 commit comments

Comments
 (0)