Files
workflows/.gitea/scoped_workflows/style-web.yaml
T

85 lines
2.3 KiB
YAML

name: Code Style -- Web Components
run-name: 'Code Style -- Web Components -- ${{ gitea.repository }} ${{ gitea.ref_name }} ${{ gitea.sha }}'
on:
workflow_dispatch:
push:
branches:
- '*'
paths:
- '**/*.html'
- '**/*.css'
- '**/*.js'
jobs:
style-web:
runs-on: ubuntu-latest
steps:
- name: Check Out Repository
uses: actions/checkout@v4
with:
submodules: 'true'
- name: Initialize Runner
uses: actions/setup-node@v4
- name: Check and Run `make` Default Target
run: |
if command -v make &> /dev/null; then
make
fi
- name: Install Linters
run: |
npm install --no-save \
@eslint/eslintrc \
@eslint/js \
eslint \
globals \
html-validate \
stylelint \
stylelint-config-standard
- name: Verify Linters
run: |
npx html-validate --version
npx stylelint --version
npx eslint --version
- name: Run html-validate
id: style-html
if: always()
run: |
CONFIG_FILE="dev_config/.htmlvalidate.json"
if [ -f "$CONFIG_FILE" ]; then
npx html-validate --config="$CONFIG_FILE" '**/*.html'
fi
- name: Run stylelint
id: style-css
if: always()
run: |
CONFIG_FILE="dev_config/.stylelintrc.json"
IGNORE_FILE="dev_config/.stylelintignore"
if [ -f "$CONFIG_FILE" ]; then
if [ -f "$IGNORE_FILE" ]; then
npx stylelint --config "$CONFIG_FILE" --ignore-path "$IGNORE_FILE" --formatter verbose '**/*.css'
else
npx stylelint --config "$CONFIG_FILE" --formatter verbose '**/*.css'
fi
fi
- name: Run eslint
id: style-js
if: always()
run: |
CONFIG_FILE="dev_config/eslint.config.mjs"
if [ -f "$CONFIG_FILE" ]; then
npx eslint --config "$CONFIG_FILE" '**/*.js'
fi
- name: Verify Linters
if: >
steps.style-html.outcome != 'success' ||
steps.style-css.outcome != 'success' ||
steps.style-js.outcome != 'success'
run: exit 1