* 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>
27 lines
653 B
YAML
27 lines
653 B
YAML
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 }}
|