Skip to content

Commit

Permalink
ci: mdl
Browse files Browse the repository at this point in the history
  • Loading branch information
robot committed Mar 20, 2022
1 parent 778bc6c commit d3a3e30
Show file tree
Hide file tree
Showing 5 changed files with 160 additions and 46 deletions.
30 changes: 30 additions & 0 deletions .github/workflows/check-format.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// const util = require("util");
// const glob = util.promisify(require('glob'));
// const fs = require("fs").promises;
// const path = require('path');


// async function main() {
// var errors = [];
// var directories = await glob(__dirname + '../../**/*.md');

// for (var filePath of directories) {
// var data = await fs.readFile(filePath, 'utf8');
// var filename = path.parse(filePath).base.replace(".md", "");

// // do check
// }

// if (errors.length > 0) {
// for (var error of errors) {
// console.error(error + "\n");
// }

// var message = `Found ${errors.length} errors! Please fix!`;
// throw new Error(message);
// }
// }

// main();

console.log('TO BE IMPLEMENTED')
31 changes: 31 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Continuous Integration

on:
pull_request:
branches: [master]

jobs:
markdown-lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: "16"
cache: "npm"
- name: Install packages
run: sudo gem install mdl
- name: Get file changes
id: get_file_changes
uses: trilom/[email protected]
with:
output: " "
- name: Echo file changes
run: |
echo Changed files: ${{ steps.get_file_changes.outputs.files }}
- name: Lint markdown files
run: mdl ${{ steps.get_file_changes.outputs.files}}
- run: npm install
- run: node .github/check-format.js
# Suppress 036 Emphasis used instead of a header
# Suppress 024 Multiple headers with the same content
7 changes: 7 additions & 0 deletions .mdl_style.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
all
# 我想让图片居中,单纯的 md 似乎做不到,所以使用 raw html 来实现
exclude_rule 'MD033'
# 仅仅是强调,不需要用 header
exclude_rule 'MD036'
# 这个 rule 有 bug?
exclude_rule 'MD029'
1 change: 1 addition & 0 deletions .mdlrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
style '.mdl_style.rb'
Loading

0 comments on commit d3a3e30

Please sign in to comment.