Skip to content

Merge pull request #2651 from nahuhh/v18.5.0 #12

Merge pull request #2651 from nahuhh/v18.5.0

Merge pull request #2651 from nahuhh/v18.5.0 #12

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
env:
BASE_BRANCH: ${{ github.event.pull_request.base.ref }} # PR target branch
BASE_REF: ${{ github.event_name == 'push' && github.event.before || '' }} # previous commit before the push event
run: |
ARGS="--limit-posts 10 --skip-og --limit-locales"
if [ -n "$BASE_BRANCH" ]; then ARGS="$ARGS --base-branch $BASE_BRANCH"; fi
if [ -n "$BASE_REF" ]; then ARGS="$ARGS --base-ref $BASE_REF"; fi
pnpm prepare-build $ARGS
- name: Build site
env:
SKIP_IMAGE_OPTIMIZATION: "true"
run: pnpm build
- name: Validate built HTML
run: pnpm exec htmlhint 'dist/**/*.html'