feat: add lint, format and test workflows for CI #4
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Format | |
on: | |
push: | |
branches: [dev] | |
pull_request: | |
branches: [main, dev] | |
jobs: | |
format: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
persist-credentials: true | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: lts/* | |
- name: Install pnpm | |
uses: pnpm/action-setup@v3 | |
with: | |
version: latest | |
- name: Install dependencies | |
run: pnpm install | |
- name: Check formatting | |
run: pnpm run format:check | |
- name: Format code | |
run: pnpm run format | |
- name: Commit formatted files | |
run: | | |
git config --local user.email "[email protected]" | |
git config --local user.name "GitHub Action" | |
git add . | |
git commit -m "style: format code" || echo "No changes to commit" | |
- name: Push changes | |
uses: ad-m/github-push-action@master | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} |