Skip to content

chore: Review formatting and linting rules + add pre-commit hook #195

chore: Review formatting and linting rules + add pre-commit hook

chore: Review formatting and linting rules + add pre-commit hook #195

Workflow file for this run

name: Lint Code
on:
push:
branches:
- develop
- main
pull_request:
branches:
- develop
- main
jobs:
lint:
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
env:
THUMBNAIL_URL: ${{ vars.THUMBNAIL_URL }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
fetch-depth: 0
- name: Install bun
uses: oven-sh/setup-bun@v2
- name: Install dependencies
run: bun install
- name: Run linter
run: bun run lint
- name: Check for changes
id: verify-changed-files
run: |
if [ -n "$(git status --porcelain)" ]; then
echo "changed=true" >> $GITHUB_OUTPUT
else
echo "changed=false" >> $GITHUB_OUTPUT
fi
- name: Commit linter changes
if: steps.verify-changed-files.outputs.changed == 'true'
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
# Ensure we're on the correct branch
if [ "${{ github.event_name }}" = "pull_request" ]; then
BRANCH_NAME="${{ github.head_ref }}"
git checkout $BRANCH_NAME || git checkout -b $BRANCH_NAME
else
BRANCH_NAME="${{ github.ref_name }}"
git checkout $BRANCH_NAME || git checkout -b $BRANCH_NAME
fi
git add .
git commit -m "🔧 Auto-fix: ESLint formatting and fixes"
git push origin $BRANCH_NAME