Skip to content

Commit 3e3090b

Browse files
committed
Update contributions requirements workflow
1 parent 989afa2 commit 3e3090b

File tree

2 files changed

+32
-9
lines changed

2 files changed

+32
-9
lines changed

.github/workflows/workflow.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828
- name: Setup metrics
2929
run: npm ci
3030
- name: Check contributions requirements
31-
run: npm test -- ci.test.js
31+
run: npm test -- ci.test.js --noStackTrace
3232
- name: Run linter
3333
run: npm run linter
3434

tests/ci.test.js

Lines changed: 31 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,35 @@
22
const path = require("path")
33
const git = require("simple-git")(path.join(__dirname, ".."))
44

5-
//Check generated files editions
5+
//Edited files list
66
const diff = async () => (await git.diff("origin/master...", ["--name-status"])).split("\n").map(x => x.trim()).filter(x => /^M\s+/.test(x)).map(x => x.replace(/^M\s+/, ""))
7-
describe('Auto-generated files were not modified (use "git checkout @ -- file" if needed)', () => void test.each([
8-
"README.md",
9-
"source/plugins/README.md",
10-
"source/templates/README.md",
11-
"action.yml",
12-
"settings.example.json"
13-
])("%s", async file => expect((await diff()).includes(file)).toBe(false)))
7+
8+
//Files editions
9+
describe("Check files editions (checkout your files if needed)", () => {
10+
describe("Auto-generated files were not modified", () => void test.each([
11+
"README.md",
12+
"source/plugins/README.md",
13+
"source/templates/README.md",
14+
"action.yml",
15+
"settings.example.json"
16+
])("%s", async file => expect((await diff()).includes(file)).toBe(false)))
17+
describe("Repository level files were not modified", () => void test.each([
18+
".github/config/*",
19+
".github/ISSUE_TEMPLATE/*",
20+
".github/PULL_REQUEST_TEMPLATE/*",
21+
".github/readme/README.md",
22+
".github/readme/partials/*",
23+
".github/workflows/*",
24+
".github/FUNDING.yml",
25+
".github/index.mjs",
26+
".github/release.mjs",
27+
"LICENSE",
28+
"SECURITY.md",
29+
"tests/ci.test.js"
30+
])("%s", async file => expect((await diff()).filter(edited => new RegExp(`^${file.replace(/[.]/g, "[.]").replace(/[*]/g, "[\\s\\S]*")}$`).test(edited)).length).toBe(0)))
31+
})
32+
33+
//Templates editions
34+
describe("Check templates editions", () => {
35+
test("Use community templates instead (see https://github.com/lowlighter/metrics/tree/master/source/templates/community)", async () => void expect((await diff()).filter(edited => /^source[/]templates[/](?:classic|terminal|repository|community)[/][\s\S]*$/.test(edited)).length).toBe(0))
36+
})

0 commit comments

Comments
 (0)