Add Auto-format action (#33)

This commit is contained in:
Drew Powers 2021-03-26 13:45:53 -06:00 committed by GitHub
parent c7b03776ee
commit 7def0463b1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 45 additions and 18 deletions

28
.github/workflows/format.yml vendored Normal file
View file

@ -0,0 +1,28 @@
name: 'Format Code'
on:
push:
branches:
- main
env:
node_version: 14
jobs:
format:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
ref: ${{ github.head_ref }}
- uses: actions/setup-node@v1
with:
node-version: ${{ env.node_version }}
- run: npm ci
- run: npm run format
- name: Commit changes
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: '[ci] npm run format'
branch: ${{ github.head_ref }}
push_options: --force

View file

@ -3,8 +3,7 @@ name: Node CI
on: [push]
jobs:
build:
test:
runs-on: ubuntu-latest
strategy:
@ -12,19 +11,19 @@ jobs:
node-version: [14.x]
steps:
- uses: actions/checkout@v1
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: npm install, build, and test
run: |
cd examples/snowpack
npm ci
cd ../..
- uses: actions/checkout@v1
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: npm install, build, and test
run: |
cd examples/snowpack
npm ci
cd ../..
npm ci
npm run build
npm test
env:
CI: true
npm ci
npm run build
npm test
env:
CI: true

View file

@ -19,7 +19,7 @@
"build": "tsc",
"dev": "tsc --watch",
"lint": "eslint 'src/**/*.{js,ts}'",
"format": "prettier -w 'src/**/*.{js,ts}'",
"format": "prettier -w '{src,test}/**/*.{js,ts}'",
"test": "uvu test -i fixtures -i test-utils.js",
"watch:extension": "cd vscode && npm run watch"
},