diff --git a/action.yml b/action.yml index 2968ba8..5031b01 100644 --- a/action.yml +++ b/action.yml @@ -3,22 +3,22 @@ on: [push, pull_request] jobs: check: - name: Check Commit Info + name: Check Commit Msg runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - uses: actions/setup-node@v2 with: node-version: 16.x - - name: check + - name: install fk-git-commit-msg-std + run: | + yarn add -D fk-git-commit-msg-std + - name: run check run: | node << 'CODE' - const { S, I } = require("./check.js") + const { S, I } = require("fk-git-commit-msg-std/check.js") const M = ${{ toJson(github.event.commits.*.message) }} - const F = I(M, { - debug: false, - // TODO: more configuration here - }) + const F = I(M, A) process.exit(F) CODE diff --git a/check.js b/check.js index 01cd963..63acbfc 100644 --- a/check.js +++ b/check.js @@ -177,7 +177,9 @@ const C = { } const I = (msgs, args) => { - Object.assign(S, args) + for (const [ k, v ] of Object.entries(args)) + S[k] = typeof v == "function" ? v(S[k]) : v + if (S.debug) L("🔎 Debugging is on") let fail = 0 diff --git a/package.json b/package.json new file mode 100644 index 0000000..c9d0c1d --- /dev/null +++ b/package.json @@ -0,0 +1,9 @@ +{ + "name": "fk-git-commit-msg-std", + "version": "0.0.1", + "description": "Check if git commit messages meet ForkKILLET standard.", + "main": "check.js", + "repository": "https://github.com/ForkFG/FkGitCommitInfoStd.git", + "author": "ForkΨKILLET ", + "license": "MIT" +}