70 lines
2.0 KiB
YAML
70 lines
2.0 KiB
YAML
# This workflow checks CSS/SCSS code quality and formatting
|
|
# Triggers:
|
|
# - Push/PR with changes to web/ directory
|
|
# Checks:
|
|
# - Prettier formatting for CSS/SCSS files
|
|
# - Stylelint rules for code quality
|
|
# Note: Only runs when CSS or SCSS files are changed
|
|
|
|
name: CSS Lint and Formatting
|
|
|
|
on:
|
|
push:
|
|
paths:
|
|
- 'web/**'
|
|
pull_request:
|
|
paths:
|
|
- 'web/**'
|
|
|
|
jobs:
|
|
css-lint:
|
|
runs-on: ubuntu-latest
|
|
defaults:
|
|
run:
|
|
working-directory: ./web
|
|
|
|
steps:
|
|
- name: Check out pull request code
|
|
uses: actions/checkout@v6
|
|
if: github.event_name == 'pull_request'
|
|
with:
|
|
repository: ${{ github.event.pull_request.head.repo.full_name }}
|
|
ref: ${{ github.event.pull_request.head.ref }}
|
|
fetch-depth: 0
|
|
|
|
- name: Fetch base branch for comparison
|
|
if: github.event_name == 'pull_request'
|
|
run: |
|
|
git remote add upstream https://github.com/${{ github.event.pull_request.base.repo.full_name }}.git || true
|
|
git fetch upstream ${{ github.event.pull_request.base.ref }}
|
|
|
|
- name: Check out repository code
|
|
uses: actions/checkout@v6
|
|
if: github.event_name == 'push'
|
|
|
|
- name: Get changed files
|
|
id: changed-files-yaml
|
|
uses: tj-actions/changed-files@v47
|
|
with:
|
|
path: 'web'
|
|
files_yaml: |
|
|
src:
|
|
- '**/*.{css,scss}'
|
|
|
|
- name: Set up Node.js
|
|
uses: actions/setup-node@v6
|
|
with:
|
|
node-version: '24.12.0'
|
|
|
|
- name: Install dependencies
|
|
if: steps.changed-files-yaml.outputs.src_any_changed == 'true'
|
|
run: npm install
|
|
|
|
- name: Run Prettier
|
|
if: steps.changed-files-yaml.outputs.src_any_changed == 'true'
|
|
run: npx prettier --check ${{ steps.changed-files-yaml.outputs.src_all_changed_files }}
|
|
|
|
- name: Run Stylelint
|
|
if: steps.changed-files-yaml.outputs.src_any_changed == 'true'
|
|
run: npx stylelint ${{ steps.changed-files-yaml.outputs.src_all_changed_files }}
|