Skip to content

Commit

Permalink
Merge pull request #22 from yarastqt/yarastqt.issue-5
Browse files Browse the repository at this point in the history
Add github workflows
  • Loading branch information
yarastqt authored May 8, 2020
2 parents d07265e + 5ece5e3 commit c3eb467
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 0 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# folders
lib
node_modules
examples

# files
*.d.ts
28 changes: 28 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: ci

on:
push:
branches:
- master
pull_request:
branches:
- master

jobs:
linters:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v1
- uses: actions/setup-node@v1
with:
node-version: 8

- name: install root-deps
run: npm ci --ignore-scripts

- name: commitlint
run: node ./tools/commitlint.js

- name: eslint
run: npm run lint:js
27 changes: 27 additions & 0 deletions tools/commitlint.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
'use strict'

const { execSync } = require('child_process')

const commitMessages = execSync('git log origin/master..HEAD --pretty=format:%s')
.toString()
.split('\n')
.map((message) => message.trim())
.filter((message) => message)

const errors = []

// eslint-disable-next-line no-console
console.log('❯ commits:', commitMessages)

for (let message of commitMessages) {
message = message.trim().replace(/'/g, "'\\''")
try {
execSync(`echo '${message}' | npx commitlint`, { stdio: 'inherit' })
} catch (error) {
errors.push(error)
}
}

if (errors.length !== 0) {
process.exit(1)
}

0 comments on commit c3eb467

Please sign in to comment.