Skip to content

Commit 52482bf

Browse files
Pin and bump GitHub Actions
(and trim trailing whitespace, thanks editor)
1 parent f897b45 commit 52482bf

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

.github/workflows/check-frontmatter.yml

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,58 +11,58 @@ on:
1111
jobs:
1212
check-frontmatter:
1313
runs-on: ubuntu-latest
14-
14+
1515
steps:
1616
- name: Checkout code
17-
uses: actions/checkout@v3
18-
17+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
18+
1919
- name: Setup Node.js
20-
uses: actions/setup-node@v3
20+
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
2121
with:
2222
node-version: '16'
23-
23+
2424
- name: Install dependencies
2525
run: |
2626
npm init -y
2727
npm install gray-matter
28-
28+
2929
- name: Check frontmatter
3030
run: |
3131
npm install gray-matter
3232
node -e '
3333
const fs = require("fs");
3434
const matter = require("gray-matter");
3535
const path = require("path");
36-
36+
3737
function getAllMarkdownFiles(dir) {
3838
let results = [];
3939
const files = fs.readdirSync(dir);
40-
40+
4141
for (const file of files) {
4242
if (file === "node_modules") {
4343
continue;
4444
}
4545
const filePath = path.join(dir, file);
4646
const stat = fs.statSync(filePath);
47-
47+
4848
if (stat.isDirectory() && !file.startsWith(".")) {
4949
results = results.concat(getAllMarkdownFiles(filePath));
5050
} else if (file.endsWith(".md")) {
5151
results.push(filePath);
5252
}
5353
}
54-
54+
5555
return results;
5656
}
57-
57+
5858
let hasError = false;
5959
const mdFiles = getAllMarkdownFiles(".");
60-
60+
6161
for (const file of mdFiles) {
6262
try {
6363
const content = fs.readFileSync(file, "utf8");
6464
const { data } = matter(content);
65-
65+
6666
if (!data.title) {
6767
console.error(`Error: ${file} is missing title in frontmatter`);
6868
hasError = true;
@@ -72,7 +72,7 @@ jobs:
7272
hasError = true;
7373
}
7474
}
75-
75+
7676
if (hasError) {
7777
process.exit(1);
7878
}

0 commit comments

Comments
 (0)