Skip to content

fix: SEO, performance, minor bugs #9

fix: SEO, performance, minor bugs

fix: SEO, performance, minor bugs #9

name: ๐ŸŽจ Code Lint and Format
on:
pull_request:
types: [opened, synchronize]
concurrency:
group: code-lint-format
cancel-in-progress: true
jobs:
build-and-deploy:
name: ๐Ÿ› ๏ธ Code linter and formatter
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
issues: write
steps:
- name: ๐Ÿ“ฅ Checkout Code
uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
name: ๐Ÿ› ๏ธ Install pnpm
with:
run_install: false
- name: ๐Ÿ› ๏ธ Setup Node
uses: actions/setup-node@v4
with:
node-version: 'lts/*'
cache: 'pnpm'
- name: ๐Ÿ—‚๏ธ Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- uses: actions/cache@v4
name: โšก Setup pnpm cache
with:
path: ${{ env.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 Code
run: pnpm lint:fix | tee lint-results.txt
- name: ๐ŸŽจ Format Code
run: pnpm format | tee prettier-results.txt
- name: ๐Ÿšฎ Clean up results
run: |
sed -i 's/\x1b\[[0-9;]*m//g' prettier-results.txt
sed -i 's/\x1b\[[0-9;]*m//g' lint-results.txt
- name: ๐Ÿ“„ Format all results
run: |
{
echo "### ๐ŸŽจ Prettier Format Check"
echo ""
if grep -q "(changed)" prettier-results.txt; then
echo "โš ๏ธ **Prettier Issues Found** - Some format issues are fixed automatically by Prettier:"
echo '```'
grep -E "\s+\(changed\)" prettier-results.txt || true
echo '```'
else
echo "โœ… **Prettier**: No formatting issues found!"
fi
echo ""
echo "### ๐ŸŽจ Lint Check"
echo ""
if grep -qE "^[^0]* problems" lint-results.txt; then
echo "โš ๏ธ **Lint Issues Found** - PLEASE FIX THEM!"
echo '```'
cat lint-results.txt
echo '```'
else
echo "โœ… **Lint**: No linting issues found!"
fi
} > formatted-results.txt
- name: ๐Ÿ’ฌ Post test results and preview link to PR
uses: actions/github-script@v7
with:
script: |
const fs = require('fs');
const testResults = fs.readFileSync('formatted-results.txt', 'utf8');
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: `${testResults}`
});