Skip to content

optimize CI workflow and add preparation script #3

optimize CI workflow and add preparation script

optimize CI workflow and add preparation script #3

Workflow file for this run

name: CI
on:
push:
branches: [beta]
pull_request:
branches: [beta]
permissions:
contents: read
jobs:
lint:
name: Lint & Format
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v6
- name: Check set:html safety
run: |
if grep -r "set:html" src --include="*.astro" | grep -Ev "set:html=\{(safeMarkdown\.|DOMPurify\.sanitize)"; then
echo "Error: Found set:html usage without safeMarkdown or DOMPurify.sanitize"
exit 1
fi
echo "All set:html usages are safe"
- name: Setup pnpm
uses: pnpm/action-setup@v4
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: "22"
cache: "pnpm"
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: ESLint - TypeScript validity
run: pnpm lint
- name: Stylelint - CSS compatibility
run: pnpm lint:css
- name: Prettier - Code formatting
run: pnpm format:check
- name: Type check
run: pnpm check
build:
name: Build & Validate
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v6
- name: Setup pnpm
uses: pnpm/action-setup@v4
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: "22"
cache: "pnpm"
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Prepare source for CI build
run: >-
pnpm prepare-ci
--limit-posts 10
--skip-og
--limit-locales
--base-sha ${{ github.event.pull_request.base.sha }}
- name: Build site
env:
SKIP_IMAGE_OPTIMIZATION: "true"
run: pnpm build
- name: Validate built HTML
run: pnpm exec htmlhint 'dist/**/*.html'