Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 0 additions & 17 deletions .github/workflows/eslint.yaml

This file was deleted.

23 changes: 0 additions & 23 deletions .github/workflows/format.yaml

This file was deleted.

65 changes: 65 additions & 0 deletions .github/workflows/lint-and-format.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: Lint and Format

on:
pull_request:
branches-ignore: [ wip/*, draft/*, temp/* ]

permissions:
contents: write
pull-requests: write

jobs:
lint-and-format:
runs-on: ubuntu-latest
steps:
- name: Checkout PR
uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
ref: ${{ github.head_ref }}
fetch-depth: 0

- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: 'lts/*'
cache: 'npm'

- name: Install dependencies
run: npm ci

- name: Run ESLint with auto-fix
run: npm run lint:fix

- name: Run Prettier with auto-format
run: npm run format

- 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 changes
if: steps.verify-changed-files.outputs.changed == 'true'
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git add .
git commit -m "[auto-fix] Apply ESLint and Prettier fixes"
git push

- name: Comment on PR
if: steps.verify-changed-files.outputs.changed == 'true'
uses: actions/github-script@v7
with:
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: '✅ **Auto-fix Applied**\n\nESLint and Prettier have automatically fixed formatting and linting issues in this PR. The changes have been committed to this branch.'
})