Skip to content

Commit ade2589

Browse files
committed
Lint markdown files
1 parent cdd07b4 commit ade2589

File tree

3 files changed

+54
-2
lines changed

3 files changed

+54
-2
lines changed

.github/workflows/ci.yml

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@ on:
88
branches: ["main"]
99
pull_request:
1010
branches: ["main"]
11+
workflow_dispatch:
12+
inputs:
13+
target_branch:
14+
description: 'Branch to run on'
15+
required: true
16+
default: 'main'
1117

1218
env:
1319
PRODUCT_NAME: TeamTools.Linter.CommandLine
@@ -185,6 +191,27 @@ jobs:
185191
path: "**/TestResults/*.trx,*.trx"
186192
reporter: dotnet-trx
187193

194+
validate-markdown:
195+
runs-on: ubuntu-latest
196+
steps:
197+
- uses: actions/checkout@v4
198+
199+
- uses: actions/setup-node@v6
200+
with:
201+
node-version: lts/*
202+
203+
- name: Install markdownlint
204+
run: >
205+
npm install markdownlint-cli2 --global
206+
207+
- name: Run linting
208+
run: >
209+
markdownlint-cli2
210+
"**/*.md"
211+
"!node_modules"
212+
"!packages"
213+
--config ${{ github.workspace }}/.markdownlint.jsonc
214+
188215
report:
189216
name: Update badges
190217
needs: [build]
@@ -230,7 +257,7 @@ jobs:
230257

231258
repack-with-plugins:
232259
name: Repackage with plugins
233-
needs: [semver, build]
260+
needs: [semver, build, validate-markdown]
234261
if: ${{ always() && needs.build.outputs.build-result == 'success' }}
235262
runs-on: ubuntu-latest
236263

.markdownlint.jsonc

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"default": true, // Default state for all rules
3+
"MD012": false, // extra line [2 empty lines]
4+
"MD013": false, // line length
5+
"MD033": {
6+
"allowed_elements": [ "p" ]
7+
},
8+
"MD055": false, // tables
9+
"MD060": false, // table column style
10+
"MD004": {
11+
"style": "dash" // List style
12+
}
13+
}

Directory.Build.props

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,18 @@
7878
<IncludeSourceRevisionInInformationalVersion>true</IncludeSourceRevisionInInformationalVersion>
7979
</PropertyGroup>
8080

81+
<!-- Target OS related flags -->
82+
<PropertyGroup>
83+
<IsWindows Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Windows)))' == 'true'">true</IsWindows>
84+
<IsLinux Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Linux)))' == 'true'">true</IsLinux>
85+
</PropertyGroup>
86+
<PropertyGroup Condition="'$(IsWindows)'=='true'">
87+
<DefineConstants>Windows</DefineConstants>
88+
</PropertyGroup>
89+
<PropertyGroup Condition="'$(IsLinux)'=='true'">
90+
<DefineConstants>Linux</DefineConstants>
91+
</PropertyGroup>
92+
8193
<!-- No packing for test projects -->
8294
<PropertyGroup Condition="'$(IsTestProject)'=='true'">
8395
<IsPackable>false</IsPackable>
@@ -101,6 +113,6 @@
101113
</PackageReference>
102114
<None Include="$(MSBuildProjectDirectory)\packages.lock.json" Visible="false" />
103115
<!-- Newer version helps better resolving common dll dependencies -->
104-
<PackageReference Include="Microsoft.NETCore.Platforms" Version="7.0.4" Condition="'$(IsTestProject)' != 'true'" />
116+
<PackageReference Include="Microsoft.NETCore.Platforms" Version="7.0.4" Condition="'$(IsTestProject)' != 'true'" />
105117
</ItemGroup>
106118
</Project>

0 commit comments

Comments
 (0)