Add Auto-format action (#33)
This commit is contained in:
parent
c7b03776ee
commit
7def0463b1
3 changed files with 45 additions and 18 deletions
28
.github/workflows/format.yml
vendored
Normal file
28
.github/workflows/format.yml
vendored
Normal 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
|
33
.github/workflows/nodejs.yml
vendored
33
.github/workflows/nodejs.yml
vendored
|
@ -3,8 +3,7 @@ name: Node CI
|
||||||
on: [push]
|
on: [push]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
test:
|
||||||
|
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
strategy:
|
strategy:
|
||||||
|
@ -12,19 +11,19 @@ jobs:
|
||||||
node-version: [14.x]
|
node-version: [14.x]
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v1
|
- uses: actions/checkout@v1
|
||||||
- name: Use Node.js ${{ matrix.node-version }}
|
- name: Use Node.js ${{ matrix.node-version }}
|
||||||
uses: actions/setup-node@v1
|
uses: actions/setup-node@v1
|
||||||
with:
|
with:
|
||||||
node-version: ${{ matrix.node-version }}
|
node-version: ${{ matrix.node-version }}
|
||||||
- name: npm install, build, and test
|
- name: npm install, build, and test
|
||||||
run: |
|
run: |
|
||||||
cd examples/snowpack
|
cd examples/snowpack
|
||||||
npm ci
|
npm ci
|
||||||
cd ../..
|
cd ../..
|
||||||
|
|
||||||
npm ci
|
npm ci
|
||||||
npm run build
|
npm run build
|
||||||
npm test
|
npm test
|
||||||
env:
|
env:
|
||||||
CI: true
|
CI: true
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
"build": "tsc",
|
"build": "tsc",
|
||||||
"dev": "tsc --watch",
|
"dev": "tsc --watch",
|
||||||
"lint": "eslint 'src/**/*.{js,ts}'",
|
"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",
|
"test": "uvu test -i fixtures -i test-utils.js",
|
||||||
"watch:extension": "cd vscode && npm run watch"
|
"watch:extension": "cd vscode && npm run watch"
|
||||||
},
|
},
|
||||||
|
|
Loading…
Add table
Reference in a new issue