From 7def0463b1688aa446665f0e5d4a1bc77ccb8dd3 Mon Sep 17 00:00:00 2001 From: Drew Powers <1369770+drwpow@users.noreply.github.com> Date: Fri, 26 Mar 2021 13:45:53 -0600 Subject: [PATCH] Add Auto-format action (#33) --- .github/workflows/format.yml | 28 ++++++++++++++++++++++++++++ .github/workflows/nodejs.yml | 33 ++++++++++++++++----------------- package.json | 2 +- 3 files changed, 45 insertions(+), 18 deletions(-) create mode 100644 .github/workflows/format.yml diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml new file mode 100644 index 000000000..b08505e01 --- /dev/null +++ b/.github/workflows/format.yml @@ -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 diff --git a/.github/workflows/nodejs.yml b/.github/workflows/nodejs.yml index 1890b86fe..0808ce599 100644 --- a/.github/workflows/nodejs.yml +++ b/.github/workflows/nodejs.yml @@ -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 \ No newline at end of file + npm ci + npm run build + npm test + env: + CI: true diff --git a/package.json b/package.json index 83fd7b9cd..0b5180136 100644 --- a/package.json +++ b/package.json @@ -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" },