Update contributions requirements workflow
This commit is contained in:
2
.github/workflows/workflow.yml
vendored
2
.github/workflows/workflow.yml
vendored
@@ -28,7 +28,7 @@ jobs:
|
|||||||
- name: Setup metrics
|
- name: Setup metrics
|
||||||
run: npm ci
|
run: npm ci
|
||||||
- name: Check contributions requirements
|
- name: Check contributions requirements
|
||||||
run: npm test -- ci.test.js
|
run: npm test -- ci.test.js --noStackTrace
|
||||||
- name: Run linter
|
- name: Run linter
|
||||||
run: npm run linter
|
run: npm run linter
|
||||||
|
|
||||||
|
|||||||
@@ -2,12 +2,35 @@
|
|||||||
const path = require("path")
|
const path = require("path")
|
||||||
const git = require("simple-git")(path.join(__dirname, ".."))
|
const git = require("simple-git")(path.join(__dirname, ".."))
|
||||||
|
|
||||||
//Check generated files editions
|
//Edited files list
|
||||||
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+/, ""))
|
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+/, ""))
|
||||||
describe('Auto-generated files were not modified (use "git checkout @ -- file" if needed)', () => void test.each([
|
|
||||||
"README.md",
|
//Files editions
|
||||||
"source/plugins/README.md",
|
describe("Check files editions (checkout your files if needed)", () => {
|
||||||
"source/templates/README.md",
|
describe("Auto-generated files were not modified", () => void test.each([
|
||||||
"action.yml",
|
"README.md",
|
||||||
"settings.example.json"
|
"source/plugins/README.md",
|
||||||
])("%s", async file => expect((await diff()).includes(file)).toBe(false)))
|
"source/templates/README.md",
|
||||||
|
"action.yml",
|
||||||
|
"settings.example.json"
|
||||||
|
])("%s", async file => expect((await diff()).includes(file)).toBe(false)))
|
||||||
|
describe("Repository level files were not modified", () => void test.each([
|
||||||
|
".github/config/*",
|
||||||
|
".github/ISSUE_TEMPLATE/*",
|
||||||
|
".github/PULL_REQUEST_TEMPLATE/*",
|
||||||
|
".github/readme/README.md",
|
||||||
|
".github/readme/partials/*",
|
||||||
|
".github/workflows/*",
|
||||||
|
".github/FUNDING.yml",
|
||||||
|
".github/index.mjs",
|
||||||
|
".github/release.mjs",
|
||||||
|
"LICENSE",
|
||||||
|
"SECURITY.md",
|
||||||
|
"tests/ci.test.js"
|
||||||
|
])("%s", async file => expect((await diff()).filter(edited => new RegExp(`^${file.replace(/[.]/g, "[.]").replace(/[*]/g, "[\\s\\S]*")}$`).test(edited)).length).toBe(0)))
|
||||||
|
})
|
||||||
|
|
||||||
|
//Templates editions
|
||||||
|
describe("Check templates editions", () => {
|
||||||
|
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))
|
||||||
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user