CI: add a prettier GitHub action to format code automatically (#988)
* CI: add a prettier GitHub action to format code automatically * improve GitHub Action config and format some files * Apply formatting changes * CI: make the prettier action a standalone action * Apply formatting changes * CI: add push as new trigger event Co-authored-by: Mark-Fenng <Mark-Fenng@users.noreply.github.com>
This commit is contained in:
2
.github/workflows/eslint.yml
vendored
2
.github/workflows/eslint.yml
vendored
@@ -1,6 +1,6 @@
|
||||
name: Eslint Check
|
||||
|
||||
on: [pull_request]
|
||||
on: [pull_request, push]
|
||||
|
||||
jobs:
|
||||
eslint_check_upload:
|
||||
|
||||
26
.github/workflows/prettier.yml
vendored
Normal file
26
.github/workflows/prettier.yml
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
name: Prettier
|
||||
|
||||
on: [pull_request, push]
|
||||
|
||||
jobs:
|
||||
prettier:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
ref: ${{ github.head_ref }}
|
||||
- name: Setup Node
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: 16
|
||||
cache: 'yarn'
|
||||
- name: Install Dependencies
|
||||
run: yarn
|
||||
- name: Prettify code
|
||||
run: yarn prettier --write '**/*.{ts,md}'
|
||||
- name: Commit changes
|
||||
uses: stefanzweifel/git-auto-commit-action@v4
|
||||
with:
|
||||
commit_message: Apply formatting changes
|
||||
branch: ${{ github.head_ref }}
|
||||
Reference in New Issue
Block a user