mirror of
https://github.com/Sped0n/bridget.git
synced 2026-04-14 10:09:31 -07:00
feat(eslint.yml): add ESLint and Prettier workflow
This commit adds a new workflow file `.github/workflows/eslint.yml` that sets up a workflow for running ESLint and Prettier on push to the `main` branch, pull requests targeting the `main` branch, and manually triggered workflow dispatch events. The workflow runs on `ubuntu-latest` and consists of the following steps: 1. Checkout the repository 2. Setup pnpm version 8 3. Get the pnpm store directory path 4. Setup pnpm cache using the store path 5. Install dependencies using pnpm 6. Run ESLint and Prettier linting 7. Configure git user email and name for the commit 8. Check if there are any changes using `git diff` 9. If there are changes, add all changes and commit with the message "style: ESLint && Prettier" 10. Push the changes to the repository
This commit is contained in:
47
.github/workflows/eslint.yml
vendored
Normal file
47
.github/workflows/eslint.yml
vendored
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
name: 'ESLint && Prettier'
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
lint:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
name: Lint
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Setup pnpm
|
||||||
|
uses: pnpm/action-setup@v2
|
||||||
|
with:
|
||||||
|
version: 8
|
||||||
|
|
||||||
|
- name: Get pnpm store directory
|
||||||
|
id: pnpm-cache
|
||||||
|
run: echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
|
- name: Setup pnpm cache
|
||||||
|
uses: actions/cache@v3
|
||||||
|
with:
|
||||||
|
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
|
||||||
|
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
|
||||||
|
restore-keys: ${{ runner.os }}-pnpm-store-
|
||||||
|
|
||||||
|
- name: Install dependencies
|
||||||
|
run: pnpm install
|
||||||
|
|
||||||
|
- name: Lint
|
||||||
|
run: |
|
||||||
|
pnpm run lint
|
||||||
|
git config --global user.email "noreply@github.com"
|
||||||
|
git config --global user.name "CI"
|
||||||
|
git diff --quiet || (git add -A && git commit -m "style: ESlint && Prettier")
|
||||||
|
git push
|
||||||
Reference in New Issue
Block a user